activemq-cpp-3.6.0
activemq::util::PrimitiveMap Class Reference

Map of named primitives. More...

#include <src/main/activemq/util/PrimitiveMap.h>

Inheritance diagram for activemq::util::PrimitiveMap:

Public Member Functions

 PrimitiveMap ()
 Default Constructor, creates an empty map.
virtual ~PrimitiveMap ()
 PrimitiveMap (const decaf::util::Map< std::string, PrimitiveValueNode > &source)
 Copy Constructor.
 PrimitiveMap (const PrimitiveMap &source)
 Copy Constructor.
std::string toString () const
 Converts the contents into a formatted string that can be output in a Log File or other debugging tool.
virtual
PrimitiveValueNode::PrimitiveType 
getValueType (const std::string &key) const
virtual bool getBool (const std::string &key) const
 Gets the Boolean value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setBool (const std::string &key, bool value)
 Sets the value at key to the specified type.
virtual unsigned char getByte (const std::string &key) const
 Gets the Byte value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setByte (const std::string &key, unsigned char value)
 Sets the value at key to the specified type.
virtual char getChar (const std::string &key) const
 Gets the Character value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setChar (const std::string &key, char value)
 Sets the value at key to the specified type.
virtual short getShort (const std::string &key) const
 Gets the Short value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setShort (const std::string &key, short value)
 Sets the value at key to the specified type.
virtual int getInt (const std::string &key) const
 Gets the Integer value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setInt (const std::string &key, int value)
 Sets the value at key to the specified type.
virtual long long getLong (const std::string &key) const
 Gets the Long value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setLong (const std::string &key, long long value)
 Sets the value at key to the specified type.
virtual float getFloat (const std::string &key) const
 Gets the Float value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setFloat (const std::string &key, float value)
 Sets the value at key to the specified type.
virtual double getDouble (const std::string &key) const
 Gets the Double value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setDouble (const std::string &key, double value)
 Sets the value at key to the specified type.
virtual std::string getString (const std::string &key) const
 Gets the String value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setString (const std::string &key, const std::string &value)
 Sets the value at key to the specified type.
virtual std::vector< unsigned
char > 
getByteArray (const std::string &key) const
 Gets the Byte Array value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.
virtual void setByteArray (const std::string &key, const std::vector< unsigned char > &value)
 Sets the value at key to the specified type.
- Public Member Functions inherited from decaf::util::StlMap< std::string, PrimitiveValueNode >
 StlMap ()
 Default constructor - does nothing.
 StlMap (const StlMap &source)
 Copy constructor - copies the content of the given map into this one.
 StlMap (const Map< std::string, PrimitiveValueNode > &source)
 Copy constructor - copies the content of the given map into this one.
virtual ~StlMap ()
virtual bool equals (const StlMap &source) const
 
virtual bool equals (const Map< std::string, PrimitiveValueNode > &source) const
 
virtual void copy (const StlMap &source)
 
virtual void copy (const Map< std::string, PrimitiveValueNode > &source)
 
virtual void clear ()
 Removes all of the mappings from this map (optional operation).The map will be empty after this call returns.
Exceptions
UnsupportedOperationExceptionif the clear operation is not supported by this map.

virtual bool containsKey (const std::string &key) const
 Returns true if this map contains a mapping for the specified key.More formally, returns true if and only if this map contains a mapping for a key k such that (key == k). (There can be at most one such mapping.)
Parameters
keyThe key to look up.
Returns
true if this map contains the key mapping, otherwise false.

virtual bool containsValue (const PrimitiveValueNode &value) const
 Returns true if this map maps one or more keys to the specified value.More formally, returns true if and only if this map contains at least one mapping to a value v such that (value==v). This operation will probably require time linear in the map size for most implementations of the Map interface.
Parameters
valueThe Value to look up in this Map.
Returns
true if this map contains at least one mapping for the value, otherwise false.

virtual bool isEmpty () const
 
Returns
if the Map contains any element or not, TRUE or FALSE

virtual int size () const
 
Returns
The number of elements (key/value pairs) in this map.

virtual PrimitiveValueNode & get (const std::string &key)
 Gets the value mapped to the specified key in the Map.If there is no element in the map whose key is equivalent to the key provided then a NoSuchElementException is thrown.
Parameters
keyThe search key whose value should be returned if present.
Returns
A reference to the value for the given key if present in the Map.
Exceptions
NoSuchElementExceptionif the key requests doesn't exist in the Map.

virtual const PrimitiveValueNode & get (const std::string &key) const
 Gets the value mapped to the specified key in the Map.If there is no element in the map whose key is equivalent to the key provided then a NoSuchElementException is thrown.
Parameters
keyThe search key whose value should be returned if present.
Returns
A const reference to the value for the given key if present in the Map.
Exceptions
NoSuchElementExceptionif the key requests doesn't exist in the Map.

virtual bool put (const std::string &key, const PrimitiveValueNode &value)
 Associates the specified value with the specified key in this map (optional operation).If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)
Parameters
keyThe target key.
valueThe value to be set.
Returns
true if the put operation replaced a value that was associated with an existing mapping to the given key or false otherwise.
Exceptions
UnsupportedOperationExceptionif this map is unmodifiable.
IllegalArgumentExceptionif some property of the specified key or value prevents it from being stored in this map

virtual bool put (const std::string &key, const PrimitiveValueNode &value, PrimitiveValueNode &oldValue)
 Associates the specified value with the specified key in this map (optional operation).If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)This method accepts a reference to a value which will be assigned the previous value for the given key (if any). If there was no previous mapping for the given key the out value is not written to. A return of true indicates that a value was replaced by this put operation.
Parameters
keyThe target key.
valueThe value to be set.
oldValue(out) The value previously held in the mapping for this key. .
Returns
true if the put operation replaced a value that was associated with an existing mapping to the given key or false otherwise.
Exceptions
UnsupportedOperationExceptionif this map is unmodifiable.
IllegalArgumentExceptionif some property of the specified key or value prevents it from being stored in this map

virtual void putAll (const StlMap< std::string, PrimitiveValueNode, std::less< std::string > > &other)
 
virtual void putAll (const Map< std::string, PrimitiveValueNode > &other)
 Copies all of the mappings from the specified map to this map (optional operation).The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.
Parameters
otherA Map instance whose elements are to all be inserted in this Map.
Exceptions
UnsupportedOperationExceptionIf the implementing class does not support the putAll operation.

virtual PrimitiveValueNode remove (const std::string &key)
 Removes the value (key/value pair) for the specified key from the map, returns a copy of the value that was mapped to the key.Care must be taken when using this operation as it will throw an exception if there is no mapping for the given key.
Parameters
keyThe search key whose mapping is to be removed.
Returns
a copy of the element that was previously mapped to the given key.
Exceptions
NoSuchElementExceptionif this key is not in the Map.
UnsupportedOperationExceptionif this map is unmodifiable.

virtual Set< MapEntry
< std::string,
PrimitiveValueNode > > & 
entrySet ()
 Returns a Set view of the mappings contained in this map.
virtual const Set< MapEntry
< std::string,
PrimitiveValueNode > > & 
entrySet () const
virtual Set< std::string > & keySet ()
 Returns a Set view of the keys contained in this map.
virtual const Set< std::string > & keySet () const
virtual Collection
< PrimitiveValueNode > & 
values ()
 Returns a Collection view of the values contained in this map.
virtual const Collection
< PrimitiveValueNode > & 
values () const
virtual void lock ()
 Locks the object.
virtual bool tryLock ()
 Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
virtual void unlock ()
 Unlocks the object.
virtual void wait ()
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs)
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs, int nanos)
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void notify ()
 Signals a waiter on this object that it can now wake up and continue.
virtual void notifyAll ()
 Signals the waiters on this object that it can now wake up and continue.
- Public Member Functions inherited from decaf::util::Map< std::string, PrimitiveValueNode >
 Map ()
 Default constructor - does nothing.
virtual ~Map ()
virtual bool equals (const Map &source) const =0
 Compares the specified object with this map for equality.
virtual void copy (const Map &source)=0
 Copies the content of the source map into this map.
- Public Member Functions inherited from decaf::util::concurrent::Synchronizable
virtual ~Synchronizable ()

Detailed Description

Map of named primitives.

Constructor & Destructor Documentation

activemq::util::PrimitiveMap::PrimitiveMap ( )

Default Constructor, creates an empty map.

virtual activemq::util::PrimitiveMap::~PrimitiveMap ( )
virtual
activemq::util::PrimitiveMap::PrimitiveMap ( const decaf::util::Map< std::string, PrimitiveValueNode > &  source)

Copy Constructor.

Parameters
sourceThe Decaf Library Map instance whose elements will be copied into this Map.
activemq::util::PrimitiveMap::PrimitiveMap ( const PrimitiveMap source)

Copy Constructor.

Parameters
sourceThe PrimitiveMap whose elements will be copied into this Map.

Member Function Documentation

virtual bool activemq::util::PrimitiveMap::getBool ( const std::string &  key) const
virtual

Gets the Boolean value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual unsigned char activemq::util::PrimitiveMap::getByte ( const std::string &  key) const
virtual

Gets the Byte value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual std::vector<unsigned char> activemq::util::PrimitiveMap::getByteArray ( const std::string &  key) const
virtual

Gets the Byte Array value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual char activemq::util::PrimitiveMap::getChar ( const std::string &  key) const
virtual

Gets the Character value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual double activemq::util::PrimitiveMap::getDouble ( const std::string &  key) const
virtual

Gets the Double value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual float activemq::util::PrimitiveMap::getFloat ( const std::string &  key) const
virtual

Gets the Float value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual int activemq::util::PrimitiveMap::getInt ( const std::string &  key) const
virtual

Gets the Integer value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual long long activemq::util::PrimitiveMap::getLong ( const std::string &  key) const
virtual

Gets the Long value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual short activemq::util::PrimitiveMap::getShort ( const std::string &  key) const
virtual

Gets the Short value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual std::string activemq::util::PrimitiveMap::getString ( const std::string &  key) const
virtual

Gets the String value at the given key, if the key is not in the map or cannot be returned as the requested value then an exception of type NoSuchElementException is thrown.

Parameters
key- the location to return the value from.
Returns
the value at key in the type requested.
Exceptions
NoSuchElementExceptionif key is not in the map.
UnSupportedOperationExceptionif the value cannot be converted to the type this method returns
virtual PrimitiveValueNode::PrimitiveType activemq::util::PrimitiveMap::getValueType ( const std::string &  key) const
virtual
Returns
the numeric type value for the given key if it exists.
Exceptions
NoSuchElementExceptionif the key is not present in the map.
virtual void activemq::util::PrimitiveMap::setBool ( const std::string &  key,
bool  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setByte ( const std::string &  key,
unsigned char  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setByteArray ( const std::string &  key,
const std::vector< unsigned char > &  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setChar ( const std::string &  key,
char  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setDouble ( const std::string &  key,
double  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setFloat ( const std::string &  key,
float  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setInt ( const std::string &  key,
int  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setLong ( const std::string &  key,
long long  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setShort ( const std::string &  key,
short  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
virtual void activemq::util::PrimitiveMap::setString ( const std::string &  key,
const std::string &  value 
)
virtual

Sets the value at key to the specified type.

Overwrites any data that was previously at this key or inserts a new element at key.

Parameters
key- the map key to set or insert.
value- the new value to set at the key location.
std::string activemq::util::PrimitiveMap::toString ( ) const

Converts the contents into a formatted string that can be output in a Log File or other debugging tool.

Returns
formatted String of all elements in the map.

The documentation for this class was generated from the following file: