You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/07/21 13:36:16 UTC
svn commit: r424272 [8/10] - in /incubator/activemq/trunk/activemq-cpp: ./
src/examples/ src/main/activemq/concurrent/ src/main/activemq/connector/
src/main/activemq/connector/stomp/
src/main/activemq/connector/stomp/commands/ src/main/activemq/connect...
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.cpp Fri Jul 21 04:36:09 2006
@@ -24,34 +24,34 @@
////////////////////////////////////////////////////////////////////////////////
Guid::Guid(void)
{
- // Clear internal uuid, would pass isNull
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- memset(&uuid, 0, sizeof(uuid_t));
- #else
- ::UuidCreateNil(&uuid);
- #endif
+ // Clear internal uuid, would pass isNull
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ memset(&uuid, 0, sizeof(uuid_t));
+ #else
+ ::UuidCreateNil(&uuid);
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-Guid::Guid(const Guid& source)
+Guid::Guid( const Guid& source )
{
- // Set this uuid to that of the source
- *this = source;
+ // Set this uuid to that of the source
+ *this = source;
}
////////////////////////////////////////////////////////////////////////////////
-Guid::Guid(const std::string& source)
+Guid::Guid( const std::string& source )
throw ( IllegalArgumentException )
{
- if(source == "")
- {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "GUID::fromBytes - Source was Empty");
- }
+ if(source == "")
+ {
+ throw IllegalArgumentException(
+ __FILE__, __LINE__,
+ "GUID::fromBytes - Source was Empty");
+ }
- // Set this uuid to that of the source
- *this = source;
+ // Set this uuid to that of the source
+ *this = source;
}
////////////////////////////////////////////////////////////////////////////////
@@ -62,344 +62,343 @@
////////////////////////////////////////////////////////////////////////////////
bool Guid::isNull(void) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // Check the uuid APIs is null method
- return uuid_is_null(*(const_cast<uuid_t*>(&uuid))) == 1 ? true : false;
- #else
- RPC_STATUS status;
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // Check the uuid APIs is null method
+ return uuid_is_null(*(const_cast<uuid_t*>(&uuid))) == 1 ? true : false;
+ #else
+ RPC_STATUS status;
- BOOL result = ::UuidIsNil( const_cast<GUID*>( &uuid ), &status );
+ BOOL result = ::UuidIsNil( const_cast<GUID*>( &uuid ), &status );
- return (result == TRUE) ? true : false;
+ return (result == TRUE) ? true : false;
#endif
}
////////////////////////////////////////////////////////////////////////////////
void Guid::setNull(void)
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // use the uuid function to clear
- uuid_clear(uuid);
- #else
- ::UuidCreateNil(&uuid);
- #endif
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // use the uuid function to clear
+ uuid_clear(uuid);
+ #else
+ ::UuidCreateNil(&uuid);
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
Guid& Guid::createGUID(void) throw( RuntimeException )
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // Use the uuid_generate method to create a new GUID
- uuid_generate(uuid);
- #else
- // Create a uuid with the Co Create GUID
- RPC_STATUS lhResult = ::UuidCreate( &uuid );
-
- if ( lhResult == RPC_S_UUID_NO_ADDRESS )
- {
- throw RuntimeException(
- __FILE__, __LINE__,
- "GUIG::createGUID - Failed Creating GUID");
- }
- #endif
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // Use the uuid_generate method to create a new GUID
+ uuid_generate(uuid);
+ #else
+ // Create a uuid with the Co Create GUID
+ RPC_STATUS lhResult = ::UuidCreate( &uuid );
+
+ if ( lhResult == RPC_S_UUID_NO_ADDRESS )
+ {
+ throw RuntimeException(
+ __FILE__, __LINE__,
+ "GUIG::createGUID - Failed Creating GUID");
+ }
+ #endif
- return *this;
+ return *this;
}
////////////////////////////////////////////////////////////////////////////////
std::string Guid::toString(void) const throw( RuntimeException )
{
- std::string uuid_str = "";
+ std::string uuid_str = "";
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // Create storage for the string buffer
- char buffer[36] = {0};
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // Create storage for the string buffer
+ char buffer[36] = {0};
- // parse the uuid to the string
- uuid_unparse(*(const_cast<uuid_t*>(&uuid)), buffer);
+ // parse the uuid to the string
+ uuid_unparse(*(const_cast<uuid_t*>(&uuid)), buffer);
- // Store it in a string
- uuid_str = buffer;
- #else
- // Convert the GUID object to a string.
- unsigned char* guidStr = 0;
-
- RPC_STATUS result = ::UuidToString(
- const_cast<GUID*>(&uuid),
- &guidStr);
-
- if(result == RPC_S_OUT_OF_MEMORY)
- {
- throw RuntimeException(
- __FILE__, __LINE__,
- "GUIG::createGUID - Failed Creating GUID");
- }
-
- uuid_str = (char*)guidStr;
+ // Store it in a string
+ uuid_str = buffer;
+ #else
+ // Convert the GUID object to a string.
+ unsigned char* guidStr = 0;
+
+ RPC_STATUS result = ::UuidToString(
+ const_cast<GUID*>(&uuid), &guidStr);
+
+ if(result == RPC_S_OUT_OF_MEMORY)
+ {
+ throw RuntimeException(
+ __FILE__, __LINE__,
+ "GUIG::createGUID - Failed Creating GUID");
+ }
+
+ uuid_str = (char*)guidStr;
+
+ // Dispose of the GUID string.
+ ::RpcStringFree(&guidStr);
+ #endif
- // Dispose of the GUID string.
- ::RpcStringFree(&guidStr);
- #endif
-
- return uuid_str;
+ return uuid_str;
}
////////////////////////////////////////////////////////////////////////////////
Guid::operator std::string() const
{
- return toString();
+ return toString();
}
////////////////////////////////////////////////////////////////////////////////
const unsigned char* Guid::toBytes(void) const
{
- unsigned char* buffer = new unsigned char[getRawBytesSize()];
+ unsigned char* buffer = new unsigned char[getRawBytesSize()];
- // copy our buffer
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- uuid_copy(buffer, *(const_cast<uuid_t*>(&uuid)));
- #else
- memcpy(buffer, &uuid, getRawBytesSize());
- #endif
+ // copy our buffer
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ uuid_copy(buffer, *(const_cast<uuid_t*>(&uuid)));
+ #else
+ memcpy(buffer, &uuid, getRawBytesSize());
+ #endif
- return &buffer[0];
+ return &buffer[0];
}
////////////////////////////////////////////////////////////////////////////////
-Guid& Guid::fromBytes(const unsigned char* bytes)
+Guid& Guid::fromBytes( const unsigned char* bytes )
throw ( IllegalArgumentException )
{
- if(bytes == NULL)
- {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "GUID::fromBytes - bytes pointer was NULL");
- }
+ if(bytes == NULL)
+ {
+ throw IllegalArgumentException(
+ __FILE__, __LINE__,
+ "GUID::fromBytes - bytes pointer was NULL");
+ }
- // Copy the data
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- memcpy(uuid, bytes, getRawBytesSize());
- #else
- memcpy(&uuid, bytes, getRawBytesSize());
- #endif
+ // Copy the data
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ memcpy(uuid, bytes, getRawBytesSize());
+ #else
+ memcpy(&uuid, bytes, getRawBytesSize());
+ #endif
- return *this;
+ return *this;
}
////////////////////////////////////////////////////////////////////////////////
int Guid::getRawBytesSize(void) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- return sizeof(uuid_t);
- #else
- return sizeof(::GUID);
- #endif
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ return sizeof(uuid_t);
+ #else
+ return sizeof(::GUID);
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
Guid::operator const unsigned char*() const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- return &uuid[0];
- #else
- return reinterpret_cast<const unsigned char*>(&uuid);
- #endif
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ return &uuid[0];
+ #else
+ return reinterpret_cast<const unsigned char*>(&uuid);
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-Guid& Guid::operator=(const Guid& source)
+Guid& Guid::operator=( const Guid& source )
throw ( IllegalArgumentException )
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // Use the uuid method to copy
- uuid_copy(uuid, *(const_cast<uuid_t*>(&source.uuid)));
- #else
- // Use mem copy
- memcpy(&uuid, &source.uuid, getRawBytesSize());
- #endif
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // Use the uuid method to copy
+ uuid_copy(uuid, *(const_cast<uuid_t*>(&source.uuid)));
+ #else
+ // Use mem copy
+ memcpy(&uuid, &source.uuid, getRawBytesSize());
+ #endif
- return *this;
+ return *this;
}
////////////////////////////////////////////////////////////////////////////////
-Guid& Guid::operator=(const std::string& source)
- throw ( IllegalArgumentException )
+Guid& Guid::operator=( const std::string& source )
+ throw ( IllegalArgumentException )
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // Parse a uuid from the passed in string
- uuid_parse( const_cast<char*>(source.c_str()), uuid );
- #else
- if ( source.empty() )
- {
- ::UuidCreateNil( &uuid );
- }
- else
- {
- RPC_STATUS hResult =
- ::UuidFromString( (unsigned char*)source.c_str(), &uuid );
-
- if ( hResult == RPC_S_INVALID_STRING_UUID )
- {
- throw IllegalArgumentException(
- __FILE__, __LINE__,
- "GUID::fromBytes - Invalid GUID String");
- }
- }
- #endif
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // Parse a uuid from the passed in string
+ uuid_parse( const_cast<char*>(source.c_str()), uuid );
+ #else
+ if ( source.empty() )
+ {
+ ::UuidCreateNil( &uuid );
+ }
+ else
+ {
+ RPC_STATUS hResult =
+ ::UuidFromString( (unsigned char*)source.c_str(), &uuid );
+
+ if ( hResult == RPC_S_INVALID_STRING_UUID )
+ {
+ throw IllegalArgumentException(
+ __FILE__, __LINE__,
+ "GUID::fromBytes - Invalid GUID String");
+ }
+ }
+ #endif
- return *this;
+ return *this;
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator==(const Guid& source) const
+bool Guid::operator==( const Guid& source ) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // uuid_compare returns 0 for equal
- return uuid_compare(
- *(const_cast<uuid_t*>(&uuid)),
- *(const_cast<uuid_t*>(&source.uuid))) == 0 ? true : false;
- #else
- RPC_STATUS status;
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // uuid_compare returns 0 for equal
+ return uuid_compare(
+ *(const_cast<uuid_t*>(&uuid)),
+ *(const_cast<uuid_t*>(&source.uuid))) == 0 ? true : false;
+ #else
+ RPC_STATUS status;
- BOOL result = ::UuidEqual(
- const_cast<GUID*>( &uuid ),
- const_cast<GUID*>( &source.uuid ),
- &status );
+ BOOL result = ::UuidEqual(
+ const_cast<GUID*>( &uuid ),
+ const_cast<GUID*>( &source.uuid ),
+ &status );
- return ( result == TRUE ) ? true : false;
- #endif
+ return ( result == TRUE ) ? true : false;
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator==(const std::string& source) const
+bool Guid::operator==( const std::string& source ) const
{
- return *this == Guid(source);
+ return *this == Guid(source);
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator!=(const Guid& source) const
+bool Guid::operator!=( const Guid& source ) const
{
- return !(*this == source);
+ return !(*this == source);
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator!=(const std::string& source) const
+bool Guid::operator!=( const std::string& source ) const
{
- return !(*this == source);
+ return !( *this == source );
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator<(const Guid& source) const
+bool Guid::operator<( const Guid& source ) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // uuid_compare returns 0 for equal
- return uuid_compare(
- *(const_cast<uuid_t*>(&uuid)),
- *(const_cast<uuid_t*>(&source.uuid))) < 0 ? true : false;
- #else
- RPC_STATUS status;
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // uuid_compare returns 0 for equal
+ return uuid_compare(
+ *(const_cast<uuid_t*>(&uuid)),
+ *(const_cast<uuid_t*>(&source.uuid))) < 0 ? true : false;
+ #else
+ RPC_STATUS status;
- int result = ::UuidCompare(
- const_cast<GUID*>( &uuid ),
- const_cast<GUID*>( &source.uuid ),
- &status );
+ int result = ::UuidCompare(
+ const_cast<GUID*>( &uuid ),
+ const_cast<GUID*>( &source.uuid ),
+ &status );
- return ( result < 0 ) ? true : false;
- #endif
+ return ( result < 0 ) ? true : false;
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator<(const std::string& source) const
+bool Guid::operator<( const std::string& source ) const
{
- return *this < Guid(source);
+ return *this < Guid(source);
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator<=(const Guid& source) const
+bool Guid::operator<=( const Guid& source ) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // uuid_compare returns 0 for equal
- return uuid_compare(
- *(const_cast<uuid_t*>(&uuid)),
- *(const_cast<uuid_t*>(&source.uuid))) <= 0 ? true : false;
- #else
- RPC_STATUS status;
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // uuid_compare returns 0 for equal
+ return uuid_compare(
+ *(const_cast<uuid_t*>(&uuid)),
+ *(const_cast<uuid_t*>(&source.uuid))) <= 0 ? true : false;
+ #else
+ RPC_STATUS status;
- int result = ::UuidCompare(
- const_cast<GUID*>( &uuid ),
- const_cast<GUID*>( &source.uuid ),
- &status );
+ int result = ::UuidCompare(
+ const_cast<GUID*>( &uuid ),
+ const_cast<GUID*>( &source.uuid ),
+ &status );
- return ( result <= 0 ) ? true : false;
- #endif
+ return ( result <= 0 ) ? true : false;
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator<=(const std::string& source) const
+bool Guid::operator<=( const std::string& source ) const
{
- return *this <= Guid(source);
+ return *this <= Guid(source);
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator>(const Guid& source) const
+bool Guid::operator>( const Guid& source ) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // uuid_compare returns 0 for equal
- return uuid_compare(
- *(const_cast<uuid_t*>(&uuid)),
- *(const_cast<uuid_t*>(&source.uuid))) > 0 ? true : false;
- #else
- RPC_STATUS status;
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // uuid_compare returns 0 for equal
+ return uuid_compare(
+ *(const_cast<uuid_t*>(&uuid)),
+ *(const_cast<uuid_t*>(&source.uuid))) > 0 ? true : false;
+ #else
+ RPC_STATUS status;
- int result = ::UuidCompare(
- const_cast<GUID*>( &uuid ),
- const_cast<GUID*>( &source.uuid ),
- &status );
+ int result = ::UuidCompare(
+ const_cast<GUID*>( &uuid ),
+ const_cast<GUID*>( &source.uuid ),
+ &status );
- return ( result > 0 ) ? true : false;
- #endif
+ return ( result > 0 ) ? true : false;
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator>(const std::string& source) const
+bool Guid::operator>( const std::string& source ) const
{
- return *this > Guid(source);
+ return *this > Guid(source);
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator>=(const Guid& source) const
+bool Guid::operator>=( const Guid& source ) const
{
- #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- // uuid_compare returns 0 for equal
- return uuid_compare(
- *(const_cast<uuid_t*>(&uuid)),
- *(const_cast<uuid_t*>(&source.uuid))) >= 0 ? true : false;
- #else
- RPC_STATUS status;
+ #if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+ // uuid_compare returns 0 for equal
+ return uuid_compare(
+ *(const_cast<uuid_t*>(&uuid)),
+ *(const_cast<uuid_t*>(&source.uuid))) >= 0 ? true : false;
+ #else
+ RPC_STATUS status;
- int result = ::UuidCompare(
- const_cast<GUID*>(&uuid),
- const_cast<GUID*>(&source.uuid),
- &status);
+ int result = ::UuidCompare(
+ const_cast<GUID*>(&uuid),
+ const_cast<GUID*>(&source.uuid),
+ &status);
- return (result >= 0) ? true : false;
- #endif
+ return (result >= 0) ? true : false;
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator>=(const std::string& source) const
+bool Guid::operator>=( const std::string& source ) const
{
- return *this >= Guid(source);
+ return *this >= Guid(source);
}
////////////////////////////////////////////////////////////////////////////////
std::string Guid::createGUIDString(void)
{
- return Guid().createGUID().toString();
+ return Guid().createGUID().toString();
}
////////////////////////////////////////////////////////////////////////////////
const unsigned char* createGUIDBytes(void)
{
- return Guid().createGUID().toBytes();
+ return Guid().createGUID().toBytes();
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.h Fri Jul 21 04:36:09 2006
@@ -18,12 +18,12 @@
#define ACTIVEMQ_UTIL_GUID_H
#if defined( unix ) || defined(__APPLE__) && !defined( __CYGWIN__ )
- #include <uuid/uuid.h>
+ #include <uuid/uuid.h>
#elif defined(_WIN32) || defined( __CYGWIN__ )
- #include <objbase.h>
- #include <rpcdce.h>
+ #include <objbase.h>
+ #include <rpcdce.h>
#else // defined MACOSX
- #include "uuid.h"
+ #include "uuid.h"
#endif
#include <activemq/exceptions/RuntimeException.h>
@@ -34,165 +34,150 @@
namespace activemq{
namespace util{
- class Guid
- {
- public:
-
- /**
- * Constructor
- */
- Guid(void);
-
- /**
- * Copy Constructor
- */
- Guid(const Guid& source);
-
- /**
- * Constructor - Create a GUID from a String
- */
- Guid(const std::string& source)
- throw ( exceptions::IllegalArgumentException );
-
- /**
- * Destructor
- */
- virtual ~Guid(void);
-
- /**
- * Determines if this GUID is null, if so it can be initialized with a
- * call to <code>createGUID</code>.
- * @return true for Null GUID, false otherwise.
- */
- bool isNull(void) const;
-
- /**
- * Clears the GUID's current value and sets it to a NULL GUID value
- * will now pass <code>isNull</code>.
- */
- void setNull(void);
-
- /**
- * Generate a new GUID which will overwrite any current GUID value
- * @return Reference to this object that now has a new GUID
- */
- Guid& createGUID(void) throw( exceptions::RuntimeException );
-
- /**
- * Converts the GUID to a string and returns that string
- * @return a string with this GUID's stringified value
- */
- std::string toString(void) const throw( exceptions::RuntimeException );
-
- /**
- * Converts the GUID to a byte array and return a pointer to the
- * new array, called takes ownership and must delete this array
- * when done.
- * @return a byte array with the GUID byte value, size = 16
- */
- const unsigned char* toBytes(void) const;
-
- /**
- * Initializes this GUID with the GUID specified in the bytes parameter
- * @return reference to this object.
- */
- Guid& fromBytes(const unsigned char* bytes)
- throw ( exceptions::IllegalArgumentException );
-
- /**
- * Returns the Size in Bytes of the Raw bytes representation of the
- * GUID.
- * @return size of the Raw bytes representation
- */
- int getRawBytesSize(void) const;
-
- /**
- * string type cast operator
- * @returns string representation of this GUID
- */
- operator std::string() const;
-
- /**
- * byte array cast operator, caller does not own this memeory
- * @returns byte array with the GUID byte value representation
- */
- operator const unsigned char*() const;
-
- /**
- * Assignment operators
- * @return Reference to this GUID object
- */
- Guid& operator=(const Guid& source)
- throw ( exceptions::IllegalArgumentException );
- Guid& operator=(const std::string& source)
- throw ( exceptions::IllegalArgumentException );
-
- /**
- * Equality Comparison Operators
- * @return true for equal. false otherwise
- */
- bool operator==(const Guid& source) const;
- bool operator==(const std::string& source) const;
-
- /**
- * Inequality Comparison Operators
- * @return true for equal. false otherwise
- */
- bool operator!=(const Guid& source) const;
- bool operator!=(const std::string& source) const;
-
- /**
- * Less than operators
- * @return true for equal. false otherwise
- */
- bool operator<(const Guid& source) const;
- bool operator<(const std::string& source) const;
-
- /**
- * Less than or equal to operators
- * @return true for equal. false otherwise
- */
- bool operator<=(const Guid& source) const;
- bool operator<=(const std::string& source) const;
-
- /**
- * Greater than operators
- * @return true for equal. false otherwise
- */
- bool operator>(const Guid& source) const;
- bool operator>(const std::string& source) const;
-
- /**
- * Greater than or equal to operators
- * @return true for equal. false otherwise
- */
- bool operator>=(const Guid& source) const;
- bool operator>=(const std::string& source) const;
+ class Guid
+ {
+ public:
+
+ Guid(void);
+ Guid(const Guid& source);
+ Guid(const std::string& source)
+ throw ( exceptions::IllegalArgumentException );
+ virtual ~Guid(void);
+
+ /**
+ * Determines if this GUID is null, if so it can be initialized with a
+ * call to <code>createGUID</code>.
+ * @return true for Null GUID, false otherwise.
+ */
+ bool isNull(void) const;
+
+ /**
+ * Clears the GUID's current value and sets it to a NULL GUID value
+ * will now pass <code>isNull</code>.
+ */
+ void setNull(void);
+
+ /**
+ * Generate a new GUID which will overwrite any current GUID value
+ * @return Reference to this object that now has a new GUID
+ */
+ Guid& createGUID(void) throw( exceptions::RuntimeException );
+
+ /**
+ * Converts the GUID to a string and returns that string
+ * @return a string with this GUID's stringified value
+ */
+ std::string toString(void) const throw( exceptions::RuntimeException );
+
+ /**
+ * Converts the GUID to a byte array and return a pointer to the
+ * new array, called takes ownership and must delete this array
+ * when done.
+ * @return a byte array with the GUID byte value, size = 16
+ */
+ const unsigned char* toBytes(void) const;
+
+ /**
+ * Initializes this GUID with the GUID specified in the bytes parameter
+ * @return reference to this object.
+ */
+ Guid& fromBytes( const unsigned char* bytes )
+ throw ( exceptions::IllegalArgumentException );
+
+ /**
+ * Returns the Size in Bytes of the Raw bytes representation of the
+ * GUID.
+ * @return size of the Raw bytes representation
+ */
+ int getRawBytesSize(void) const;
+
+ /**
+ * string type cast operator
+ * @returns string representation of this GUID
+ */
+ operator std::string() const;
+
+ /**
+ * byte array cast operator, caller does not own this memeory
+ * @returns byte array with the GUID byte value representation
+ */
+ operator const unsigned char*() const;
+
+ /**
+ * Assignment operators
+ * @return Reference to this GUID object
+ */
+ Guid& operator=( const Guid& source )
+ throw ( exceptions::IllegalArgumentException );
+ Guid& operator=( const std::string& source )
+ throw ( exceptions::IllegalArgumentException );
+
+ /**
+ * Equality Comparison Operators
+ * @return true for equal. false otherwise
+ */
+ bool operator==( const Guid& source ) const;
+ bool operator==( const std::string& source ) const;
+
+ /**
+ * Inequality Comparison Operators
+ * @return true for equal. false otherwise
+ */
+ bool operator!=( const Guid& source ) const;
+ bool operator!=( const std::string& source ) const;
+
+ /**
+ * Less than operators
+ * @return true for equal. false otherwise
+ */
+ bool operator<(const Guid& source) const;
+ bool operator<(const std::string& source) const;
+
+ /**
+ * Less than or equal to operators
+ * @return true for equal. false otherwise
+ */
+ bool operator<=( const Guid& source ) const;
+ bool operator<=( const std::string& source ) const;
+
+ /**
+ * Greater than operators
+ * @return true for equal. false otherwise
+ */
+ bool operator>( const Guid& source ) const;
+ bool operator>( const std::string& source ) const;
+
+ /**
+ * Greater than or equal to operators
+ * @return true for equal. false otherwise
+ */
+ bool operator>=( const Guid& source ) const;
+ bool operator>=( const std::string& source ) const;
- public:
+ public:
- /**
- * Static Guid Creation Method, creates a GUID and returns it as a string
- * @return Guid string.
- */
- static std::string createGUIDString(void);
-
- /**
- * Static Guid Create Method, create a GUID and returns the byte representation
- * of the new GUID.
- * @return Guid bytes array, size is 16
- */
- static const unsigned char* createGUIDBytes(void);
+ /**
+ * Static Guid Creation Method, creates a GUID and returns it as a string
+ * @return Guid string.
+ */
+ static std::string createGUIDString(void);
+
+ /**
+ * Static Guid Create Method, create a GUID and returns the byte representation
+ * of the new GUID.
+ * @return Guid bytes array, size is 16
+ */
+ static const unsigned char* createGUIDBytes(void);
- private:
-
- // the uuid that this object represents.
- #if defined( unix ) || defined(__APPLE__)
- uuid_t uuid;
- #else
- ::GUID uuid;
- #endif
-
+ private:
+
+ // the uuid that this object represents.
+ #if defined( unix ) || defined(__APPLE__)
+ uuid_t uuid;
+ #else
+ ::GUID uuid;
+ #endif
+
};
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Integer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Integer.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Integer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Integer.h Fri Jul 21 04:36:09 2006
@@ -27,15 +27,15 @@
{
public:
- Integer(void) {}
- virtual ~Integer(void) {}
+ Integer(void) {}
+ virtual ~Integer(void) {}
/**
* Parses the String passed and extracts an int.
* @param String to parse
* @return int value
*/
- static int parseInt(const std::string& value){
+ static int parseInt( const std::string& value ){
int ret = 0;
std::istringstream istream(value);
istream.clear();
@@ -48,7 +48,7 @@
* @param int to convert
* @return string representation
*/
- static std::string toString(int value){
+ static std::string toString( int value ){
std::ostringstream ostream;
ostream << value;
return ostream.str();
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Long.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Long.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Long.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Long.h Fri Jul 21 04:36:09 2006
@@ -27,15 +27,15 @@
{
public:
- Long(void) {}
- virtual ~Long(void) {}
+ Long(void) {}
+ virtual ~Long(void) {}
/**
* Parses the String passed and extracts an long.
* @param String to parse
* @return long value
*/
- static long parseLong(const std::string& value){
+ static long parseLong( const std::string& value ){
long ret = 0;
std::istringstream istream(value);
istream.clear();
@@ -48,7 +48,7 @@
* @param long to convert
* @return string representation
*/
- static std::string toString(long value){
+ static std::string toString( long value ){
std::ostringstream ostream;
ostream << value;
return ostream.str();
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h Fri Jul 21 04:36:09 2006
@@ -34,7 +34,7 @@
{
public:
- virtual ~Number(void) {}
+ virtual ~Number(void) {}
};
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h Fri Jul 21 04:36:09 2006
@@ -24,73 +24,82 @@
namespace activemq{
namespace util{
- /**
- * Interface for a Java-like properties object. This is essentially
- * a map of key-value string pairs.
- */
- class Properties{
- public:
+ /**
+ * Interface for a Java-like properties object. This is essentially
+ * a map of key-value string pairs.
+ */
+ class Properties{
+ public:
- virtual ~Properties(){}
-
- /**
- * Looks up the value for the given property.
- * @param name The name of the property to be looked up.
- * @return the value of the property with the given name, if it
- * exists. If it does not exist, returns NULL.
- */
- virtual const char* getProperty( const std::string& name ) const = 0;
-
- /**
- * Looks up the value for the given property.
- * @param name the name of the property to be looked up.
- * @param defaultValue The value to be returned if the given
- * property does not exist.
- * @return The value of the property specified by <code>name</code>, if it
- * exists, otherwise the <code>defaultValue</code>.
- */
- virtual std::string getProperty( const std::string& name,
- const std::string& defaultValue ) const = 0;
-
- /**
- * Sets the value for a given property. If the property already
- * exists, overwrites the value.
- * @param name The name of the value to be written.
- * @param value The value to be written.
- */
- virtual void setProperty( const std::string& name,
- const std::string& value ) = 0;
-
- /**
- * Check to see if the Property exists in the set
- * @return true if property exists, false otherwise.
- */
- virtual bool hasProperty( const std::string& name ) const = 0;
+ virtual ~Properties(){}
+
+ /**
+ * Returns true if the properties object is empty
+ * @return true if empty
+ */
+ virtual bool isEmpty() const = 0;
+
+ /**
+ * Looks up the value for the given property.
+ * @param name The name of the property to be looked up.
+ * @return the value of the property with the given name, if it
+ * exists. If it does not exist, returns NULL.
+ */
+ virtual const char* getProperty( const std::string& name ) const = 0;
+
+ /**
+ * Looks up the value for the given property.
+ * @param name the name of the property to be looked up.
+ * @param defaultValue The value to be returned if the given
+ * property does not exist.
+ * @return The value of the property specified by <code>name</code>, if it
+ * exists, otherwise the <code>defaultValue</code>.
+ */
+ virtual std::string getProperty(
+ const std::string& name,
+ const std::string& defaultValue ) const = 0;
+
+ /**
+ * Sets the value for a given property. If the property already
+ * exists, overwrites the value.
+ * @param name The name of the value to be written.
+ * @param value The value to be written.
+ */
+ virtual void setProperty(
+ const std::string& name,
+ const std::string& value ) = 0;
+
+ /**
+ * Check to see if the Property exists in the set
+ * @return true if property exists, false otherwise.
+ */
+ virtual bool hasProperty( const std::string& name ) const = 0;
+
+ /**
+ * Method that serializes the contents of the property map to
+ * an arryay.
+ * @return list of pairs where the first is the name and the second
+ * is the value.
+ */
+ virtual std::vector< std::pair< std::string, std::string > > toArray() const = 0;
+
+ /**
+ * Copies the contents of the given properties object to this one.
+ * @param source The source properties object.
+ */
+ virtual void copy( const Properties* source ) = 0;
+
+ /**
+ * Clones this object.
+ * @returns a replica of this object.
+ */
+ virtual Properties* clone() const = 0;
+
+ /**
+ * Clears all properties from the map.
+ */
+ virtual void clear() = 0;
- /**
- * Method that serializes the contents of the property map to
- * an arryay.
- * @return list of pairs where the first is the name and the second
- * is the value.
- */
- virtual std::vector< std::pair<std::string, std::string> > toArray() const = 0;
-
- /**
- * Copies the contents of the given properties object to this one.
- * @param source The source properties object.
- */
- virtual void copy( const Properties* source ) = 0;
-
- /**
- * Clones this object.
- * @returns a replica of this object.
- */
- virtual Properties* clone() const = 0;
-
- /**
- * Clears all properties from the map.
- */
- virtual void clear() = 0;
};
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Queue.h Fri Jul 21 04:36:09 2006
@@ -24,284 +24,277 @@
namespace activemq{
namespace util{
- /**
- * The Queue class accepts messages with an psuh(m) command
- * where m is the message to be queued. It destructively
- * returns the message with pop(). pop() returns messages in
- * the order they were enqueued.
- *
- * Queue is implemented with an instance of the STL queue object.
- * The interface is essentially the same as that of the STL queue
- * except that the pop method actually reaturns a reference to the
- * element popped. This frees the app from having to call the
- * <code>front</code> method before calling pop.
- *
- * Queue<string> sq; // make a queue to hold string messages
- * sq.push(s); // enqueues a message m
- * string s = sq.pop(); // dequeues a message
- *
- * = DESIGN CONSIDERATIONS
- *
- * The Queue class inherits from the Synchronizable interface and
- * provides methods for locking and unlocking this queue as well as
- * waiting on this queue. In a multi-threaded app this can allow
- * for multiple threads to be reading from and writing to the same
- * Queue.
- *
- * Clients should consider that in a multiple threaded app it is
- * possible that items could be placed on the queue faster than
- * you are taking them off, so protection should be placed in your
- * polling loop to ensure that you don't get stuck there.
- */
-
- template <typename T> class Queue : public concurrent::Synchronizable
- {
- public:
-
- /**
- * Constructor
- */
- Queue(void);
-
- /**
- * Destructor
- */
- virtual ~Queue(void);
-
- /**
- * Returns a Reference to the element at the head of the queue
- * @return reference to a queue type object or (safe)
- */
- T& front(void);
-
- /**
- * Returns a Reference to the element at the head of the queue
- * @return reference to a queue type object or (safe)
- */
- const T& front(void) const;
-
- /**
- * Returns a Reference to the element at the tail of the queue
- * @return reference to a queue type object or (safe)
- */
- T& back(void);
-
- /**
- * Returns a Reference to the element at the tail of the queue
- * @return reference to a queue type object or (safe)
- */
- const T& back(void) const;
-
- /**
- * Places a new Object at the Tail of the queue
- * @param Queue Object Type reference.
- */
- void push(const T &t);
-
- /**
- * Removes and returns the element that is at the Head of the queue
- * @return reference to a queue type object or (safe)
- */
- T pop(void);
-
- /**
- * Gets the Number of elements currently in the Queue
- * @return Queue Size
- */
- size_t size(void) const;
-
- /**
- * Checks if this Queue is currently empty
- * @return boolean indicating queue emptiness
- */
- bool empty(void) const;
-
- /**
- * Locks the object.
- */
- virtual void lock() throw(exceptions::ActiveMQException){
- mutex.lock();
- }
-
- /**
- * Unlocks the object.
- */
- virtual void unlock() throw(exceptions::ActiveMQException){
- mutex.unlock();
- }
+ /**
+ * The Queue class accepts messages with an psuh(m) command
+ * where m is the message to be queued. It destructively
+ * returns the message with pop(). pop() returns messages in
+ * the order they were enqueued.
+ *
+ * Queue is implemented with an instance of the STL queue object.
+ * The interface is essentially the same as that of the STL queue
+ * except that the pop method actually reaturns a reference to the
+ * element popped. This frees the app from having to call the
+ * <code>front</code> method before calling pop.
+ *
+ * Queue<string> sq; // make a queue to hold string messages
+ * sq.push(s); // enqueues a message m
+ * string s = sq.pop(); // dequeues a message
+ *
+ * = DESIGN CONSIDERATIONS
+ *
+ * The Queue class inherits from the Synchronizable interface and
+ * provides methods for locking and unlocking this queue as well as
+ * waiting on this queue. In a multi-threaded app this can allow
+ * for multiple threads to be reading from and writing to the same
+ * Queue.
+ *
+ * Clients should consider that in a multiple threaded app it is
+ * possible that items could be placed on the queue faster than
+ * you are taking them off, so protection should be placed in your
+ * polling loop to ensure that you don't get stuck there.
+ */
+
+ template <typename T> class Queue : public concurrent::Synchronizable
+ {
+ public:
+
+ Queue(void);
+ virtual ~Queue(void);
+
+ /**
+ * Returns a Reference to the element at the head of the queue
+ * @return reference to a queue type object or (safe)
+ */
+ T& front(void);
+
+ /**
+ * Returns a Reference to the element at the head of the queue
+ * @return reference to a queue type object or (safe)
+ */
+ const T& front(void) const;
+
+ /**
+ * Returns a Reference to the element at the tail of the queue
+ * @return reference to a queue type object or (safe)
+ */
+ T& back(void);
+
+ /**
+ * Returns a Reference to the element at the tail of the queue
+ * @return reference to a queue type object or (safe)
+ */
+ const T& back(void) const;
+
+ /**
+ * Places a new Object at the Tail of the queue
+ * @param Queue Object Type reference.
+ */
+ void push( const T &t );
+
+ /**
+ * Removes and returns the element that is at the Head of the queue
+ * @return reference to a queue type object or (safe)
+ */
+ T pop(void);
+
+ /**
+ * Gets the Number of elements currently in the Queue
+ * @return Queue Size
+ */
+ size_t size(void) const;
+
+ /**
+ * Checks if this Queue is currently empty
+ * @return boolean indicating queue emptiness
+ */
+ bool empty(void) const;
+
+ /**
+ * Locks the object.
+ */
+ virtual void lock() throw( exceptions::ActiveMQException ){
+ mutex.lock();
+ }
+
+ /**
+ * Unlocks the object.
+ */
+ virtual void unlock() throw( exceptions::ActiveMQException ){
+ mutex.unlock();
+ }
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- */
- virtual void wait() throw(exceptions::ActiveMQException){
- mutex.wait();
- }
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling.
+ */
+ virtual void wait() throw( exceptions::ActiveMQException ){
+ mutex.wait();
+ }
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait(unsigned long millisecs)
- throw(exceptions::ActiveMQException) {
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling. This wait will timeout after the specified time
+ * interval.
+ * @param time in millisecsonds to wait, or WAIT_INIFINITE
+ * @throws ActiveMQException
+ */
+ virtual void wait( unsigned long millisecs )
+ throw( exceptions::ActiveMQException ) {
- mutex.wait(millisecs);
- }
+ mutex.wait(millisecs);
+ }
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notify() throw(exceptions::ActiveMQException){
- mutex.notify();
- }
+ /**
+ * Signals a waiter on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notify() throw( exceptions::ActiveMQException ){
+ mutex.notify();
+ }
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw(exceptions::ActiveMQException){
- mutex.notifyAll();
- }
-
- public: // Statics
-
- /**
- * Fetch a reference to the safe value this object will return
- * when there is nothing to fetch from the queue.
- * @return Reference to this Queues safe object
- */
- static const T& getSafeValue(void) { return safe; }
-
- private:
-
- // The real queue
- std::queue<T> queue;
-
- // Object used for sync
- concurrent::Mutex mutex;
-
- // Safe value used when pop, front or back are
- // called and the queue is empty.
- static T safe;
+ /**
+ * Signals the waiters on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notifyAll() throw( exceptions::ActiveMQException ){
+ mutex.notifyAll();
+ }
+
+ public: // Statics
+
+ /**
+ * Fetch a reference to the safe value this object will return
+ * when there is nothing to fetch from the queue.
+ * @return Reference to this Queues safe object
+ */
+ static const T& getSafeValue(void) { return safe; }
+
+ private:
+
+ // The real queue
+ std::queue<T> queue;
+
+ // Object used for sync
+ concurrent::Mutex mutex;
+
+ // Safe value used when pop, front or back are
+ // called and the queue is empty.
+ static T safe;
- };
+ };
- //-----{ Static Init }-----------------------------------------------------//
- template <typename T>
- T Queue<T>::safe;
-
- //-----{ Retrieve current length of Queue }--------------------------------//
-
- template <typename T> inline size_t Queue<T>::size() const
- {
- return queue.size();
- }
-
- //-----{ Retrieve whether Queue is empty or not }--------------------------//
-
- template <typename T> inline bool Queue<T>::empty(void) const
- {
- return queue.empty();
- }
-
- //-----{ Defulat Constructor }---------------------------------------------//
-
- template <typename T>
- Queue<T>::Queue()
- {
- }
-
- //-----{ Default Destructor }----------------------------------------------//
-
- template <typename T> Queue<T>::~Queue()
- {
- }
-
- //-----{ Add Elements to Back of Queue }-----------------------------------//
-
- template <typename T>
- void Queue<T>::push(const T &t)
- {
- queue.push(t);
- }
-
- //-----{ Remove Elements from Front of Queue }-----------------------------//
-
- template <typename T>
- T Queue<T>::pop(void)
- {
- if(queue.empty())
- {
- return safe;
- }
-
- // Pop the element into a temp, since we need to remain locked.
- // this means getting front and then popping.
- T temp = queue.front();
- queue.pop();
-
- return temp;
- }
-
- //-----{ Returnreference to element at front of Queue }--------------------//
-
- template <typename T>
- T& Queue<T>::front(void)
- {
- if(queue.empty())
- {
- return safe;
- }
+ //-----{ Static Init }----------------------------------------------------//
+ template <typename T>
+ T Queue<T>::safe;
+
+ //-----{ Retrieve current length of Queue }-------------------------------//
+
+ template <typename T> inline size_t Queue<T>::size() const
+ {
+ return queue.size();
+ }
+
+ //-----{ Retrieve whether Queue is empty or not }-------------------------//
+
+ template <typename T> inline bool Queue<T>::empty(void) const
+ {
+ return queue.empty();
+ }
+
+ //-----{ Defulat Constructor }--------------------------------------------//
+
+ template <typename T>
+ Queue<T>::Queue()
+ {
+ }
+
+ //-----{ Default Destructor }---------------------------------------------//
+
+ template <typename T> Queue<T>::~Queue()
+ {
+ }
+
+ //-----{ Add Elements to Back of Queue }----------------------------------//
+
+ template <typename T>
+ void Queue<T>::push( const T &t )
+ {
+ queue.push( t );
+ }
+
+ //-----{ Remove Elements from Front of Queue }----------------------------//
+
+ template <typename T>
+ T Queue<T>::pop(void)
+ {
+ if(queue.empty())
+ {
+ return safe;
+ }
+
+ // Pop the element into a temp, since we need to remain locked.
+ // this means getting front and then popping.
+ T temp = queue.front();
+ queue.pop();
+
+ return temp;
+ }
+
+ //-----{ Returnreference to element at front of Queue }-------------------//
+
+ template <typename T>
+ T& Queue<T>::front(void)
+ {
+ if( queue.empty() )
+ {
+ return safe;
+ }
- return queue.front();
- }
+ return queue.front();
+ }
- //-----{ Returnreference to element at front of Queue }--------------------//
+ //-----{ Returnreference to element at front of Queue }-------------------//
- template <typename T>
- const T& Queue<T>::front(void) const
- {
- if(queue.empty())
- {
- return safe;
- }
-
- return queue.front();
- }
-
- //-----{ Returnreference to element at back of Queue }---------------------//
-
- template <typename T>
- T& Queue<T>::back(void)
- {
- if(queue.empty())
- {
- return safe;
- }
+ template <typename T>
+ const T& Queue<T>::front(void) const
+ {
+ if( queue.empty() )
+ {
+ return safe;
+ }
+
+ return queue.front();
+ }
+
+ //-----{ Returnreference to element at back of Queue }--------------------//
+
+ template <typename T>
+ T& Queue<T>::back(void)
+ {
+ if( queue.empty() )
+ {
+ return safe;
+ }
- return queue.back();
- }
+ return queue.back();
+ }
- //-----{ Returnreference to element at back of Queue }---------------------//
+ //-----{ Returnreference to element at back of Queue }--------------------//
- template <typename T>
- const T& Queue<T>::back(void) const
- {
- if(queue.empty())
- {
- return safe;
- }
+ template <typename T>
+ const T& Queue<T>::back(void) const
+ {
+ if( queue.empty() )
+ {
+ return safe;
+ }
- return queue.back();
- }
+ return queue.back();
+ }
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/SimpleProperties.h Fri Jul 21 04:36:09 2006
@@ -23,67 +23,75 @@
namespace activemq{
namespace util{
-
- /**
- * Basic implementation of the Properties interface.
- */
- class SimpleProperties : public Properties{
- private:
-
- std::map< std::string, std::string > properties;
-
- public:
-
- virtual ~SimpleProperties(){}
-
- /**
- * Looks up the value for the given property.
- * @param name The name of the property to be looked up.
- * @return the value of the property with the given name, if it
- * exists. If it does not exist, returns NULL.
- */
- virtual const char* getProperty( const std::string& name ) const{
-
- std::map< std::string, std::string >::const_iterator iter =
+
+ /**
+ * Basic implementation of the Properties interface.
+ */
+ class SimpleProperties : public Properties{
+ private:
+
+ std::map< std::string, std::string > properties;
+
+ public:
+
+ virtual ~SimpleProperties(){}
+
+ /**
+ * Returns true if the properties object is empty
+ * @return true if empty
+ */
+ virtual bool isEmpty() const {
+ return properties.empty();
+ }
+
+ /**
+ * Looks up the value for the given property.
+ * @param name The name of the property to be looked up.
+ * @return the value of the property with the given name, if it
+ * exists. If it does not exist, returns NULL.
+ */
+ virtual const char* getProperty( const std::string& name ) const{
+
+ std::map< std::string, std::string >::const_iterator iter =
properties.find( name );
- if( iter == properties.end() ){
- return NULL;
- }
-
- return iter->second.c_str();
- }
-
- /**
- * Looks up the value for the given property.
- * @param name the name of the property to be looked up.
- * @param defaultValue The value to be returned if the given
- * property does not exist.
- * @return The value of the property specified by <code>name</code>, if it
- * exists, otherwise the <code>defaultValue</code>.
- */
- virtual std::string getProperty( const std::string& name,
- const std::string& defaultValue ) const {
-
- std::map< std::string, std::string >::const_iterator iter =
+ if( iter == properties.end() ){
+ return NULL;
+ }
+
+ return iter->second.c_str();
+ }
+
+ /**
+ * Looks up the value for the given property.
+ * @param name the name of the property to be looked up.
+ * @param defaultValue The value to be returned if the given
+ * property does not exist.
+ * @return The value of the property specified by <code>name</code>, if it
+ * exists, otherwise the <code>defaultValue</code>.
+ */
+ virtual std::string getProperty( const std::string& name,
+ const std::string& defaultValue ) const {
+
+ std::map< std::string, std::string >::const_iterator iter =
properties.find( name );
- if( iter == properties.end() ){
- return defaultValue;
- }
-
- return iter->second;
- }
-
- /**
- * Sets the value for a given property. If the property already
- * exists, overwrites the value.
- * @param name The name of the value to be written.
- * @param value The value to be written.
- */
- virtual void setProperty( const std::string& name,
- const std::string& value ){
- properties[name] = value;
- }
-
+ if( iter == properties.end() ){
+ return defaultValue;
+ }
+
+ return iter->second;
+ }
+
+ /**
+ * Sets the value for a given property. If the property already
+ * exists, overwrites the value.
+ * @param name The name of the value to be written.
+ * @param value The value to be written.
+ */
+ virtual void setProperty( const std::string& name,
+ const std::string& value ){
+ properties[name] = value;
+ }
+
/**
* Check to see if the Property exists in the set
* @return true if property exists, false otherwise.
@@ -98,64 +106,64 @@
return false;
}
- /**
- * Method that serializes the contents of the property map to
- * an arryay.
- * @return list of pairs where the first is the name and the second
- * is the value.
- */
- virtual std::vector< std::pair<std::string, std::string> > toArray() const{
-
- // Create a vector big enough to hold all the elements in the map.
- std::vector< std::pair<std::string, std::string> > vec( properties.size() );
-
- // Get an iterator at the beginning of the map.
- std::map< std::string, std::string >::const_iterator iter = properties.begin();
-
- // Copy all of the elements from the map to the vector.
- for( int ix=0; iter != properties.end(); ++iter, ++ix ){
- vec[ix] = *iter;
- }
-
- return vec;
- }
-
- /**
- * Copies the contents of the given properties object to this one.
- * @param source The source properties object.
- */
- virtual void copy( const Properties* source ){
-
- clear();
-
- std::vector< std::pair< std::string, std::string > > vec =
- source->toArray();
- for( unsigned int ix=0; ix<vec.size(); ++ix ){
- properties[vec[ix].first] = vec[ix].second;
- }
- }
-
- /**
- * Clones this object.
- * @returns a replica of this object.
- */
- virtual Properties* clone() const{
-
- SimpleProperties* props = new SimpleProperties();
-
+ /**
+ * Method that serializes the contents of the property map to
+ * an arryay.
+ * @return list of pairs where the first is the name and the second
+ * is the value.
+ */
+ virtual std::vector< std::pair< std::string, std::string > > toArray() const{
+
+ // Create a vector big enough to hold all the elements in the map.
+ std::vector< std::pair<std::string, std::string> > vec( properties.size() );
+
+ // Get an iterator at the beginning of the map.
+ std::map< std::string, std::string >::const_iterator iter = properties.begin();
+
+ // Copy all of the elements from the map to the vector.
+ for( int ix=0; iter != properties.end(); ++iter, ++ix ){
+ vec[ix] = *iter;
+ }
+
+ return vec;
+ }
+
+ /**
+ * Copies the contents of the given properties object to this one.
+ * @param source The source properties object.
+ */
+ virtual void copy( const Properties* source ){
+
+ clear();
+
+ std::vector< std::pair< std::string, std::string > > vec =
+ source->toArray();
+ for( unsigned int ix=0; ix<vec.size(); ++ix ){
+ properties[vec[ix].first] = vec[ix].second;
+ }
+ }
+
+ /**
+ * Clones this object.
+ * @returns a replica of this object.
+ */
+ virtual Properties* clone() const{
+
+ SimpleProperties* props = new SimpleProperties();
+
props->properties = properties;
-
- return props;
- }
-
- /**
- * Clears all properties from the map.
- */
- virtual void clear(){
- properties.clear();
- }
- };
-
+
+ return props;
+ }
+
+ /**
+ * Clears all properties from the map.
+ */
+ virtual void clear(){
+ properties.clear();
+ }
+ };
+
}}
#endif /*ACTIVEMQ_UTIL_SIMPLEPROPERTIES_H_*/
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.cpp Fri Jul 21 04:36:09 2006
@@ -22,17 +22,17 @@
using namespace activemq::exceptions;
////////////////////////////////////////////////////////////////////////////////
-StringTokenizer::StringTokenizer(const std::string& str,
- const std::string& delim,
- bool returnDelims)
-{
- // store off the data
- this->str = str;
- this->delim = delim;
- this->returnDelims = returnDelims;
+StringTokenizer::StringTokenizer( const std::string& str,
+ const std::string& delim,
+ bool returnDelims )
+{
+ // store off the data
+ this->str = str;
+ this->delim = delim;
+ this->returnDelims = returnDelims;
- // Start and the beginning
- pos = 0;
+ // Start and the beginning
+ pos = 0;
}
////////////////////////////////////////////////////////////////////////////////
@@ -43,31 +43,31 @@
////////////////////////////////////////////////////////////////////////////////
int StringTokenizer::countTokens(void) const
{
- int count = 0;
- string::size_type localPos = pos;
- string::size_type lastPos = pos;
-
- while(localPos != string::npos)
- {
- if(returnDelims && str.find_first_of(delim, localPos) == localPos)
- {
- count += 1;
- localPos += 1;
-
- continue;
- }
-
- // Find first token by spanning the fist non-delimiter, to the
- // next delimiter, skipping any delimiters that are at the curret
- // location.
- lastPos = str.find_first_not_of(delim, localPos);
- localPos = str.find_first_of(delim, lastPos);
-
- if(lastPos != string::npos)
- {
- count++;
- }
- }
+ int count = 0;
+ string::size_type localPos = pos;
+ string::size_type lastPos = pos;
+
+ while(localPos != string::npos)
+ {
+ if(returnDelims && str.find_first_of(delim, localPos) == localPos)
+ {
+ count += 1;
+ localPos += 1;
+
+ continue;
+ }
+
+ // Find first token by spanning the fist non-delimiter, to the
+ // next delimiter, skipping any delimiters that are at the curret
+ // location.
+ lastPos = str.find_first_not_of(delim, localPos);
+ localPos = str.find_first_of(delim, lastPos);
+
+ if(lastPos != string::npos)
+ {
+ count++;
+ }
+ }
return count;
}
@@ -75,60 +75,60 @@
////////////////////////////////////////////////////////////////////////////////
bool StringTokenizer::hasMoreTokens(void) const
{
- string::size_type nextpos =
- returnDelims ? str.find_first_of(delim, pos) :
- str.find_first_not_of(delim, pos);
+ string::size_type nextpos =
+ returnDelims ? str.find_first_of(delim, pos) :
+ str.find_first_not_of(delim, pos);
- return (nextpos != string::npos);
+ return (nextpos != string::npos);
}
////////////////////////////////////////////////////////////////////////////////
std::string StringTokenizer::nextToken(void)
throw ( exceptions::NoSuchElementException )
{
- if(pos == string::npos)
- {
- throw NoSuchElementException(
- __FILE__, __LINE__,
- "StringTokenizer::nextToken - No more Tokens available");
- }
-
- if(returnDelims)
- {
- // if char at current pos is a delim return it and advance pos
- if(str.find_first_of(delim, pos) == pos)
- {
- return str.substr(pos++, 1);
- }
- }
+ if(pos == string::npos)
+ {
+ throw NoSuchElementException(
+ __FILE__, __LINE__,
+ "StringTokenizer::nextToken - No more Tokens available");
+ }
- // Skip delimiters at beginning.
- string::size_type lastPos = str.find_first_not_of(delim, pos);
+ if(returnDelims)
+ {
+ // if char at current pos is a delim return it and advance pos
+ if(str.find_first_of(delim, pos) == pos)
+ {
+ return str.substr(pos++, 1);
+ }
+ }
+
+ // Skip delimiters at beginning.
+ string::size_type lastPos = str.find_first_not_of(delim, pos);
- // Find the next delimiter in the string, the charactors in between
- // will be the token to return. If this returns string::npos then
- // there are no more delimiters in the string.
- pos = str.find_first_of(delim, lastPos);
-
- if(string::npos != lastPos)
- {
- // Found a token, count it, if the pos of the next delim is npos
- // then we set length to copy to npos so that all the remianing
- // portion of the string is copied, otherwise we set it to the
- return str.substr(lastPos,
- pos == string::npos ? pos : pos-lastPos);
- }
- else
- {
- throw NoSuchElementException(
- __FILE__, __LINE__,
- "StringTokenizer::nextToken - No more Tokens available");
- }
+ // Find the next delimiter in the string, the charactors in between
+ // will be the token to return. If this returns string::npos then
+ // there are no more delimiters in the string.
+ pos = str.find_first_of(delim, lastPos);
+
+ if(string::npos != lastPos)
+ {
+ // Found a token, count it, if the pos of the next delim is npos
+ // then we set length to copy to npos so that all the remianing
+ // portion of the string is copied, otherwise we set it to the
+ return str.substr( lastPos,
+ pos == string::npos ? pos : pos-lastPos );
+ }
+ else
+ {
+ throw NoSuchElementException(
+ __FILE__, __LINE__,
+ "StringTokenizer::nextToken - No more Tokens available");
+ }
}
////////////////////////////////////////////////////////////////////////////////
-std::string StringTokenizer::nextToken(const std::string& delim)
- throw ( exceptions::NoSuchElementException )
+std::string StringTokenizer::nextToken( const std::string& delim )
+ throw ( exceptions::NoSuchElementException )
{
this->delim = delim;
@@ -136,13 +136,13 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned int StringTokenizer::toArray(std::vector<std::string>& array)
+unsigned int StringTokenizer::toArray( std::vector<std::string>& array )
{
int count = 0;
while(hasMoreTokens())
{
- array.push_back(nextToken());
+ array.push_back( nextToken() );
count++;
}
@@ -150,9 +150,9 @@
}
////////////////////////////////////////////////////////////////////////////////
-void StringTokenizer::reset(const std::string& str,
- const std::string& delim,
- bool returnDelims)
+void StringTokenizer::reset( const std::string& str,
+ const std::string& delim,
+ bool returnDelims )
{
if(str != "")
{
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/StringTokenizer.h Fri Jul 21 04:36:09 2006
@@ -23,116 +23,113 @@
namespace activemq{
namespace util{
- class StringTokenizer
- {
- private:
+ class StringTokenizer
+ {
+ private:
- // String to tokenize
- std::string str;
+ // String to tokenize
+ std::string str;
- // The delimiter string
- std::string delim;
+ // The delimiter string
+ std::string delim;
- // The current pos in the string
- std::string::size_type pos;
+ // The current pos in the string
+ std::string::size_type pos;
- // Are we returning delimiters
- bool returnDelims;
+ // Are we returning delimiters
+ bool returnDelims;
- public:
+ public:
- /**
- * Constructs a string tokenizer for the specified string. All
- * characters in the delim argument are the delimiters for separating
- * tokens.
- *
- * If the returnDelims flag is true, then the delimiter characters are
- * also returned as tokens. Each delimiter is returned as a string of
- * length one. If the flag is false, the delimiter characters are
- * skipped and only serve as separators between tokens.
- *
- * Note that if delim is "", this constructor does not throw an
- * exception. However, trying to invoke other methods on the resulting
- * StringTokenizer may result in an Exception.
- * @param string to tokenize
- * @param String containing the delimiters
- * @param boolean indicating if the delimiters are returned as tokens
- */
- StringTokenizer(const std::string& str,
- const std::string& delim = " \t\n\r\f",
- bool returnDelims = false);
+ /**
+ * Constructs a string tokenizer for the specified string. All
+ * characters in the delim argument are the delimiters for separating
+ * tokens.
+ *
+ * If the returnDelims flag is true, then the delimiter characters are
+ * also returned as tokens. Each delimiter is returned as a string of
+ * length one. If the flag is false, the delimiter characters are
+ * skipped and only serve as separators between tokens.
+ *
+ * Note that if delim is "", this constructor does not throw an
+ * exception. However, trying to invoke other methods on the resulting
+ * StringTokenizer may result in an Exception.
+ * @param string to tokenize
+ * @param String containing the delimiters
+ * @param boolean indicating if the delimiters are returned as tokens
+ */
+ StringTokenizer( const std::string& str,
+ const std::string& delim = " \t\n\r\f",
+ bool returnDelims = false);
- /**
- * Destructor
- */
- virtual ~StringTokenizer(void);
-
- /**
- * Calculates the number of times that this tokenizer's nextToken
- * method can be called before it generates an exception. The current
- * position is not advanced.
- * @return Count of remaining tokens
- */
- virtual int countTokens(void) const;
+ virtual ~StringTokenizer(void);
+
+ /**
+ * Calculates the number of times that this tokenizer's nextToken
+ * method can be called before it generates an exception. The current
+ * position is not advanced.
+ * @return Count of remaining tokens
+ */
+ virtual int countTokens(void) const;
- /**
- * Tests if there are more tokens available from this tokenizer's
- * string.
- * @return true if there are more tokens remaining
- */
- virtual bool hasMoreTokens(void) const;
-
- /**
- * Returns the next token from this string tokenizer.
- * @return string value of next token
- * @thorws NoSuchElementException
- */
- virtual std::string nextToken(void)
- throw ( exceptions::NoSuchElementException );
-
- /**
- * Returns the next token in this string tokenizer's string. First,
- * the set of characters considered to be delimiters by this
- * StringTokenizer object is changed to be the characters in the
- * string delim. Then the next token in the string after the current
- * position is returned. The current position is advanced beyond the
- * recognized token. The new delimiter set remains the default after
- * this call.
- * @param string containing the new set of delimiters
- * @return next string in the token list
- * @throw NoSuchElementException
- */
- virtual std::string nextToken(const std::string& delim)
- throw ( exceptions::NoSuchElementException );
+ /**
+ * Tests if there are more tokens available from this tokenizer's
+ * string.
+ * @return true if there are more tokens remaining
+ */
+ virtual bool hasMoreTokens(void) const;
+
+ /**
+ * Returns the next token from this string tokenizer.
+ * @return string value of next token
+ * @thorws NoSuchElementException
+ */
+ virtual std::string nextToken(void)
+ throw ( exceptions::NoSuchElementException );
+
+ /**
+ * Returns the next token in this string tokenizer's string. First,
+ * the set of characters considered to be delimiters by this
+ * StringTokenizer object is changed to be the characters in the
+ * string delim. Then the next token in the string after the current
+ * position is returned. The current position is advanced beyond the
+ * recognized token. The new delimiter set remains the default after
+ * this call.
+ * @param string containing the new set of delimiters
+ * @return next string in the token list
+ * @throw NoSuchElementException
+ */
+ virtual std::string nextToken(const std::string& delim)
+ throw ( exceptions::NoSuchElementException );
- /**
- * Grab all remaining tokens in the String and return them
- * in the vector that is passed in by reference.
- * @param vector to place token strings in
- * @return number of string placed into the vector
- */
- virtual unsigned int toArray(std::vector<std::string>& array);
+ /**
+ * Grab all remaining tokens in the String and return them
+ * in the vector that is passed in by reference.
+ * @param vector to place token strings in
+ * @return number of string placed into the vector
+ */
+ virtual unsigned int toArray( std::vector< std::string >& array );
- /**
- * Resets the Tokenizer's position in the String to the Beginning
- * calls to countToken and nextToken now start back at the beginning.
- * This allows this object to be reused, the caller need not create
- * a new instance every time a String needs tokenizing.
- * If set the string param will reset the string that this Tokenizer
- * is working on. If set to "" no change is made.
- * If set the delim param will reset the string that this Tokenizer
- * is using to tokenizer the string. If set to "", no change is made
- * If set the return Delims will set if this Tokenizer will return
- * delimiters as tokens. Defaults to false.
- * @param New String to tokenize or "", defaults to ""
- * @param New Delimiter String to use or "", defaults to ""
- * @param Should the Tokenizer return delimiters as Tokens, default false
- */
- virtual void reset(const std::string& str = "",
- const std::string& delim = "",
- bool returnDelims = false);
+ /**
+ * Resets the Tokenizer's position in the String to the Beginning
+ * calls to countToken and nextToken now start back at the beginning.
+ * This allows this object to be reused, the caller need not create
+ * a new instance every time a String needs tokenizing.
+ * If set the string param will reset the string that this Tokenizer
+ * is working on. If set to "" no change is made.
+ * If set the delim param will reset the string that this Tokenizer
+ * is using to tokenizer the string. If set to "", no change is made
+ * If set the return Delims will set if this Tokenizer will return
+ * delimiters as tokens. Defaults to false.
+ * @param New String to tokenize or "", defaults to ""
+ * @param New Delimiter String to use or "", defaults to ""
+ * @param Should the Tokenizer return delimiters as Tokens, default false
+ */
+ virtual void reset( const std::string& str = "",
+ const std::string& delim = "",
+ bool returnDelims = false);
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/BytesMessage.h Fri Jul 21 04:36:09 2006
@@ -26,9 +26,6 @@
public:
- /**
- * Destructor
- */
virtual ~BytesMessage(){}
/**
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/CMSException.h Fri Jul 21 04:36:09 2006
@@ -24,28 +24,27 @@
#include <iostream>
namespace cms{
-
- /**
- * This class represents an error that has occurred in
- * cms.
- */
- class CMSException{
-
- public:
-
- /**
- * Destruction
- */
- virtual ~CMSException(){}
-
- /**
+
+ /**
+ * This class represents an error that has occurred in
+ * cms.
+ */
+ class CMSException{
+
+ public:
+
+ virtual ~CMSException(){}
+
+ /**
* Gets the cause of the error.
- */
- virtual const char* getMessage() const = 0;
+ * @return string errors message
+ */
+ virtual const char* getMessage() const = 0;
/**
* Provides the stack trace for every point where
* this exception was caught, marked, and rethrown.
+ * @return vector containing stack trace strings
*/
virtual std::vector< std::pair< std::string, int> > getStackTrace() const = 0;
@@ -59,7 +58,8 @@
* @param stream the target output stream.
*/
virtual void printStackTrace( std::ostream& stream ) const = 0;
- };
+
+ };
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Closeable.h Fri Jul 21 04:36:09 2006
@@ -21,21 +21,24 @@
#include <cms/CMSException.h>
namespace cms{
-
- /**
- * Interface for a class that implements the close method.
- */
- class Closeable{
-
- public:
-
- virtual ~Closeable(void){}
-
- /**
- * Closes this object and deallocates the appropriate resources.
- */
- virtual void close() throw( CMSException ) = 0;
- };
+
+ /**
+ * Interface for a class that implements the close method.
+ */
+ class Closeable{
+
+ public:
+
+ virtual ~Closeable(void){}
+
+ /**
+ * Closes this object and deallocates the appropriate resources.
+ * The object is generally no longer usable after calling close.
+ * @throws CMSException
+ */
+ virtual void close() throw( CMSException ) = 0;
+
+ };
}
#endif /*CMS_CLOSEABLE_H*/
Modified: incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/cms/Connection.h Fri Jul 21 04:36:09 2006
@@ -34,41 +34,41 @@
{
public:
- /**
- * Destructor
- */
virtual ~Connection(void) {}
/**
* Creates a new Session to work for this Connection
+ * @throws CMSException
*/
virtual Session* createSession(void) throw ( CMSException ) = 0;
-
+
/**
* Creates a new Session to work for this Connection using the
* specified acknowledgment mode
* @param the Acknowledgement Mode to use.
+ * @throws CMSException
*/
- virtual Session* createSession(Session::AcknowledgeMode ackMode)
+ virtual Session* createSession( Session::AcknowledgeMode ackMode )
throw ( CMSException ) = 0;
-
+
/**
* Get the Client Id for this session
+ * @return Client Id String
*/
virtual std::string getClientId(void) const = 0;
-
+
/**
* Gets the registered Exception Listener for this connection
* @return pointer to an exception listnener or NULL
*/
virtual ExceptionListener* getExceptionListener(void) const = 0;
-
+
/**
* Sets the registed Exception Listener for this connection
* @param pointer to and <code>ExceptionListener</code>
*/
- virtual void setExceptionListener(ExceptionListener* listener) = 0;
-
+ virtual void setExceptionListener( ExceptionListener* listener ) = 0;
+
};
}