Author: tabish
Date: Fri Oct 22 22:10:46 2010
New Revision: 1026508
URL: http://svn.apache.org/viewvc?rev=1026508&view=rev
Log:
Provide some methods for determining the Destination types.
Modified:
activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.cpp
activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.h
Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.cpp?rev=1026508&r1=1026507&r2=1026508&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.cpp Fri
Oct 22 22:10:46 2010
@@ -89,3 +89,101 @@ cms_status destroyDestination(CMS_Destin
return result;
}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status compareDestinations(CMS_Destination* lhs, CMS_Destination* rhs,
int* areEqual) {
+
+ cms_status result = CMS_SUCCESS;
+
+ if(lhs != NULL && lhs->destination != NULL) {
+
+ try{
+
+ if(rhs != NULL && rhs->destination != NULL) {
+ *areEqual = (int) lhs->destination->equals(*rhs->destination);
+ } else {
+ *areEqual = 0;
+ }
+
+ } catch(...) {
+ result = CMS_ERROR;
+ }
+ } else {
+ *areEqual = 0;
+ }
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status isDestinationTopic(CMS_Destination* destination, int* isTopic) {
+
+ cms_status result = CMS_SUCCESS;
+
+ if(destination != NULL) {
+
+ try{
+
+ if(isTopic != NULL) {
+ cms::Destination::DestinationType type =
destination->destination->getDestinationType();
+ *isTopic = (type == cms::Destination::TOPIC || type ==
cms::Destination::TEMPORARY_TOPIC) ? 1 : 0;
+ } else {
+ *isTopic = 0;
+ }
+
+ } catch(...) {
+ result = CMS_ERROR;
+ }
+ }
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status isDestinationQueue(CMS_Destination* destination, int* isQueue) {
+
+ cms_status result = CMS_SUCCESS;
+
+ if(destination != NULL) {
+
+ try{
+
+ if(isQueue != NULL) {
+ cms::Destination::DestinationType type =
destination->destination->getDestinationType();
+ *isQueue = (type == cms::Destination::QUEUE || type ==
cms::Destination::TEMPORARY_QUEUE) ? 1 : 0;
+ } else {
+ *isQueue = 0;
+ }
+
+ } catch(...) {
+ result = CMS_ERROR;
+ }
+ }
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+cms_status isDestinationTemporary(CMS_Destination* destination, int*
isTemporary) {
+
+ cms_status result = CMS_SUCCESS;
+
+ if(destination != NULL) {
+
+ try{
+
+ if(isTemporary != NULL) {
+ cms::Destination::DestinationType type =
destination->destination->getDestinationType();
+ *isTemporary = (type == cms::Destination::TEMPORARY_TOPIC ||
+ type == cms::Destination::TEMPORARY_QUEUE) ? 1
: 0;
+ } else {
+ *isTemporary = 0;
+ }
+
+ } catch(...) {
+ result = CMS_ERROR;
+ }
+ }
+
+ return result;
+}
Modified: activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.h?rev=1026508&r1=1026507&r2=1026508&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-c/src/main/c/CMS_Destination.h Fri Oct
22 22:10:46 2010
@@ -52,6 +52,56 @@ cms_status createDestination(CMS_Session
*/
cms_status destroyDestination(CMS_Destination* destination);
+/**
+ * Compares to CMS Destination instances for equality.
+ *
+ * @param lhs
+ * The Destination on the left-hand side of the comparison.
+ * @param rhs
+ * The Destination on the right-hand side of the comparison.
+ * @param areEqual
+ * The address to write the boolean result of the comparison to.
+ *
+ * @return result code indicating the success or failure of the operation.
+ */
+cms_status compareDestinations(CMS_Destination* lhs, CMS_Destination* rhs,
int* areEqual);
+
+/**
+ * Checks if the supplied Destination is a Topic.
+ *
+ * @param destination
+ * The Destination to check for its type.
+ * @param isTopic
+ * The address to write the boolean result of the operation.
+ *
+ * @return result code indicating the success or failure of the operation.
+ */
+cms_status isDestinationTopic(CMS_Destination* destination, int* isTopic);
+
+/**
+ * Checks if the supplied Destination is a Queue.
+ *
+ * @param destination
+ * The Destination to check for its type.
+ * @param isTopic
+ * The address to write the boolean result of the operation.
+ *
+ * @return result code indicating the success or failure of the operation.
+ */
+cms_status isDestinationQueue(CMS_Destination* destination, int* isQueue);
+
+/**
+ * Checks if the supplied Destination is a Temporary type.
+ *
+ * @param destination
+ * The Destination to check for its type.
+ * @param isTopic
+ * The address to write the boolean result of the operation.
+ *
+ * @return result code indicating the success or failure of the operation.
+ */
+cms_status isDestinationTemporary(CMS_Destination* destination, int*
isTemporary);
+
#ifdef __cplusplus
}
#endif