activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419365 [18/25] - in /incubator/activemq/trunk: activemq-core/src/main/java/org/apache/activemq/thread/ activemq-core/src/test/java/org/apache/activemq/openwire/v1/ activemq-cpp/src/main/activemq/concurrent/ activemq-cpp/src/main/activemq/c...
Date Wed, 05 Jul 2006 22:27:47 GMT
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp Wed Jul  5 15:27:34 2006
@@ -1,66 +1,66 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-#include "TcpTransportFactory.h"
-
-#include <activemq/transport/TcpTransport.h>
-#include <activemq/transport/ResponseCorrelator.h>
-
-using namespace activemq;
-using namespace activemq::transport;
-using namespace activemq::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-TransportFactory& TcpTransportFactory::getInstance(void)
-{
-    // Create the one and only instance of the registrar
-    static TransportFactoryMapRegistrar registrar(
-        "tcp", new TcpTransportFactory());
-        
-    return registrar.getFactory();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Transport* TcpTransportFactory::createTransport( 
-    const activemq::util::Properties& properties )
-        throw ( ActiveMQException )
-{
-    try
-    {
-        TransportFactory* factory = 
-            TransportFactoryMap::getInstance().lookup( "io" );
-    
-        if( factory == NULL ){
-            throw ActiveMQException( 
-                __FILE__, __LINE__, 
-                "TcpTransport::createTransport - "
-                "unknown transport factory");
-        }
-    
-        Transport* transport = new TcpTransport( 
-            properties, factory->createTransport( properties ) );
-
-        // Create a response correlator.  This will wrap around our 
-        // transport and manage its lifecycle - we don't need the 
-        // internal transport anymore, so we can reuse its pointer.
-        transport = new ResponseCorrelator( transport );
-        
-        return transport;
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include "TcpTransportFactory.h"
+
+#include <activemq/transport/TcpTransport.h>
+#include <activemq/transport/ResponseCorrelator.h>
+
+using namespace activemq;
+using namespace activemq::transport;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+TransportFactory& TcpTransportFactory::getInstance(void)
+{
+    // Create the one and only instance of the registrar
+    static TransportFactoryMapRegistrar registrar(
+        "tcp", new TcpTransportFactory());
+        
+    return registrar.getFactory();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Transport* TcpTransportFactory::createTransport( 
+    const activemq::util::Properties& properties )
+        throw ( ActiveMQException )
+{
+    try
+    {
+        TransportFactory* factory = 
+            TransportFactoryMap::getInstance().lookup( "io" );
+    
+        if( factory == NULL ){
+            throw ActiveMQException( 
+                __FILE__, __LINE__, 
+                "TcpTransport::createTransport - "
+                "unknown transport factory");
+        }
+    
+        Transport* transport = new TcpTransport( 
+            properties, factory->createTransport( properties ) );
+
+        // Create a response correlator.  This will wrap around our 
+        // transport and manage its lifecycle - we don't need the 
+        // internal transport anymore, so we can reuse its pointer.
+        transport = new ResponseCorrelator( transport );
+        
+        return transport;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.h Wed Jul  5 15:27:34 2006
@@ -1,54 +1,54 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_TRANSPORT_TCPTRANSPORTFACTORY_H_
-#define _ACTIVEMQ_TRANSPORT_TCPTRANSPORTFACTORY_H_
-
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/transport/TransportFactoryMapRegistrar.h>
-#include <activemq/transport/IOTransportFactory.h>
-#include <activemq/exceptions/ActiveMQException.h>
-
-namespace activemq{
-namespace transport{
-    
-    class TcpTransportFactory : public TransportFactory
-    {
-    public:
-
-    	virtual ~TcpTransportFactory(void) {}
-
-        /**
-         * Creates a Transport instance.  
-         * @param properties The properties for the transport.
-         * @throws ActiveMQException
-         */
-        virtual Transport* createTransport( 
-            const activemq::util::Properties& properties )
-                throw ( exceptions::ActiveMQException );
-
-        /**
-         * Returns a reference to this TransportFactory
-         * @returns TransportFactory Reference
-         */
-        static TransportFactory& getInstance(void);
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_TRANSPORT_TCPTRANSPORTFACTORY_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_TRANSPORT_TCPTRANSPORTFACTORY_H_
+#define _ACTIVEMQ_TRANSPORT_TCPTRANSPORTFACTORY_H_
+
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/transport/TransportFactoryMapRegistrar.h>
+#include <activemq/transport/IOTransportFactory.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace transport{
+    
+    class TcpTransportFactory : public TransportFactory
+    {
+    public:
+
+    	virtual ~TcpTransportFactory(void) {}
+
+        /**
+         * Creates a Transport instance.  
+         * @param properties The properties for the transport.
+         * @throws ActiveMQException
+         */
+        virtual Transport* createTransport( 
+            const activemq::util::Properties& properties )
+                throw ( exceptions::ActiveMQException );
+
+        /**
+         * Returns a reference to this TransportFactory
+         * @returns TransportFactory Reference
+         */
+        static TransportFactory& getInstance(void);
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_TRANSPORT_TCPTRANSPORTFACTORY_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Transport.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h Wed Jul  5 15:27:34 2006
@@ -1,49 +1,49 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-#ifndef ACTIVEMQ_TRANSPORT_TRANSPORTEXCEPTIONLISTENER_H_
-#define ACTIVEMQ_TRANSPORT_TRANSPORTEXCEPTIONLISTENER_H_
-
-#include <activemq/exceptions/ActiveMQException.h>
-
-namespace activemq{
-namespace transport{
-  
-   // Forward declarations.
-   class Transport;
-  
-   /**
-    * A listener of asynchronous exceptions from a command transport object.
-    */
-   class TransportExceptionListener{
-   public:
-        
-      virtual ~TransportExceptionListener(){}
-        
-      /**
-       * Event handler for an exception from a command transport.
-       * @param source The source of the exception
-       * @param ex The exception.
-       */
-      virtual void onTransportException( 
-         Transport* source, 
-         const exceptions::ActiveMQException& ex ) = 0;
-  };
-    
-}}
-
-#endif /*ACTIVEMQ_TRANSPORT_TRANSPORTEXCEPTIONLISTENER_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef ACTIVEMQ_TRANSPORT_TRANSPORTEXCEPTIONLISTENER_H_
+#define ACTIVEMQ_TRANSPORT_TRANSPORTEXCEPTIONLISTENER_H_
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace transport{
+  
+   // Forward declarations.
+   class Transport;
+  
+   /**
+    * A listener of asynchronous exceptions from a command transport object.
+    */
+   class TransportExceptionListener{
+   public:
+        
+      virtual ~TransportExceptionListener(){}
+        
+      /**
+       * Event handler for an exception from a command transport.
+       * @param source The source of the exception
+       * @param ex The exception.
+       */
+      virtual void onTransportException( 
+         Transport* source, 
+         const exceptions::ActiveMQException& ex ) = 0;
+  };
+    
+}}
+
+#endif /*ACTIVEMQ_TRANSPORT_TRANSPORTEXCEPTIONLISTENER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactory.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h Wed Jul  5 15:27:34 2006
@@ -1,90 +1,90 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-#ifndef ACTIVEMQ_TRANSPORT_TRANSPORTFACTORYMAPREGISTRAR_H_
-#define ACTIVEMQ_TRANSPORT_TRANSPORTFACTORYMAPREGISTRAR_H_
-
-#include <activemq/transport/TransportFactoryMap.h>
-
-namespace activemq{
-namespace transport{
-
-    /**
-     * Registers the passed in factory into the factory map, this class
-     * can manage the lifetime of the registered factory (default behaviour).
-     */
-    class TransportFactoryMapRegistrar
-    {
-    public:
-   
-        /** 
-         * Constructor for this class
-         * @param name of the factory to register
-         * @param the factory
-         * @param boolean indicating if this object manages the lifetime of 
-         *        the factory that is being registered.
-         */
-        TransportFactoryMapRegistrar(const std::string& name, 
-                                      TransportFactory*  factory,
-                                      bool               manageLifetime = true)
-        {       
-            // Register it in the map.
-            TransportFactoryMap::getInstance().
-                registerTransportFactory(name, factory);
-
-            // Store for later deletion            
-            this->factory        = factory;
-            this->manageLifetime = manageLifetime;
-            this->name           = name;
-        }
-      
-        virtual ~TransportFactoryMapRegistrar(void)
-        {
-            try
-            {
-                // UnRegister it in the map.
-                TransportFactoryMap::getInstance().
-                    unregisterTransportFactory(name);
-            
-                if(manageLifetime)
-                {
-                    delete factory;
-                }
-            }
-            catch(...) {}
-        }
-      
-        /**
-         * Return a reference to the factory object that is contained in this
-         * registrar.
-         * @return TransportFactory reference
-         */
-        virtual TransportFactory& getFactory(void) {
-            return *factory;
-        }
-      
-    private:
-      
-        std::string       name;
-        TransportFactory* factory;
-        bool              manageLifetime;
-
-    }; 
-      
-}}
-
-#endif /*ACTIVEMQ_TRANSPORT_TRANSPORTFACTORYMAPREGISTRAR_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef ACTIVEMQ_TRANSPORT_TRANSPORTFACTORYMAPREGISTRAR_H_
+#define ACTIVEMQ_TRANSPORT_TRANSPORTFACTORYMAPREGISTRAR_H_
+
+#include <activemq/transport/TransportFactoryMap.h>
+
+namespace activemq{
+namespace transport{
+
+    /**
+     * Registers the passed in factory into the factory map, this class
+     * can manage the lifetime of the registered factory (default behaviour).
+     */
+    class TransportFactoryMapRegistrar
+    {
+    public:
+   
+        /** 
+         * Constructor for this class
+         * @param name of the factory to register
+         * @param the factory
+         * @param boolean indicating if this object manages the lifetime of 
+         *        the factory that is being registered.
+         */
+        TransportFactoryMapRegistrar(const std::string& name, 
+                                      TransportFactory*  factory,
+                                      bool               manageLifetime = true)
+        {       
+            // Register it in the map.
+            TransportFactoryMap::getInstance().
+                registerTransportFactory(name, factory);
+
+            // Store for later deletion            
+            this->factory        = factory;
+            this->manageLifetime = manageLifetime;
+            this->name           = name;
+        }
+      
+        virtual ~TransportFactoryMapRegistrar(void)
+        {
+            try
+            {
+                // UnRegister it in the map.
+                TransportFactoryMap::getInstance().
+                    unregisterTransportFactory(name);
+            
+                if(manageLifetime)
+                {
+                    delete factory;
+                }
+            }
+            catch(...) {}
+        }
+      
+        /**
+         * Return a reference to the factory object that is contained in this
+         * registrar.
+         * @return TransportFactory reference
+         */
+        virtual TransportFactory& getFactory(void) {
+            return *factory;
+        }
+      
+    private:
+      
+        std::string       name;
+        TransportFactory* factory;
+        bool              manageLifetime;
+
+    }; 
+      
+}}
+
+#endif /*ACTIVEMQ_TRANSPORT_TRANSPORTFACTORYMAPREGISTRAR_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFilter.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h Wed Jul  5 15:27:34 2006
@@ -1,61 +1,61 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_UTIL_BOOLEAN_H_
-#define _ACTIVEMQ_UTIL_BOOLEAN_H_
-
-#include <activemq/util/Number.h>
-
-namespace activemq{
-namespace util{
-
-    class Boolean : Number
-    {
-    public:
-
-    	Boolean(void) {}
-    	virtual ~Boolean(void) {}
-
-        /**
-         * Parses the String passed and extracts an bool.
-         * @param String to parse
-         * @return bool value
-         */
-        static int parseBoolean(const std::string& value){
-            bool ret = 0;
-            std::istringstream istream(value);
-            istream.clear();
-            istream >> std::boolalpha >> ret;
-            return ret;
-        }
-        
-        /**
-         * Converts the bool to a String representation
-         * @param bool to convert
-         * @return string representation
-         */
-        static std::string toString(bool value){
-            std::ostringstream ostream;
-            ostream << std::boolalpha << value;
-            return ostream.str();
-        }
-
-    };
-
-}}
-
-#endif /*BOOLEAN_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_BOOLEAN_H_
+#define _ACTIVEMQ_UTIL_BOOLEAN_H_
+
+#include <activemq/util/Number.h>
+
+namespace activemq{
+namespace util{
+
+    class Boolean : Number
+    {
+    public:
+
+    	Boolean(void) {}
+    	virtual ~Boolean(void) {}
+
+        /**
+         * Parses the String passed and extracts an bool.
+         * @param String to parse
+         * @return bool value
+         */
+        static int parseBoolean(const std::string& value){
+            bool ret = 0;
+            std::istringstream istream(value);
+            istream.clear();
+            istream >> std::boolalpha >> ret;
+            return ret;
+        }
+        
+        /**
+         * Converts the bool to a String representation
+         * @param bool to convert
+         * @return string representation
+         */
+        static std::string toString(bool value){
+            std::ostringstream ostream;
+            ostream << std::boolalpha << value;
+            return ostream.str();
+        }
+
+    };
+
+}}
+
+#endif /*BOOLEAN_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h Wed Jul  5 15:27:34 2006
@@ -1,199 +1,199 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ACTIVEMQ_UTIL_ENDIAN_H
-#define ACTIVEMQ_UTIL_ENDIAN_H
-
-#if defined( unix ) || defined(__APPLE__)
-#include <netinet/in.h>
-#else
-#include <Winsock2.h>
-#endif
-
-// First try - check __BYTE_ORDER macro
-#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
-# if defined( unix ) || defined(__APPLE__)
-#  include <sys/param.h> // defines __BYTE_ORDER (or sometimes __LITTLE_ENDIAN or __BIG_ENDIAN or __PDP_ENDIAN)
-# endif
-# if defined (__GLIBC__)
-#  include <endian.h> // Can also define __BYTE_ORDER
-# endif
-# ifdef __BYTE_ORDER
-#  if __BYTE_ORDER == __LITTLE_ENDIAN
-#   define IFR_IS_LITTLE_ENDIAN
-#  elif __BYTE_ORDER == __BIG_ENDIAN
-#   define IFR_IS_BIG_ENDIAN
-#  elif __BYTE_ORDER == __PDP_ENDIAN
-#   define IFR_IS_PDP_ENDIAN
-#  endif
-# endif
-#endif
-
-// Second try - check __LITTLE_ENDIAN or __BIG_ENDIAN
-#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
-# if defined __LITTLE_ENDIAN
-#  define IFR_IS_LITTLE_ENDIAN
-# elif defined __BIG_ENDIAN
-#  define IFR_IS_BIG_ENDIAN
-# elif defined __PDP_ENDIAN
-#  define IFR_IS_PDP_ENDIAN
-# endif
-#endif
-
-// Last try - find out from well-known processor types using little endian
-#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
-# if defined (i386) || defined (__i386__) \
-  || defined (_M_IX86) || defined (vax) \
-  || defined (__alpha) || defined (__alpha__) \
-  || defined (__x86_64__) || defined (__ia64) \
-  || defined (__ia64__) || defined (__amd64__) \
-  || defined (_M_IX86) || defined (_M_IA64) \
-  || defined (_M_ALPHA)
-#  define IFR_IS_LITTLE_ENDIAN
-# else
-#  if defined (__sparc) || defined(__sparc__) \
-  || defined(_POWER) || defined(__powerpc__) \
-  || defined(__ppc__) || defined(__hppa) \
-  || defined(_MIPSEB) || defined(_POWER) \
-  || defined(__s390__)
-#   define IFR_IS_BIG_ENDIAN
-#  endif
-# endif
-#endif
-
-// Show error if we still don't know endianess
-#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
-#error "Could not determine endianess of your processor type"
-#endif
-
-// Use these if the compiler does not support _intXX
-#ifdef NEEDS_INT_DEFINED
-#define _int16 short
-#define _int32 int
-#define _int64 long long
-#endif
-
-// Check for uintXX types
-#ifndef uint8_t
-#define uint8_t unsigned char
-#endif
-#ifndef uint16_t
-#define uint16_t unsigned short
-#endif
-#ifndef uint32_t
-#define uint32_t unsigned int
-#endif
-#ifndef uint64_t
-#define uint64_t unsigned long long
-#endif
-
-// Macros and helpers for endian conversion
-namespace activemq{
-namespace util{
-	
-/*#ifdef IFR_IS_BIGENDIAN
-inline unsigned int       htoni   (unsigned int i)        { return i; }
-inline unsigned long long htonll  (unsigned long long ll) { return ll; }
-inline float              htonf   (float f)               { return f; }
-inline double             htond   (double d)              { return d; }
-inline unsigned int       ntohi   (unsigned int i)        { return i; }
-inline unsigned long long ntohll  (unsigned long long ll) { return ll; }
-inline float              ntohf   (float f)               { return f; }
-inline double             ntohd   (double d)              { return d; }
-#else // !IFR_IS_BIGENDIAN
-
-inline unsigned int htoni (unsigned int i) {
-  return ( i << 8  ) & 0xFF00 |
-	     ( i >> 8  ) & 0x00FF;
-}
-inline unsigned long long htonll (unsigned long long ll) {
-  return
-    ( ll << 56 ) & 0xFF00000000000000ULL |
-	( ll << 40 ) & 0x00FF000000000000ULL |
-	( ll << 24 ) & 0x0000FF0000000000ULL |
-	( ll << 8  ) & 0x000000FF00000000ULL |
-    ( ll >> 8  ) & 0x00000000FF000000ULL |
-	( ll >> 24 ) & 0x0000000000FF0000ULL |
-	( ll >> 40 ) & 0x000000000000FF00ULL |
-	( ll >> 56 ) & 0x00000000000000FFULL;
-}
-
-
-inline float htonf (float f) {
-  unsigned int i = htonl( *(unsigned int *)&f ) ;
-  return *(float *)&i ;
-}
-inline double htond (double d) {
-  unsigned long long ll = htonll( *(unsigned long long *)&d ) ;
-  return *(double *)&ll ;
-}
-inline unsigned int       ntohi   (unsigned int i)        { return htoni (i); }
-inline unsigned long long ntohll  (unsigned long long ll) { return htonll (ll); }
-inline float              ntohf   (float f)               { return htonf (f); }
-inline double             ntohd   (double d)              { return htond (d); }
-*/
-	class Endian{
-	public:
-	
-		static void byteSwap(unsigned char* data, int dataLength) {
-			
-			#ifdef IFR_IS_BIGENDIAN
-				return;
-			#endif
-			
-		    for (int i = 0; i<dataLength/2; i++) {
-				unsigned char temp = data[i];
-				data[i] = data[dataLength-1-i];
-				data[dataLength-1-i] = temp;
-		    }
-		}
-		
-		static uint8_t byteSwap( uint8_t value ){
-			byteSwap( (unsigned char*)&value, sizeof( value ) );
-			return value;
-		}
-		
-		static uint16_t byteSwap( uint16_t value ){
-			byteSwap( (unsigned char*)&value, sizeof( value ) );
-			return value;
-		}
-		
-		static uint32_t byteSwap( uint32_t value ){
-			byteSwap( (unsigned char*)&value, sizeof( value ) );
-			return value;
-		}
-		
-		static uint64_t byteSwap( uint64_t value ){
-			byteSwap( (unsigned char*)&value, sizeof( value ) );
-			return value;
-		}
-		
-		static float byteSwap( float value ){
-			byteSwap( (unsigned char*)&value, sizeof( value ) );
-			return value;
-		}
-		
-		static double byteSwap( double value ){
-			byteSwap( (unsigned char*)&value, sizeof( value ) );
-			return value;
-		}
-	};
-	
-//#endif // IFR_IS_BIGENDIAN
-
-}}
-
-#endif /*ACTIVEMQ_UTIL_ENDIAN_H*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_UTIL_ENDIAN_H
+#define ACTIVEMQ_UTIL_ENDIAN_H
+
+#if defined( unix ) || defined(__APPLE__)
+#include <netinet/in.h>
+#else
+#include <Winsock2.h>
+#endif
+
+// First try - check __BYTE_ORDER macro
+#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
+# if defined( unix ) || defined(__APPLE__)
+#  include <sys/param.h> // defines __BYTE_ORDER (or sometimes __LITTLE_ENDIAN or __BIG_ENDIAN or __PDP_ENDIAN)
+# endif
+# if defined (__GLIBC__)
+#  include <endian.h> // Can also define __BYTE_ORDER
+# endif
+# ifdef __BYTE_ORDER
+#  if __BYTE_ORDER == __LITTLE_ENDIAN
+#   define IFR_IS_LITTLE_ENDIAN
+#  elif __BYTE_ORDER == __BIG_ENDIAN
+#   define IFR_IS_BIG_ENDIAN
+#  elif __BYTE_ORDER == __PDP_ENDIAN
+#   define IFR_IS_PDP_ENDIAN
+#  endif
+# endif
+#endif
+
+// Second try - check __LITTLE_ENDIAN or __BIG_ENDIAN
+#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
+# if defined __LITTLE_ENDIAN
+#  define IFR_IS_LITTLE_ENDIAN
+# elif defined __BIG_ENDIAN
+#  define IFR_IS_BIG_ENDIAN
+# elif defined __PDP_ENDIAN
+#  define IFR_IS_PDP_ENDIAN
+# endif
+#endif
+
+// Last try - find out from well-known processor types using little endian
+#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
+# if defined (i386) || defined (__i386__) \
+  || defined (_M_IX86) || defined (vax) \
+  || defined (__alpha) || defined (__alpha__) \
+  || defined (__x86_64__) || defined (__ia64) \
+  || defined (__ia64__) || defined (__amd64__) \
+  || defined (_M_IX86) || defined (_M_IA64) \
+  || defined (_M_ALPHA)
+#  define IFR_IS_LITTLE_ENDIAN
+# else
+#  if defined (__sparc) || defined(__sparc__) \
+  || defined(_POWER) || defined(__powerpc__) \
+  || defined(__ppc__) || defined(__hppa) \
+  || defined(_MIPSEB) || defined(_POWER) \
+  || defined(__s390__)
+#   define IFR_IS_BIG_ENDIAN
+#  endif
+# endif
+#endif
+
+// Show error if we still don't know endianess
+#if !defined IFR_IS_BIG_ENDIAN && !defined IFR_IS_LITTLE_ENDIAN && !defined IFR_IS_DPD_ENDIAN
+#error "Could not determine endianess of your processor type"
+#endif
+
+// Use these if the compiler does not support _intXX
+#ifdef NEEDS_INT_DEFINED
+#define _int16 short
+#define _int32 int
+#define _int64 long long
+#endif
+
+// Check for uintXX types
+#ifndef uint8_t
+#define uint8_t unsigned char
+#endif
+#ifndef uint16_t
+#define uint16_t unsigned short
+#endif
+#ifndef uint32_t
+#define uint32_t unsigned int
+#endif
+#ifndef uint64_t
+#define uint64_t unsigned long long
+#endif
+
+// Macros and helpers for endian conversion
+namespace activemq{
+namespace util{
+	
+/*#ifdef IFR_IS_BIGENDIAN
+inline unsigned int       htoni   (unsigned int i)        { return i; }
+inline unsigned long long htonll  (unsigned long long ll) { return ll; }
+inline float              htonf   (float f)               { return f; }
+inline double             htond   (double d)              { return d; }
+inline unsigned int       ntohi   (unsigned int i)        { return i; }
+inline unsigned long long ntohll  (unsigned long long ll) { return ll; }
+inline float              ntohf   (float f)               { return f; }
+inline double             ntohd   (double d)              { return d; }
+#else // !IFR_IS_BIGENDIAN
+
+inline unsigned int htoni (unsigned int i) {
+  return ( i << 8  ) & 0xFF00 |
+	     ( i >> 8  ) & 0x00FF;
+}
+inline unsigned long long htonll (unsigned long long ll) {
+  return
+    ( ll << 56 ) & 0xFF00000000000000ULL |
+	( ll << 40 ) & 0x00FF000000000000ULL |
+	( ll << 24 ) & 0x0000FF0000000000ULL |
+	( ll << 8  ) & 0x000000FF00000000ULL |
+    ( ll >> 8  ) & 0x00000000FF000000ULL |
+	( ll >> 24 ) & 0x0000000000FF0000ULL |
+	( ll >> 40 ) & 0x000000000000FF00ULL |
+	( ll >> 56 ) & 0x00000000000000FFULL;
+}
+
+
+inline float htonf (float f) {
+  unsigned int i = htonl( *(unsigned int *)&f ) ;
+  return *(float *)&i ;
+}
+inline double htond (double d) {
+  unsigned long long ll = htonll( *(unsigned long long *)&d ) ;
+  return *(double *)&ll ;
+}
+inline unsigned int       ntohi   (unsigned int i)        { return htoni (i); }
+inline unsigned long long ntohll  (unsigned long long ll) { return htonll (ll); }
+inline float              ntohf   (float f)               { return htonf (f); }
+inline double             ntohd   (double d)              { return htond (d); }
+*/
+	class Endian{
+	public:
+	
+		static void byteSwap(unsigned char* data, int dataLength) {
+			
+			#ifdef IFR_IS_BIGENDIAN
+				return;
+			#endif
+			
+		    for (int i = 0; i<dataLength/2; i++) {
+				unsigned char temp = data[i];
+				data[i] = data[dataLength-1-i];
+				data[dataLength-1-i] = temp;
+		    }
+		}
+		
+		static uint8_t byteSwap( uint8_t value ){
+			byteSwap( (unsigned char*)&value, sizeof( value ) );
+			return value;
+		}
+		
+		static uint16_t byteSwap( uint16_t value ){
+			byteSwap( (unsigned char*)&value, sizeof( value ) );
+			return value;
+		}
+		
+		static uint32_t byteSwap( uint32_t value ){
+			byteSwap( (unsigned char*)&value, sizeof( value ) );
+			return value;
+		}
+		
+		static uint64_t byteSwap( uint64_t value ){
+			byteSwap( (unsigned char*)&value, sizeof( value ) );
+			return value;
+		}
+		
+		static float byteSwap( float value ){
+			byteSwap( (unsigned char*)&value, sizeof( value ) );
+			return value;
+		}
+		
+		static double byteSwap( double value ){
+			byteSwap( (unsigned char*)&value, sizeof( value ) );
+			return value;
+		}
+	};
+	
+//#endif // IFR_IS_BIGENDIAN
+
+}}
+
+#endif /*ACTIVEMQ_UTIL_ENDIAN_H*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h
------------------------------------------------------------------------------
    svn:eol-style = native

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=419365&r1=419364&r2=419365&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 Wed Jul  5 15:27:34 2006
@@ -1,405 +1,405 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Guid.h"
-#include <stdexcept>
-
-using namespace activemq::util;
-using namespace activemq::exceptions;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-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
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Guid::Guid(const Guid& source)
-{
-   // Set this uuid to that of the source
-   *this = source;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Guid::Guid(const std::string& source)
-   throw ( IllegalArgumentException )
-{
-   if(source == "")
-   {
-      throw IllegalArgumentException(
-         __FILE__, __LINE__,
-         "GUID::fromBytes - Source was Empty");
-   }
-
-   // Set this uuid to that of the source
-   *this = source;   
-}
-   
-////////////////////////////////////////////////////////////////////////////////
-Guid::~Guid(void)
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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;
-
-      BOOL result = ::UuidIsNil( const_cast<GUID*>( &uuid ), &status );
-
-	   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
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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
-
-   return *this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Guid::toString(void) const throw( RuntimeException )
-{
-   std::string uuid_str = "";
-
-   #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);
-      
-      // 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
-
-   return uuid_str;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Guid::operator std::string() const
-{
-   return toString();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-const unsigned char* Guid::toBytes(void) const
-{
-   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
-   
-   return &buffer[0]; 
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Guid& Guid::fromBytes(const unsigned char* bytes) 
-   throw ( IllegalArgumentException )
-{
-   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
-
-   return *this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int Guid::getRawBytesSize(void) const
-{
-   #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
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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
-
-   return *this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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
-
-   return *this;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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;
-
-	   BOOL result = ::UuidEqual(
-         const_cast<GUID*>( &uuid ),
-         const_cast<GUID*>( &source.uuid ),
-		   &status );
-
-	   return ( result == TRUE ) ? true : false;
-   #endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator==(const std::string& source) const
-{
-   return *this == Guid(source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator!=(const Guid& source) const
-{
-   return !(*this == source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator!=(const std::string& source) const
-{
-   return !(*this == source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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;
-
-      int result = ::UuidCompare(
-         const_cast<GUID*>( &uuid ),
-         const_cast<GUID*>( &source.uuid ),
-		   &status );
-
-	   return ( result < 0 ) ? true : false;
-   #endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator<(const std::string& source) const
-{
-   return *this < Guid(source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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;
-
-      int result = ::UuidCompare(
-         const_cast<GUID*>( &uuid ),
-         const_cast<GUID*>( &source.uuid ),
-		   &status );
-
-	   return ( result <= 0 ) ? true : false;
-   #endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator<=(const std::string& source) const
-{
-   return *this <= Guid(source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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;
-
-      int result = ::UuidCompare(
-         const_cast<GUID*>( &uuid ),
-         const_cast<GUID*>( &source.uuid ),
-		   &status );
-
-	   return ( result > 0 ) ? true : false;
-   #endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator>(const std::string& source) const
-{
-   return *this > Guid(source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-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;
-
-      int result = ::UuidCompare(
-         const_cast<GUID*>(&uuid),
-         const_cast<GUID*>(&source.uuid),
-		   &status);
-
-	   return (result >= 0) ? true : false;
-   #endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool Guid::operator>=(const std::string& source) const
-{
-   return *this >= Guid(source);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-std::string Guid::createGUIDString(void)
-{
-   return Guid().createGUID().toString();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-const unsigned char* createGUIDBytes(void)
-{
-   return Guid().createGUID().toBytes();
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Guid.h"
+#include <stdexcept>
+
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+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
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Guid::Guid(const Guid& source)
+{
+   // Set this uuid to that of the source
+   *this = source;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Guid::Guid(const std::string& source)
+   throw ( IllegalArgumentException )
+{
+   if(source == "")
+   {
+      throw IllegalArgumentException(
+         __FILE__, __LINE__,
+         "GUID::fromBytes - Source was Empty");
+   }
+
+   // Set this uuid to that of the source
+   *this = source;   
+}
+   
+////////////////////////////////////////////////////////////////////////////////
+Guid::~Guid(void)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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;
+
+      BOOL result = ::UuidIsNil( const_cast<GUID*>( &uuid ), &status );
+
+	   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
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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
+
+   return *this;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string Guid::toString(void) const throw( RuntimeException )
+{
+   std::string uuid_str = "";
+
+   #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);
+      
+      // 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
+
+   return uuid_str;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Guid::operator std::string() const
+{
+   return toString();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const unsigned char* Guid::toBytes(void) const
+{
+   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
+   
+   return &buffer[0]; 
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Guid& Guid::fromBytes(const unsigned char* bytes) 
+   throw ( IllegalArgumentException )
+{
+   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
+
+   return *this;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int Guid::getRawBytesSize(void) const
+{
+   #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
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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
+
+   return *this;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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
+
+   return *this;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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;
+
+	   BOOL result = ::UuidEqual(
+         const_cast<GUID*>( &uuid ),
+         const_cast<GUID*>( &source.uuid ),
+		   &status );
+
+	   return ( result == TRUE ) ? true : false;
+   #endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator==(const std::string& source) const
+{
+   return *this == Guid(source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator!=(const Guid& source) const
+{
+   return !(*this == source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator!=(const std::string& source) const
+{
+   return !(*this == source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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;
+
+      int result = ::UuidCompare(
+         const_cast<GUID*>( &uuid ),
+         const_cast<GUID*>( &source.uuid ),
+		   &status );
+
+	   return ( result < 0 ) ? true : false;
+   #endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator<(const std::string& source) const
+{
+   return *this < Guid(source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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;
+
+      int result = ::UuidCompare(
+         const_cast<GUID*>( &uuid ),
+         const_cast<GUID*>( &source.uuid ),
+		   &status );
+
+	   return ( result <= 0 ) ? true : false;
+   #endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator<=(const std::string& source) const
+{
+   return *this <= Guid(source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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;
+
+      int result = ::UuidCompare(
+         const_cast<GUID*>( &uuid ),
+         const_cast<GUID*>( &source.uuid ),
+		   &status );
+
+	   return ( result > 0 ) ? true : false;
+   #endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator>(const std::string& source) const
+{
+   return *this > Guid(source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+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;
+
+      int result = ::UuidCompare(
+         const_cast<GUID*>(&uuid),
+         const_cast<GUID*>(&source.uuid),
+		   &status);
+
+	   return (result >= 0) ? true : false;
+   #endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Guid::operator>=(const std::string& source) const
+{
+   return *this >= Guid(source);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string Guid::createGUIDString(void)
+{
+   return Guid().createGUID().toString();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const unsigned char* createGUIDBytes(void)
+{
+   return Guid().createGUID().toBytes();
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

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=419365&r1=419364&r2=419365&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 Wed Jul  5 15:27:34 2006
@@ -1,200 +1,200 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ACTIVEMQ_UTIL_GUID_H
-#define ACTIVEMQ_UTIL_GUID_H
-
-#if defined( unix ) || defined(__APPLE__) && !defined( __CYGWIN__ ) 
-   #include <uuid/uuid.h>
-#elif defined(_WIN32) || defined( __CYGWIN__ )
-	#include <objbase.h>
-   #include <rpcdce.h>
-#else // defined MACOSX
-	#include "uuid.h"
-#endif
-
-#include <activemq/exceptions/RuntimeException.h>
-#include <activemq/exceptions/IllegalArgumentException.h>
-
-#include <string>
-
-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;
-      
-   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);
-   
-   private:
-   
-      // the uuid that this object represents.
-      #if defined( unix ) || defined(__APPLE__)
-         uuid_t uuid;
-      #else
-         ::GUID uuid;
-      #endif
-         
-   };
-
-}}
-
-#endif /*ACTIVEMQ_UTIL_GUID_H*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_UTIL_GUID_H
+#define ACTIVEMQ_UTIL_GUID_H
+
+#if defined( unix ) || defined(__APPLE__) && !defined( __CYGWIN__ ) 
+   #include <uuid/uuid.h>
+#elif defined(_WIN32) || defined( __CYGWIN__ )
+	#include <objbase.h>
+   #include <rpcdce.h>
+#else // defined MACOSX
+	#include "uuid.h"
+#endif
+
+#include <activemq/exceptions/RuntimeException.h>
+#include <activemq/exceptions/IllegalArgumentException.h>
+
+#include <string>
+
+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;
+      
+   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);
+   
+   private:
+   
+      // the uuid that this object represents.
+      #if defined( unix ) || defined(__APPLE__)
+         uuid_t uuid;
+      #else
+         ::GUID uuid;
+      #endif
+         
+   };
+
+}}
+
+#endif /*ACTIVEMQ_UTIL_GUID_H*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Guid.h
------------------------------------------------------------------------------
    svn:eol-style = native

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=419365&r1=419364&r2=419365&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 Wed Jul  5 15:27:34 2006
@@ -1,61 +1,61 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_UTIL_INTEGER_H_
-#define _ACTIVEMQ_UTIL_INTEGER_H_
-
-#include <activemq/util/Number.h>
-
-namespace activemq{
-namespace util{
-
-    class Integer : public Number
-    {
-    public:
-
-    	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){
-            int ret = 0;
-            std::istringstream istream(value);
-            istream.clear();
-            istream >> ret;
-            return ret;
-        }
-        
-        /**
-         * Converts the int to a String representation
-         * @param int to convert
-         * @return string representation
-         */
-        static std::string toString(int value){
-            std::ostringstream ostream;
-            ostream << value;
-            return ostream.str();
-        }
-        
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_INTEGER_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_INTEGER_H_
+#define _ACTIVEMQ_UTIL_INTEGER_H_
+
+#include <activemq/util/Number.h>
+
+namespace activemq{
+namespace util{
+
+    class Integer : public Number
+    {
+    public:
+
+    	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){
+            int ret = 0;
+            std::istringstream istream(value);
+            istream.clear();
+            istream >> ret;
+            return ret;
+        }
+        
+        /**
+         * Converts the int to a String representation
+         * @param int to convert
+         * @return string representation
+         */
+        static std::string toString(int value){
+            std::ostringstream ostream;
+            ostream << value;
+            return ostream.str();
+        }
+        
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_INTEGER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Integer.h
------------------------------------------------------------------------------
    svn:eol-style = native

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=419365&r1=419364&r2=419365&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 Wed Jul  5 15:27:34 2006
@@ -1,60 +1,60 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_UTIL_LONG_H_
-#define _ACTIVEMQ_UTIL_LONG_H_
-
-#include <activemq/util/Number.h>
-
-namespace activemq{
-namespace util{
-
-    class Long : public Number
-    {
-    public:
-
-    	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){
-            long ret = 0;
-            std::istringstream istream(value);
-            istream.clear();
-            istream >> ret;
-            return ret;
-        }
-        
-        /**
-         * Converts the long to a String representation
-         * @param long to convert
-         * @return string representation
-         */
-        static std::string toString(long value){
-            std::ostringstream ostream;
-            ostream << value;
-            return ostream.str();
-        }
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_LONG_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_LONG_H_
+#define _ACTIVEMQ_UTIL_LONG_H_
+
+#include <activemq/util/Number.h>
+
+namespace activemq{
+namespace util{
+
+    class Long : public Number
+    {
+    public:
+
+    	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){
+            long ret = 0;
+            std::istringstream istream(value);
+            istream.clear();
+            istream >> ret;
+            return ret;
+        }
+        
+        /**
+         * Converts the long to a String representation
+         * @param long to convert
+         * @return string representation
+         */
+        static std::string toString(long value){
+            std::ostringstream ostream;
+            ostream << value;
+            return ostream.str();
+        }
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_LONG_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Long.h
------------------------------------------------------------------------------
    svn:eol-style = native

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=419365&r1=419364&r2=419365&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 Wed Jul  5 15:27:34 2006
@@ -1,43 +1,43 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_UTIL_NUMBER_H_
-#define _ACTIVEMQ_UTIL_NUMBER_H_
-
-#include <sstream>
-
-namespace activemq{
-namespace util{
-
-    /**
-     * The abstract class Number is the superclass of classes Byte, Double, 
-     * Float, Integer, Long, and Short.
-     * 
-     * Subclasses of Number must provide methods to convert the represented 
-     * numeric value to byte, double, float, int, long, and short. 
-     */
-    class Number
-    {
-    public:
-
-    	virtual ~Number(void) {}
-        
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_UTIL_NUMBER_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_UTIL_NUMBER_H_
+#define _ACTIVEMQ_UTIL_NUMBER_H_
+
+#include <sstream>
+
+namespace activemq{
+namespace util{
+
+    /**
+     * The abstract class Number is the superclass of classes Byte, Double, 
+     * Float, Integer, Long, and Short.
+     * 
+     * Subclasses of Number must provide methods to convert the represented 
+     * numeric value to byte, double, float, int, long, and short. 
+     */
+    class Number
+    {
+    public:
+
+    	virtual ~Number(void) {}
+        
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_UTIL_NUMBER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Number.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Properties.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message