activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r743068 [1/2] - in /activemq/activemq-cpp/trunk/src: main/activemq/cmsutil/ main/activemq/commands/ main/activemq/core/ main/activemq/state/ main/activemq/transport/ main/activemq/util/ main/activemq/wireformat/ main/activemq/wireformat/ope...
Date Tue, 10 Feb 2009 19:24:56 GMT
Author: tabish
Date: Tue Feb 10 19:24:55 2009
New Revision: 743068

URL: http://svn.apache.org/viewvc?rev=743068&view=rev
Log:
Refactor the decaf Map class as an Interface and add an STL map as the first implementation of that interface, with a concurrent version to follow.  This allows for other Map implementations besides the STL version.

Added:
    activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h
      - copied, changed from r740944, activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp   (with props)
    activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.h   (with props)
Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h
    activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
    activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h
    activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h
    activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp
    activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp
    activemq/activemq-cpp/trunk/src/main/decaf/lang/System.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h
    activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/PrimitiveMapBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h
    activemq/activemq-cpp/trunk/src/test/Makefile.am
    activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveListTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveMapTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.h
    activemq/activemq-cpp/trunk/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp Tue Feb 10 19:24:55 2009
@@ -32,7 +32,7 @@
     try {
 
         // See if we already have a topic with this name.
-        topic = topicMap.getValue( topicName );
+        topic = topicMap.get( topicName );
 
     } catch ( decaf::lang::exceptions::NoSuchElementException& ex ) {
 
@@ -43,7 +43,7 @@
         resourceLifecycleManager->addDestination( topic );
 
         // Add the topic to the map.
-        topicMap.setValue( topicName, topic );
+        topicMap.put( topicName, topic );
     }
     return topic;
 }
@@ -56,7 +56,7 @@
     try {
 
         // See if we already have a queue with this name.
-        queue = queueMap.getValue( queueName );
+        queue = queueMap.get( queueName );
 
     } catch ( decaf::lang::exceptions::NoSuchElementException& ex ) {
 
@@ -67,7 +67,7 @@
         resourceLifecycleManager->addDestination( queue );
 
         // Add the queue to the map.
-        queueMap.setValue( queueName, queue );
+        queueMap.put( queueName, queue );
     }
     return queue;
 }
@@ -82,7 +82,7 @@
 void DynamicDestinationResolver::destroy() {
 
     // Destroy the session resolvers.
-    vector<SessionResolver*> r = sessionResolverMap.getValues();
+    vector<SessionResolver*> r = sessionResolverMap.values();
     for( size_t ix=0; ix<r.size(); ++ix ) {
         delete r[ix];
     }
@@ -101,10 +101,10 @@
     // Get the resolver for this session.
     SessionResolver* resolver = NULL;
     try {
-        resolver = sessionResolverMap.getValue( session );
+        resolver = sessionResolverMap.get( session );
     } catch ( decaf::lang::exceptions::NoSuchElementException& ex ) {
         resolver = new SessionResolver( session, resourceLifecycleManager );
-        sessionResolverMap.setValue( session, resolver );
+        sessionResolverMap.put( session, resolver );
     }
 
     // Return the appropriate destination.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h Tue Feb 10 19:24:55 2009
@@ -19,7 +19,7 @@
 
 #include <activemq/cmsutil/DestinationResolver.h>
 #include <cms/Session.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <activemq/util/Config.h>
 
 namespace activemq {
@@ -39,8 +39,8 @@
 
             ResourceLifecycleManager* resourceLifecycleManager;
             cms::Session* session;
-            decaf::util::Map<std::string, cms::Topic*> topicMap;
-            decaf::util::Map<std::string, cms::Queue*> queueMap;
+            decaf::util::STLMap<std::string, cms::Topic*> topicMap;
+            decaf::util::STLMap<std::string, cms::Queue*> queueMap;
 
         public:
 
@@ -64,7 +64,7 @@
         /**
          * Maps a given session to the resolver for that session.
          */
-        decaf::util::Map< cms::Session*, SessionResolver*> sessionResolverMap;
+        decaf::util::STLMap< cms::Session*, SessionResolver*> sessionResolverMap;
 
         /**
          * Manages lifecycle of any allocated topics/queues.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.cpp Tue Feb 10 19:24:55 2009
@@ -34,14 +34,14 @@
 PooledSession::~PooledSession(){
 
     // Destroy cached producers.
-    std::vector<CachedProducer*> cachedProducers = producerCache.getValues();
+    std::vector<CachedProducer*> cachedProducers = producerCache.values();
     for( std::size_t ix = 0; ix < cachedProducers.size(); ++ix ) {
         delete cachedProducers[ix];
     }
     cachedProducers.clear();
 
     // Destroy cached consumers.
-    std::vector<CachedConsumer*> cachedConsumers = consumerCache.getValues();
+    std::vector<CachedConsumer*> cachedConsumers = consumerCache.values();
     for( std::size_t ix = 0; ix < cachedConsumers.size(); ++ix ) {
         delete cachedConsumers[ix];
     }
@@ -72,7 +72,7 @@
         // Check the cache - add it if necessary.
         CachedProducer* cachedProducer = NULL;
         try {
-            cachedProducer = producerCache.getValue( key );
+            cachedProducer = producerCache.get( key );
         } catch( decaf::lang::exceptions::NoSuchElementException& e ) {
 
             // No producer exists for this destination - start by creating
@@ -86,7 +86,7 @@
             cachedProducer = new CachedProducer( p );
 
             // Add it to the cache.
-            producerCache.setValue( key, cachedProducer );
+            producerCache.put( key, cachedProducer );
         }
 
         return cachedProducer;
@@ -117,7 +117,7 @@
         // Check the cache - add it if necessary.
         CachedConsumer* cachedConsumer = NULL;
         try {
-            cachedConsumer = consumerCache.getValue( key );
+            cachedConsumer = consumerCache.get( key );
         } catch( decaf::lang::exceptions::NoSuchElementException& e ) {
 
             // No producer exists for this destination - start by creating
@@ -131,7 +131,7 @@
             cachedConsumer = new CachedConsumer( c );
 
             // Add it to the cache.
-            consumerCache.setValue( key, cachedConsumer );
+            consumerCache.put( key, cachedConsumer );
         }
 
         return cachedConsumer;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h Tue Feb 10 19:24:55 2009
@@ -19,7 +19,7 @@
 #define ACTIVEMQ_CMSUTIL_POOLEDSESSION_H_
 
 #include <cms/Session.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <activemq/cmsutil/CachedProducer.h>
 #include <activemq/cmsutil/CachedConsumer.h>
 #include <activemq/util/Config.h>
@@ -41,9 +41,9 @@
 
         cms::Session* session;
 
-        decaf::util::Map<std::string, CachedProducer*> producerCache;
+        decaf::util::STLMap<std::string, CachedProducer*> producerCache;
 
-        decaf::util::Map<std::string, CachedConsumer*> consumerCache;
+        decaf::util::STLMap<std::string, CachedConsumer*> consumerCache;
 
     public:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMapMessage.cpp Tue Feb 10 19:24:55 2009
@@ -125,7 +125,7 @@
 std::vector<std::string> ActiveMQMapMessage::getMapNames(void) const {
 
     try{
-        return getMap().getKeys();
+        return getMap().keySet();
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )

Modified: activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/commands/ActiveMQMessageTemplate.h Tue Feb 10 19:24:55 2009
@@ -81,7 +81,7 @@
          * message.
          */
         virtual std::vector<std::string> getPropertyNames() const {
-            return getMessageProperties().getKeys();
+            return getMessageProperties().keySet();
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Tue Feb 10 19:24:55 2009
@@ -95,7 +95,7 @@
 
     // Add the consumer to the map.
     synchronized( &dispatchers ) {
-        dispatchers.setValue( consumer, dispatcher );
+        dispatchers.put( consumer, dispatcher );
     }
 }
 
@@ -183,7 +183,7 @@
 
         // Add this producer from the set of active consumer.
         synchronized( &activeProducers ) {
-            activeProducers.setValue( producer->getProducerInfo().getProducerId(), producer );
+            activeProducers.put( producer->getProducerInfo().getProducerId(), producer );
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -460,7 +460,7 @@
             Dispatcher* dispatcher = NULL;
             synchronized( &dispatchers ) {
 
-                dispatcher = dispatchers.getValue( dispatch->getConsumerId() );
+                dispatcher = dispatchers.get( dispatch->getConsumerId() );
 
                 // If we have no registered dispatcher, the consumer was probably
                 // just closed.
@@ -480,7 +480,7 @@
             // Get the consumer info object for this consumer.
             ActiveMQProducer* producer = NULL;
             synchronized( &this->activeProducers ) {
-                producer = this->activeProducers.getValue( producerAck->getProducerId() );
+                producer = this->activeProducers.get( producerAck->getProducerId() );
                 if( producer != NULL ){
                     producer->onProducerAck( *producerAck );
                 }

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h Tue Feb 10 19:24:55 2009
@@ -32,7 +32,7 @@
 #include <activemq/commands/WireFormatInfo.h>
 #include <activemq/exceptions/ActiveMQException.h>
 #include <decaf/util/Properties.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/util/Set.h>
 #include <decaf/lang/exceptions/UnsupportedOperationException.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
@@ -56,13 +56,13 @@
     {
     private:
 
-        typedef decaf::util::Map< decaf::lang::Pointer<commands::ConsumerId>,
-                                  Dispatcher*,
-                                  commands::ConsumerId::COMPARATOR > DispatcherMap;
-
-        typedef decaf::util::Map< decaf::lang::Pointer<commands::ProducerId>,
-                                  ActiveMQProducer*,
-                                  commands::ProducerId::COMPARATOR > ProducerMap;
+        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ConsumerId>,
+                                     Dispatcher*,
+                                     commands::ConsumerId::COMPARATOR > DispatcherMap;
+
+        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ProducerId>,
+                                     ActiveMQProducer*,
+                                     commands::ProducerId::COMPARATOR > ProducerMap;
 
     private:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp Tue Feb 10 19:24:55 2009
@@ -119,7 +119,7 @@
         // Close all Consumers
         synchronized( &this->consumers ) {
 
-            std::vector<ActiveMQConsumer*> closables = this->consumers.getValues();
+            std::vector<ActiveMQConsumer*> closables = this->consumers.values();
 
             for( std::size_t i = 0; i < closables.size(); ++i ) {
                 try{
@@ -133,7 +133,7 @@
         // Close all Producers
         synchronized( &this->producers ) {
 
-            std::vector<ActiveMQProducer*> closables = this->producers.getValues();
+            std::vector<ActiveMQProducer*> closables = this->producers.values();
 
             for( std::size_t i = 0; i < closables.size(); ++i ) {
                 try{
@@ -270,8 +270,7 @@
 
         // Add the consumer to the map.
         synchronized( &this->consumers ) {
-            this->consumers.setValue(
-                consumer->getConsumerInfo().getConsumerId(), consumer.get() );
+            this->consumers.put( consumer->getConsumerInfo().getConsumerId(), consumer.get() );
         }
 
         return consumer.release();
@@ -313,8 +312,7 @@
 
         // Add the consumer to the map.
         synchronized( &this->consumers ) {
-            this->consumers.setValue(
-                consumer->getConsumerInfo().getConsumerId(), consumer.get() );
+            this->consumers.put( consumer->getConsumerInfo().getConsumerId(), consumer.get() );
         }
 
         return consumer.release();
@@ -373,7 +371,7 @@
 
         synchronized( &this->producers ) {
             // Place the Producer into the Map.
-            this->producers.setValue( producerId, producer.get() );
+            this->producers.put( producerId, producer.get() );
         }
 
         // Add to the Connections list
@@ -1037,7 +1035,7 @@
 
     synchronized( &this->consumers ) {
         if( this->consumers.containsKey( id ) ) {
-            return this->consumers.getValue( id );
+            return this->consumers.get( id );
         }
     }
     return NULL;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h Tue Feb 10 19:24:55 2009
@@ -31,7 +31,7 @@
 #include <activemq/commands/TransactionId.h>
 #include <activemq/core/Dispatcher.h>
 
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/util/Set.h>
 #include <decaf/util/Queue.h>
 #include <decaf/util/Properties.h>
@@ -53,13 +53,13 @@
     class AMQCPP_API ActiveMQSession : public cms::Session, public Dispatcher {
     private:
 
-        typedef decaf::util::Map< decaf::lang::Pointer<commands::ConsumerId>,
-                                  ActiveMQConsumer*,
-                                  commands::ConsumerId::COMPARATOR> ConsumersMap;
-
-        typedef decaf::util::Map< decaf::lang::Pointer<commands::ProducerId>,
-                                  ActiveMQProducer*,
-                                  commands::ProducerId::COMPARATOR> ProducersMap;
+        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ConsumerId>,
+                                     ActiveMQConsumer*,
+                                     commands::ConsumerId::COMPARATOR> ConsumersMap;
+
+        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ProducerId>,
+                                     ActiveMQProducer*,
+                                     commands::ProducerId::COMPARATOR> ProducersMap;
 
     private:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.cpp Tue Feb 10 19:24:55 2009
@@ -49,7 +49,7 @@
 
     if( this->disposed.compareAndSet( false, true ) ) {
 
-        std::vector<SessionState*> values = this->sessions.getValues();
+        std::vector<SessionState*> values = this->sessions.values();
         std::vector<SessionState*>::iterator iter = values.begin();
 
         for( ; iter != values.end(); ++iter ) {

Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h Tue Feb 10 19:24:55 2009
@@ -31,7 +31,7 @@
 #include <activemq/state/TransactionState.h>
 
 #include <decaf/util/concurrent/atomic/AtomicBoolean.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/util/List.h>
 
 #include <string>
@@ -44,8 +44,8 @@
     private:
 
         std::auto_ptr<commands::ConnectionInfo> info;
-        decaf::util::Map< commands::TransactionId, TransactionState* > transactions;
-        decaf::util::Map< commands::SessionId, SessionState* > sessions;
+        decaf::util::STLMap< commands::TransactionId, TransactionState* > transactions;
+        decaf::util::STLMap< commands::SessionId, SessionState* > sessions;
         decaf::util::List< commands::DestinationInfo* > tempDestinations;
         decaf::util::concurrent::atomic::AtomicBoolean disposed;
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.cpp Tue Feb 10 19:24:55 2009
@@ -27,7 +27,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 SessionState::SessionState( const Pointer<SessionInfo>& info ) :
-    disposed( false ), info( info ) {
+    info( info ), disposed( false ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h Tue Feb 10 19:24:55 2009
@@ -26,7 +26,7 @@
 #include <activemq/state/ProducerState.h>
 
 #include <decaf/util/concurrent/atomic/AtomicBoolean.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 
 #include <string>
 #include <memory>
@@ -42,13 +42,13 @@
 
         Pointer<SessionInfo> info;
 
-        decaf::util::Map< Pointer<ProducerId>,
-                          Pointer<ProducerState>,
-                          ProducerId::COMPARATOR > producers;
-
-        decaf::util::Map< Pointer<ConsumerId>,
-                          Pointer<ConsumerState>,
-                          ConsumerId::COMPARATOR > consumers;
+        decaf::util::STLMap< Pointer<ProducerId>,
+                             Pointer<ProducerState>,
+                             ProducerId::COMPARATOR > producers;
+
+        decaf::util::STLMap< Pointer<ConsumerId>,
+                             Pointer<ConsumerState>,
+                             ConsumerId::COMPARATOR > consumers;
 
         decaf::util::concurrent::atomic::AtomicBoolean disposed;
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.cpp Tue Feb 10 19:24:55 2009
@@ -31,7 +31,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 TransportRegistry::~TransportRegistry() {
 
-    std::vector<TransportFactory*> factories = this->registry.getValues();
+    std::vector<TransportFactory*> factories = this->registry.values();
 
     std::vector<TransportFactory*>::iterator iter = factories.begin();
 
@@ -51,7 +51,7 @@
             "No Matching Factory Registered for format := %s", name.c_str() );
     }
 
-    return this->registry.getValue( name );
+    return this->registry.get( name );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -69,20 +69,20 @@
             "Supplied TransportFactory pointer was NULL" );
     }
 
-    this->registry.setValue( name, factory );
+    this->registry.put( name, factory );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void TransportRegistry::unregisterFactory( const std::string& name ) {
     if( this->registry.containsKey( name ) ) {
-        delete this->registry.getValue( name );
+        delete this->registry.get( name );
         this->registry.remove( name );
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::vector<std::string> TransportRegistry::getTransportNames() const {
-    return this->registry.getKeys();
+    return this->registry.keySet();
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h Tue Feb 10 19:24:55 2009
@@ -24,7 +24,7 @@
 #include <vector>
 #include <activemq/transport/TransportFactory.h>
 
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
 #include <decaf/lang/exceptions/IllegalArgumentException.h>
@@ -42,7 +42,7 @@
     class AMQCPP_API TransportRegistry {
     private:
 
-        decaf::util::Map<std::string, TransportFactory*> registry;
+        decaf::util::STLMap<std::string, TransportFactory*> registry;
 
     private:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp Tue Feb 10 19:24:55 2009
@@ -33,25 +33,25 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveMap::PrimitiveMap( const decaf::util::Map<std::string, PrimitiveValueNode>& src )
-  : decaf::util::Map<std::string, PrimitiveValueNode>( src ) {
+  : decaf::util::STLMap<std::string, PrimitiveValueNode>( src ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveMap::PrimitiveMap( const PrimitiveMap& src )
-  : decaf::util::Map<std::string, PrimitiveValueNode>( src ) {
+  : decaf::util::STLMap<std::string, PrimitiveValueNode>( src ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::string PrimitiveMap::toString() const {
 
-    std::vector<std::string> keys = this->getKeys();
+    std::vector<std::string> keys = this->keySet();
     ostringstream stream;
 
     stream << "Begin Class PrimitiveMap:" << std::endl;
 
     for( std::size_t i = 0; i < keys.size(); ++i ) {
         stream << "map[" << keys[i] << "] = "
-               << this->getValue( keys[i] ).toString() << std::endl;
+               << this->get( keys[i] ).toString() << std::endl;
     }
 
     stream << "End Class PrimitiveMap:" << std::endl;
@@ -63,7 +63,7 @@
 bool PrimitiveMap::getBool( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getBool();
 }
 
@@ -73,14 +73,14 @@
     PrimitiveValueNode node;
     node.setBool( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 unsigned char PrimitiveMap::getByte( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getByte();
 }
 
@@ -89,14 +89,14 @@
     PrimitiveValueNode node;
     node.setByte( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 char PrimitiveMap::getChar( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getChar();
 }
 
@@ -105,14 +105,14 @@
     PrimitiveValueNode node;
     node.setChar( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 short PrimitiveMap::getShort( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getShort();
 }
 
@@ -121,14 +121,14 @@
     PrimitiveValueNode node;
     node.setShort( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 int PrimitiveMap::getInt( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getInt();
 }
 
@@ -137,14 +137,14 @@
     PrimitiveValueNode node;
     node.setInt( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 long long PrimitiveMap::getLong( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getLong();
 }
 
@@ -153,14 +153,14 @@
     PrimitiveValueNode node;
     node.setLong( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 double PrimitiveMap::getDouble( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getDouble();
 }
 
@@ -169,14 +169,14 @@
     PrimitiveValueNode node;
     node.setDouble( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 float PrimitiveMap::getFloat( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getFloat();
 }
 
@@ -185,14 +185,14 @@
     PrimitiveValueNode node;
     node.setFloat( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 string PrimitiveMap::getString( const string& key ) const
     throw( NoSuchElementException ){
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getString();
 }
 
@@ -201,14 +201,14 @@
     PrimitiveValueNode node;
     node.setString( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::vector<unsigned char> PrimitiveMap::getByteArray( const std::string& key ) const
     throw( decaf::lang::exceptions::NoSuchElementException ) {
 
-    PrimitiveValueNode node = this->getValue( key );
+    PrimitiveValueNode node = this->get( key );
     return node.getByteArray();
 }
 
@@ -219,5 +219,5 @@
     PrimitiveValueNode node;
     node.setByteArray( value );
 
-    this->setValue( key, node );
+    this->put( key, node );
 }

Modified: activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h Tue Feb 10 19:24:55 2009
@@ -22,7 +22,7 @@
 #include <vector>
 #include <activemq/util/Config.h>
 #include <decaf/util/Config.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <activemq/util/PrimitiveValueNode.h>
 
@@ -32,7 +32,7 @@
     /**
      * Map of named primitives.
      */
-    class AMQCPP_API PrimitiveMap : public decaf::util::Map<std::string, PrimitiveValueNode> {
+    class AMQCPP_API PrimitiveMap : public decaf::util::STLMap<std::string, PrimitiveValueNode> {
     public:
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp Tue Feb 10 19:24:55 2009
@@ -19,6 +19,7 @@
 
 #include <activemq/util/PrimitiveList.h>
 #include <activemq/util/PrimitiveMap.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
@@ -439,11 +440,11 @@
 
     clear();
     valueType = MAP_TYPE;
-    value.mapValue = new decaf::util::Map<std::string, PrimitiveValueNode>( lvalue );
+    value.mapValue = new decaf::util::STLMap<std::string, PrimitiveValueNode>( lvalue );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-decaf::util::Map<std::string, PrimitiveValueNode> PrimitiveValueNode::getMap() const
+const decaf::util::Map<std::string, PrimitiveValueNode>& PrimitiveValueNode::getMap() const
     throw( decaf::lang::exceptions::NoSuchElementException ) {
 
     if( valueType != MAP_TYPE ){
@@ -454,7 +455,10 @@
     }
 
     if( value.mapValue == NULL ){
-        return decaf::util::Map<std::string, PrimitiveValueNode>();
+        throw decaf::lang::exceptions::NullPointerException(
+            __FILE__,
+            __LINE__,
+            "PrimitiveValue is not set but an element was placed in the Map" );
     }
 
     return *value.mapValue;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h Tue Feb 10 19:24:55 2009
@@ -416,12 +416,12 @@
         void setMap( const decaf::util::Map<std::string, PrimitiveValueNode>& lvalue );
 
         /**
-         * Gets the Primtive Map value of this Node.
+         * Gets the Primitive Map value of this Node.
          * @return value contained at the given index
          * @throw NoSuchElementException this node cannot be returned as the
          * requested type.
          */
-        decaf::util::Map<std::string, PrimitiveValueNode> getMap() const
+        const decaf::util::Map<std::string, PrimitiveValueNode>& getMap() const
             throw( decaf::lang::exceptions::NoSuchElementException );
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.cpp Tue Feb 10 19:24:55 2009
@@ -31,7 +31,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 WireFormatRegistry::~WireFormatRegistry() {
 
-    std::vector<WireFormatFactory*> factories = this->registry.getValues();
+    std::vector<WireFormatFactory*> factories = this->registry.values();
 
     std::vector<WireFormatFactory*>::iterator iter = factories.begin();
 
@@ -51,7 +51,7 @@
             "No Matching Factory Registered for format := %s", name.c_str() );
     }
 
-    return this->registry.getValue( name );
+    return this->registry.get( name );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -69,20 +69,20 @@
             "Supplied WireFormatFactory pointer was NULL" );
     }
 
-    this->registry.setValue( name, factory );
+    this->registry.put( name, factory );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void WireFormatRegistry::unregisterFactory( const std::string& name ) {
     if( this->registry.containsKey( name ) ) {
-        delete this->registry.getValue( name );
+        delete this->registry.get( name );
         this->registry.remove( name );
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::vector<std::string> WireFormatRegistry::getWireFormatNames() const {
-    return this->registry.getKeys();
+    return this->registry.keySet();
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h Tue Feb 10 19:24:55 2009
@@ -24,7 +24,7 @@
 #include <vector>
 #include <activemq/wireformat/WireFormatFactory.h>
 
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
 #include <decaf/lang/exceptions/IllegalArgumentException.h>
@@ -42,7 +42,7 @@
     class AMQCPP_API WireFormatRegistry {
     private:
 
-        decaf::util::Map<std::string, WireFormatFactory*> registry;
+        decaf::util::STLMap<std::string, WireFormatFactory*> registry;
 
     private:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp Tue Feb 10 19:24:55 2009
@@ -73,7 +73,7 @@
 
             for( int i=0; i < size; i++ ) {
                 std::string key = OpenwireStringSupport::readString( dataIn );
-                map->setValue( key, unmarshalPrimitive( dataIn ) );
+                map->put( key, unmarshalPrimitive( dataIn ) );
             }
 
             return map;
@@ -119,13 +119,13 @@
 
         dataOut.writeInt( (int)map.size() );
 
-        std::vector<std::string> keys = map.getKeys();
+        std::vector<std::string> keys = map.keySet();
         std::vector<std::string>::const_iterator iter = keys.begin();
 
         for(; iter != keys.end(); ++iter ) {
 
             OpenwireStringSupport::writeString( dataOut, &(*iter) );
-            PrimitiveValueNode value = map.getValue( *iter );
+            PrimitiveValueNode value = map.get( *iter );
             marshalPrimitive( dataOut, value );
         }
     }
@@ -255,7 +255,7 @@
         if( size > 0 ) {
             for( int i=0; i < size; i++ ) {
                 std::string key = OpenwireStringSupport::readString( dataIn );
-                map.setValue( key, unmarshalPrimitive( dataIn ) );
+                map.put( key, unmarshalPrimitive( dataIn ) );
             }
         }
     }

Modified: activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp Tue Feb 10 19:24:55 2009
@@ -22,6 +22,7 @@
 #include <decaf/lang/exceptions/RuntimeException.h>
 #include <decaf/util/Date.h>
 #include <decaf/util/StringTokenizer.h>
+#include <decaf/util/STLMap.h>
 #include <apr.h>
 #include <apr_errno.h>
 #include <apr_env.h>
@@ -131,9 +132,11 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-Map<string, string> System::getenv() throw ( Exception ) {
+const Map<string, string>& System::getenv() throw ( Exception ) {
+
+    static STLMap<string, string> values;
+    values.clear();
 
-    Map<string, string> values;
     StringTokenizer tokenizer( "" );
     string key = "";
     string value = "";
@@ -168,7 +171,7 @@
         }
 
         // Store the env var
-        values.setValue( key, value );
+        values.put( key, value );
     }
 
     return values;

Modified: activemq/activemq-cpp/trunk/src/main/decaf/lang/System.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/lang/System.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/lang/System.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/lang/System.h Tue Feb 10 19:24:55 2009
@@ -41,7 +41,7 @@
          * @return A Map of all environment variables.
          * @throw Exception if an error occurs
          */
-        static util::Map<std::string, std::string> getenv()
+        static const util::Map<std::string, std::string>& getenv()
             throw ( lang::Exception );
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h Tue Feb 10 19:24:55 2009
@@ -18,7 +18,6 @@
 #ifndef _DECAF_UTIL_MAP_H_
 #define _DECAF_UTIL_MAP_H_
 
-#include <map>
 #include <vector>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
@@ -32,12 +31,29 @@
      * a more user-friendly interface and to provide common
      * functions that do not exist in std::map.
      */
-    template <typename K, typename V, typename COMPARE = std::less<K> > class Map :
+    template <typename K, typename V, typename COMPARATOR = std::less<K> > class Map :
         public concurrent::Synchronizable {
-    private:
+    public:
+
+        template< typename K1, typename V1>
+        class Entry {
+        private:
+
+            K1 key;
+            V1 value;
+
+        public:
+
+            Entry() {}
+            virtual ~Entry() {}
+
+            const K1& getKey() const;
 
-        std::map<K,V, COMPARE> valueMap;
-        concurrent::Mutex mutex;
+            const V1& getValue() const;
+
+            void setValue( const V1& value );
+
+        };
 
     public:
 
@@ -46,47 +62,27 @@
          */
         Map() {}
 
-        /**
-         * Copy constructor - copies the content of the given map into this
-         * one.
-         * @param source The source map.
-         */
-        Map( const Map& source ) : concurrent::Synchronizable() {
-            copy( source );
-        }
-
         virtual ~Map() {}
 
         /**
-         * Comparison, equality is dependant on the method of determining
+         * Comparison, equality is dependent on the method of determining
          * if the element are equal.
          * @param source - Map to compare to this one.
          * @returns true if the Map passed is equal in value to this one.
          */
-        virtual bool equals( const Map& source ) const {
-            return this->valueMap == source.valueMap;
-        }
+        virtual bool equals( const Map& source ) const = 0;
 
         /**
          * Copies the content of the source map into this map.  Erases
          * all existing data in this map.
          * @param source The source object to copy from.
          */
-        virtual void copy( const Map& source ) {
-
-            // Erase the content of this object, and copy from the source
-            // all the elements.  We access source's private map since we
-            // are also a Map, this saves us a lot of time.
-            valueMap.clear();
-            valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
-        }
+        virtual void copy( const Map& source ) = 0;
 
         /**
          * Removes all keys and values from this map.
          */
-        virtual void clear() {
-            valueMap.clear();
-        }
+        virtual void clear() = 0;
 
         /**
          * Indicates whether or this map contains a value for the
@@ -94,11 +90,7 @@
          * @param key The key to look up.
          * @return true if this map contains the value, otherwise false.
          */
-        virtual bool containsKey( const K& key ) const {
-            typename std::map<K,V,COMPARE>::const_iterator iter;
-            iter = valueMap.find(key);
-            return iter != valueMap.end();
-        }
+        virtual bool containsKey( const K& key ) const = 0;
 
         /**
          * Indicates whether or this map contains a value for the
@@ -107,165 +99,58 @@
          * @param value The Value to look up.
          * @return true if this map contains the value, otherwise false.
          */
-        virtual bool containsValue( const V& value ) const {
-
-            if( valueMap.empty() ){
-                return false;
-            }
-
-            typename std::map<K,V,COMPARE>::const_iterator iter = valueMap.begin();
-            for( ; iter != valueMap.end(); ++iter ){
-                if( (*iter).second == value ) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
+        virtual bool containsValue( const V& value ) const = 0;
 
         /**
          * @return if the Map contains any element or not, TRUE or FALSE
          */
-        virtual bool isEmpty() const {
-            return valueMap.empty();
-        }
+        virtual bool isEmpty() const = 0;
 
         /**
          * @return The number of elements (key/value pairs) in this map.
          */
-        virtual std::size_t size() const {
-            return valueMap.size();
-        }
+        virtual std::size_t size() const = 0;
 
         /**
          * Gets the value for the specified key.
          * @param key The search key.
          * @return The value for the given key.
-         * @throws activemq::exceptions::NoSuchElementException
+         * @throws NoSuchElementException
          */
-        virtual V getValue( const K& key ) const
-            throw( lang::exceptions::NoSuchElementException ) {
-
-            typename std::map<K,V,COMPARE>::const_iterator iter;
-            iter = valueMap.find(key);
-            if( iter == valueMap.end() ){
-                throw lang::exceptions::NoSuchElementException( __FILE__,
-                    __LINE__,
-                    "Key does not exist in map" );
-            }
-
-            return iter->second;
-        }
+        virtual V get( const K& key ) const
+            throw( lang::exceptions::NoSuchElementException ) = 0;
 
         /**
          * Sets the value for the specified key.
          * @param key The target key.
          * @param value The value to be set.
          */
-        virtual void setValue( const K& key, V value ) {
-            valueMap[key] = value;
-        }
+        virtual void put( const K& key, V value ) = 0;
+
+        /**
+         * Stores a copy of the Mappings contained in the other Map in this one.
+         * @param key The target key.
+         * @param value The value to be set.
+         */
+        virtual void putAll( const Map<K,V,COMPARATOR>& other ) = 0;
 
         /**
          * Removes the value (key/value pair) for the specified key from
          * the map.
          * @param key The search key.
          */
-        virtual void remove( const K& key ) {
-            valueMap.erase( key );
-        }
+        virtual void remove( const K& key ) = 0;
 
         /**
          * @return the entire set of keys in this map as a std::vector.
          */
-        virtual std::vector<K> getKeys() const{
-            std::vector<K> keys( valueMap.size() );
-
-            typename std::map<K,V,COMPARE>::const_iterator iter;
-            iter=valueMap.begin();
-            for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
-                keys[ix] = iter->first;
-            }
-
-            return keys;
-        }
+        virtual std::vector<K> keySet() const = 0;
 
         /**
          * @return the entire set of values in this map as a std::vector.
          */
-        virtual std::vector<V> getValues() const {
-            std::vector<V> values( valueMap.size() );
-
-            typename std::map<K,V,COMPARE>::const_iterator iter;
-            iter=valueMap.begin();
-            for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
-                values[ix] = iter->second;
-            }
-
-            return values;
-        }
+        virtual std::vector<V> values() const = 0;
 
-    public:     // Methods from Synchronizable
-
-        /**
-         * Locks the object.
-         * @throws ActiveMQException
-         */
-        virtual void lock() throw( lang::Exception ) {
-            mutex.lock();
-        }
-
-        /**
-         * Unlocks the object.
-         * @throws ActiveMQException
-         */
-        virtual void unlock() throw( lang::Exception ) {
-            mutex.unlock();
-        }
-
-        /**
-         * Waits on a signal from this object, which is generated
-         * by a call to Notify.  Must have this object locked before
-         * calling.
-         * @throws ActiveMQException
-         */
-        virtual void wait() throw( lang::Exception ) {
-            mutex.wait();
-        }
-
-        /**
-         * Waits on a signal from this object, which is generated
-         * by a call to Notify.  Must have this object locked before
-         * calling.  This wait will timeout after the specified time
-         * interval.
-         * @param millisecs the time in millisecsonds to wait, or
-         * WAIT_INIFINITE
-         * @throws ActiveMQException
-         */
-        virtual void wait( unsigned long millisecs )
-            throw( lang::Exception ) {
-            mutex.wait(millisecs);
-        }
-
-        /**
-         * Signals a waiter on this object that it can now wake
-         * up and continue.  Must have this object locked before
-         * calling.
-         * @throws ActiveMQException
-         */
-        virtual void notify() throw( lang::Exception ) {
-            mutex.notify();
-        }
-
-        /**
-         * Signals the waiters on this object that it can now wake
-         * up and continue.  Must have this object locked before
-         * calling.
-         * @throws ActiveMQException
-         */
-        virtual void notifyAll() throw( lang::Exception ) {
-            mutex.notifyAll();
-        }
     };
 
 }}

Copied: activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h (from r740944, activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h?p2=activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h&p1=activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h&r1=740944&r2=743068&rev=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Map.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h Tue Feb 10 19:24:55 2009
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-#ifndef _DECAF_UTIL_MAP_H_
-#define _DECAF_UTIL_MAP_H_
+#ifndef _DECAF_UTIL_STLMAP_H_
+#define _DECAF_UTIL_STLMAP_H_
 
 #include <map>
 #include <vector>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
 #include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Map.h>
 
 namespace decaf{
 namespace util{
@@ -32,11 +33,11 @@
      * a more user-friendly interface and to provide common
      * functions that do not exist in std::map.
      */
-    template <typename K, typename V, typename COMPARE = std::less<K> > class Map :
-        public concurrent::Synchronizable {
+    template <typename K, typename V, typename COMPARATOR = std::less<K> > class STLMap :
+        public Map<K, V, COMPARATOR> {
     private:
 
-        std::map<K,V, COMPARE> valueMap;
+        std::map<K,V,COMPARATOR> valueMap;
         concurrent::Mutex mutex;
 
     public:
@@ -44,41 +45,68 @@
         /**
          * Default constructor - does nothing.
          */
-        Map() {}
+        STLMap() : Map<K,V,COMPARATOR>() {}
 
         /**
          * Copy constructor - copies the content of the given map into this
          * one.
          * @param source The source map.
          */
-        Map( const Map& source ) : concurrent::Synchronizable() {
+        STLMap( const STLMap& source ) : Map<K,V,COMPARATOR>() {
             copy( source );
         }
 
-        virtual ~Map() {}
+        /**
+         * Copy constructor - copies the content of the given map into this
+         * one.
+         * @param source The source map.
+         */
+        STLMap( const Map<K,V,COMPARATOR>& source ) : Map<K,V,COMPARATOR>() {
+            copy( source );
+        }
+
+        virtual ~STLMap() {}
 
         /**
-         * Comparison, equality is dependant on the method of determining
+         * Comparison, equality is dependent on the method of determining
          * if the element are equal.
          * @param source - Map to compare to this one.
          * @returns true if the Map passed is equal in value to this one.
          */
-        virtual bool equals( const Map& source ) const {
+        virtual bool equals( const STLMap& source ) const {
             return this->valueMap == source.valueMap;
         }
 
+        virtual bool equals( const Map<K,V,COMPARATOR>& source ) const {
+            std::vector<K> keys = source.keySet();
+
+            typename std::vector<K>::const_iterator iter = keys.begin();
+            for( ; iter != keys.end(); ++iter ) {
+                if( !this->containsKey( *iter ) ) {
+                    return false;
+                }
+
+                if( !( this->get( *iter ) == source.get( *iter ) ) ) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
         /**
          * Copies the content of the source map into this map.  Erases
          * all existing data in this map.
          * @param source The source object to copy from.
          */
-        virtual void copy( const Map& source ) {
+        virtual void copy( const STLMap& source ) {
+            this->valueMap.clear();
+            this->valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
+        }
 
-            // Erase the content of this object, and copy from the source
-            // all the elements.  We access source's private map since we
-            // are also a Map, this saves us a lot of time.
-            valueMap.clear();
-            valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
+        virtual void copy( const Map<K,V,COMPARATOR>& source ) {
+            this->clear();
+            this->putAll( source );
         }
 
         /**
@@ -95,7 +123,7 @@
          * @return true if this map contains the value, otherwise false.
          */
         virtual bool containsKey( const K& key ) const {
-            typename std::map<K,V,COMPARE>::const_iterator iter;
+            typename std::map<K,V,COMPARATOR>::const_iterator iter;
             iter = valueMap.find(key);
             return iter != valueMap.end();
         }
@@ -113,7 +141,7 @@
                 return false;
             }
 
-            typename std::map<K,V,COMPARE>::const_iterator iter = valueMap.begin();
+            typename std::map<K,V,COMPARATOR>::const_iterator iter = valueMap.begin();
             for( ; iter != valueMap.end(); ++iter ){
                 if( (*iter).second == value ) {
                     return true;
@@ -141,17 +169,16 @@
          * Gets the value for the specified key.
          * @param key The search key.
          * @return The value for the given key.
-         * @throws activemq::exceptions::NoSuchElementException
+         * @throws NoSuchElementException
          */
-        virtual V getValue( const K& key ) const
+        virtual V get( const K& key ) const
             throw( lang::exceptions::NoSuchElementException ) {
 
-            typename std::map<K,V,COMPARE>::const_iterator iter;
+            typename std::map<K,V,COMPARATOR>::const_iterator iter;
             iter = valueMap.find(key);
             if( iter == valueMap.end() ){
-                throw lang::exceptions::NoSuchElementException( __FILE__,
-                    __LINE__,
-                    "Key does not exist in map" );
+                throw lang::exceptions::NoSuchElementException(
+                    __FILE__, __LINE__, "Key does not exist in map" );
             }
 
             return iter->second;
@@ -162,11 +189,29 @@
          * @param key The target key.
          * @param value The value to be set.
          */
-        virtual void setValue( const K& key, V value ) {
+        virtual void put( const K& key, V value ) {
             valueMap[key] = value;
         }
 
         /**
+         * Stores a copy of the Mappings contained in the other Map in this one.
+         * @param key The target key.
+         * @param value The value to be set.
+         */
+        virtual void putAll( const STLMap<K,V,COMPARATOR>& other ) {
+            this->valueMap.insert( other.valueMap.begin(), other.valueMap.end() );
+        }
+        virtual void putAll( const Map<K,V,COMPARATOR>& other ) {
+            std::vector<K> keys = other.keySet();
+
+            typename std::vector<K>::const_iterator iter = keys.begin();
+            for( ; iter != keys.end(); ++iter ) {
+
+                this->put( *iter, other.get( *iter ) );
+            }
+        }
+
+        /**
          * Removes the value (key/value pair) for the specified key from
          * the map.
          * @param key The search key.
@@ -178,10 +223,10 @@
         /**
          * @return the entire set of keys in this map as a std::vector.
          */
-        virtual std::vector<K> getKeys() const{
+        virtual std::vector<K> keySet() const{
             std::vector<K> keys( valueMap.size() );
 
-            typename std::map<K,V,COMPARE>::const_iterator iter;
+            typename std::map<K,V,COMPARATOR>::const_iterator iter;
             iter=valueMap.begin();
             for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
                 keys[ix] = iter->first;
@@ -193,10 +238,10 @@
         /**
          * @return the entire set of values in this map as a std::vector.
          */
-        virtual std::vector<V> getValues() const {
+        virtual std::vector<V> values() const {
             std::vector<V> values( valueMap.size() );
 
-            typename std::map<K,V,COMPARE>::const_iterator iter;
+            typename std::map<K,V,COMPARATOR>::const_iterator iter;
             iter=valueMap.begin();
             for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
                 values[ix] = iter->second;
@@ -238,7 +283,7 @@
          * by a call to Notify.  Must have this object locked before
          * calling.  This wait will timeout after the specified time
          * interval.
-         * @param millisecs the time in millisecsonds to wait, or
+         * @param millisecs the time in milliseconds to wait, or
          * WAIT_INIFINITE
          * @throws ActiveMQException
          */
@@ -270,4 +315,4 @@
 
 }}
 
-#endif /*_DECAF_UTIL_MAP_H_*/
+#endif /*_DECAF_UTIL_STLMAP_H_*/

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/PrimitiveMapBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/PrimitiveMapBenchmark.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/PrimitiveMapBenchmark.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/activemq/util/PrimitiveMapBenchmark.cpp Tue Feb 10 19:24:55 2009
@@ -102,8 +102,8 @@
     }
 
     for( int i = 0; i < numRuns; ++i ){
-        map.getKeys();
-        map.getValues();
+        map.keySet();
+        map.values();
     }
 
     for( int i = 0; i < numRuns; ++i ){

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.cpp Tue Feb 10 19:24:55 2009
@@ -17,6 +17,7 @@
 
 #include "MapBenchmark.h"
 #include <decaf/lang/Integer.h>
+#include <decaf/util/STLMap.h>
 
 using namespace decaf;
 using namespace decaf::util;
@@ -32,12 +33,12 @@
     int numRuns = 500;
     std::string test = "test";
     std::string resultStr = "";
-    Map<std::string, std::string> stringCopy;
-    Map<int, int> intCopy;
+    STLMap<std::string, std::string> stringCopy;
+    STLMap<int, int> intCopy;
 
     for( int i = 0; i < numRuns; ++i ) {
-        stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) );
-        intMap.setValue( 100 + i, 100 + i );
+        stringMap.put( test + Integer::toString(i), test + Integer::toString(i) );
+        intMap.put( 100 + i, 100 + i );
         stringMap.containsKey( test + Integer::toString(i) );
         intMap.containsKey( 100 + i );
         stringMap.containsValue( test + Integer::toString(i) );
@@ -52,18 +53,18 @@
     }
 
     for( int i = 0; i < numRuns; ++i ) {
-        stringMap.setValue( test + Integer::toString(i), test + Integer::toString(i) );
-        intMap.setValue( 100 + i, 100 + i );
+        stringMap.put( test + Integer::toString(i), test + Integer::toString(i) );
+        intMap.put( 100 + i, 100 + i );
     }
 
     std::vector<std::string> stringVec;
     std::vector<int> intVec;
 
     for( int i = 0; i < numRuns / 2; ++i ) {
-        stringVec = stringMap.getKeys();
-        stringVec = stringMap.getValues();
-        intVec = intMap.getKeys();
-        intVec = intMap.getValues();
+        stringVec = stringMap.keySet();
+        stringVec = stringMap.values();
+        intVec = intMap.keySet();
+        intVec = intMap.values();
     }
 
     for( int i = 0; i < numRuns / 2; ++i ) {

Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/MapBenchmark.h Tue Feb 10 19:24:55 2009
@@ -19,7 +19,7 @@
 #define _DECAF_UTIL_MAPBENCHMARK_H_
 
 #include <benchmark/BenchmarkBase.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 
 namespace decaf{
 namespace util{
@@ -30,8 +30,8 @@
     {
     private:
 
-        Map< std::string, std::string> stringMap;
-        Map<int, int> intMap;
+        STLMap< std::string, std::string> stringMap;
+        STLMap<int, int> intMap;
 
     public:
 

Modified: activemq/activemq-cpp/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/Makefile.am?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test/Makefile.am Tue Feb 10 19:24:55 2009
@@ -99,6 +99,7 @@
   decaf/util/UUIDTest.cpp \
   decaf/util/RandomTest.cpp \
   decaf/util/MapTest.cpp \
+  decaf/util/STLMapTest.cpp \
   decaf/util/QueueTest.cpp \
   decaf/util/ListTest.cpp \
   decaf/util/SetTest.cpp \
@@ -198,6 +199,7 @@
   decaf/util/RandomTest.h \
   decaf/util/ListTest.h \
   decaf/util/MapTest.h \
+  decaf/util/STLMapTest.h \
   decaf/util/QueueTest.h \
   decaf/util/SetTest.h \
   decaf/util/concurrent/CountDownLatchTest.h \

Modified: activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp Tue Feb 10 19:24:55 2009
@@ -18,7 +18,7 @@
 #include "BrokerIdTest.h"
 
 #include <activemq/commands/BrokerId.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 #include <decaf/lang/Pointer.h>
 #include <decaf/lang/Comparable.h>
 
@@ -66,15 +66,15 @@
     myCommand2.setValue( "B" );
     myCommand3.setValue( "C" );
 
-    Map< BrokerId*, int, BrokerIdComparitor > testMap;
+    STLMap< BrokerId*, int, BrokerIdComparitor > testMap;
 
-    testMap.setValue( &myCommand1, 0 );
-    testMap.setValue( &myCommand3, 0 );
-    testMap.setValue( &myCommand2, 0 );
-
-    CPPUNIT_ASSERT( testMap.getKeys().at( 0 )->getValue() == "A" );
-    CPPUNIT_ASSERT( testMap.getKeys().at( 1 )->getValue() == "B" );
-    CPPUNIT_ASSERT( testMap.getKeys().at( 2 )->getValue() == "C" );
+    testMap.put( &myCommand1, 0 );
+    testMap.put( &myCommand3, 0 );
+    testMap.put( &myCommand2, 0 );
+
+    CPPUNIT_ASSERT( testMap.keySet().at( 0 )->getValue() == "A" );
+    CPPUNIT_ASSERT( testMap.keySet().at( 1 )->getValue() == "B" );
+    CPPUNIT_ASSERT( testMap.keySet().at( 2 )->getValue() == "C" );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -93,15 +93,15 @@
     CPPUNIT_ASSERT( myCommand1->compareTo( *myCommand2 ) == 0 );
     CPPUNIT_ASSERT( myCommand1->compareTo( *myCommand3 ) == -1 );
 
-    Map< Pointer<BrokerId>, int, COMPARATOR > testMap;
+    STLMap< Pointer<BrokerId>, int, COMPARATOR > testMap;
 
-    testMap.setValue( myCommand3, 0 );
-    testMap.setValue( myCommand1, 0 );
+    testMap.put( myCommand3, 0 );
+    testMap.put( myCommand1, 0 );
     CPPUNIT_ASSERT( testMap.size() == 2 );
 
-    testMap.setValue( myCommand2, 0 );
+    testMap.put( myCommand2, 0 );
     CPPUNIT_ASSERT( testMap.size() == 2 );
 
-    CPPUNIT_ASSERT( testMap.getKeys().at( 0 )->getValue() == "A" );
-    CPPUNIT_ASSERT( testMap.getKeys().at( 1 )->getValue() == "C" );
+    CPPUNIT_ASSERT( testMap.keySet().at( 0 )->getValue() == "A" );
+    CPPUNIT_ASSERT( testMap.keySet().at( 1 )->getValue() == "C" );
 }

Modified: activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveListTest.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveListTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveListTest.cpp Tue Feb 10 19:24:55 2009
@@ -298,8 +298,8 @@
     list.add( map2 );
     list.add( map3 );
 
-    CPPUNIT_ASSERT( list.get(0).getMap().getValue("1").getInt() == 1 );
-    CPPUNIT_ASSERT( list.get(1).getMap().getValue("2").getInt() == 2 );
-    CPPUNIT_ASSERT( list.get(2).getMap().getValue("3").getInt() == 3 );
+    CPPUNIT_ASSERT( list.get(0).getMap().get("1").getInt() == 1 );
+    CPPUNIT_ASSERT( list.get(1).getMap().get("2").getInt() == 2 );
+    CPPUNIT_ASSERT( list.get(2).getMap().get("3").getInt() == 3 );
 
 }

Modified: activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveMapTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveMapTest.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveMapTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/util/PrimitiveMapTest.cpp Tue Feb 10 19:24:55 2009
@@ -265,7 +265,7 @@
     pmap.setInt("int", 5 );
     pmap.setFloat( "float", 5.5f );
     pmap.setInt("int2", 6 );
-    std::vector<std::string> keys = pmap.getKeys();
+    std::vector<std::string> keys = pmap.keySet();
 
     CPPUNIT_ASSERT( keys.size() == 3 );
     CPPUNIT_ASSERT( keys[0] == "int" || keys[0] == "float" || keys[0] == "int2" );

Modified: activemq/activemq-cpp/trunk/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp Tue Feb 10 19:24:55 2009
@@ -101,9 +101,9 @@
     list2.add( 2 );
     list3.add( 3 );
 
-    myMap.setValue( "1", list1 );
-    myMap.setValue( "2", list2 );
-    myMap.setValue( "3", list3 );
+    myMap.put( "1", list1 );
+    myMap.put( "2", list2 );
+    myMap.put( "3", list3 );
 
     std::vector<unsigned char> marshaled;
 
@@ -134,13 +134,13 @@
     PrimitiveMap map2;
     PrimitiveMap map3;
 
-    map1.setValue( "1", 1 );
-    map2.setValue( "2", 2 );
-    map3.setValue( "3", 3 );
-
-    myMap.setValue( "1", map1 );
-    myMap.setValue( "2", map2 );
-    myMap.setValue( "3", map3 );
+    map1.put( "1", 1 );
+    map2.put( "2", 2 );
+    map3.put( "3", 3 );
+
+    myMap.put( "1", map1 );
+    myMap.put( "2", map2 );
+    myMap.put( "3", map3 );
 
     std::vector<unsigned char> marshaled;
 

Modified: activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp Tue Feb 10 19:24:55 2009
@@ -18,7 +18,7 @@
 #include "SystemTest.h"
 
 #include <decaf/lang/System.h>
-#include <decaf/util/Map.h>
+#include <decaf/util/STLMap.h>
 
 using namespace std;
 using namespace decaf;
@@ -44,7 +44,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 void SystemTest::test_getenv2() {
 
-    Map<std::string, std::string> values = System::getenv();
+    STLMap<std::string, std::string> values = System::getenv();
 
     CPPUNIT_ASSERT( values.size() != 0 );
     CPPUNIT_ASSERT( values.containsKey( "PATH" ) || values.containsKey( "Path" ) );
@@ -54,10 +54,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 void SystemTest::test_setenv() {
 
-    Map<std::string, std::string> values1 = System::getenv();
+    STLMap<std::string, std::string> values1 = System::getenv();
     CPPUNIT_ASSERT( !values1.containsKey( "PATH_ASDFGHJKL" ) );
     System::setenv( "PATH_ASDFGHJKL", "test" );
-    Map<std::string, std::string> values2 = System::getenv();
+    STLMap<std::string, std::string> values2 = System::getenv();
     CPPUNIT_ASSERT( values2.containsKey( "PATH_ASDFGHJKL" ) );
     System::unsetenv( "PATH_ASDFGHJKL" );
 }
@@ -65,13 +65,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 void SystemTest::test_unsetenv() {
 
-    Map<std::string, std::string> values1 = System::getenv();
+    STLMap<std::string, std::string> values1 = System::getenv();
     CPPUNIT_ASSERT( !values1.containsKey( "PATH_ASDFGHJKL" ) );
     System::setenv( "PATH_ASDFGHJKL", "test" );
-    Map<std::string, std::string> values2 = System::getenv();
+    STLMap<std::string, std::string> values2 = System::getenv();
     CPPUNIT_ASSERT( values2.containsKey( "PATH_ASDFGHJKL" ) );
     System::unsetenv( "PATH_ASDFGHJKL" );
-    Map<std::string, std::string> values3 = System::getenv();
+    STLMap<std::string, std::string> values3 = System::getenv();
     CPPUNIT_ASSERT( !values3.containsKey( "PATH_ASDFGHJKL" ) );
 }
 

Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp Tue Feb 10 19:24:55 2009
@@ -17,6 +17,7 @@
 
 #include "MapTest.h"
 #include <string>
+#include <decaf/util/STLMap.h>
 
 using namespace std;
 using namespace decaf;
@@ -33,10 +34,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testContainsKey(){
 
-    Map<string, bool> boolMap;
+    STLMap<string, bool> boolMap;
     CPPUNIT_ASSERT(boolMap.containsKey("bob") == false);
 
-    boolMap.setValue( "bob", true );
+    boolMap.put( "bob", true );
 
     CPPUNIT_ASSERT(boolMap.containsKey("bob") == true );
     CPPUNIT_ASSERT(boolMap.containsKey("fred") == false );
@@ -45,9 +46,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testClear(){
 
-    Map<string, bool> boolMap;
-    boolMap.setValue( "bob", true );
-    boolMap.setValue( "fred", true );
+    STLMap<string, bool> boolMap;
+    boolMap.put( "bob", true );
+    boolMap.put( "fred", true );
 
     CPPUNIT_ASSERT(boolMap.size() == 2 );
     boolMap.clear();
@@ -57,9 +58,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testIsEmpty(){
 
-    Map<string, bool> boolMap;
-    boolMap.setValue( "bob", true );
-    boolMap.setValue( "fred", true );
+    STLMap<string, bool> boolMap;
+    boolMap.put( "bob", true );
+    boolMap.put( "fred", true );
 
     CPPUNIT_ASSERT(boolMap.isEmpty() == false );
     boolMap.clear();
@@ -69,29 +70,29 @@
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testSize(){
 
-    Map<string, bool> boolMap;
+    STLMap<string, bool> boolMap;
 
     CPPUNIT_ASSERT(boolMap.size() == 0 );
-    boolMap.setValue( "bob", true );
+    boolMap.put( "bob", true );
     CPPUNIT_ASSERT(boolMap.size() == 1 );
-    boolMap.setValue( "fred", true );
+    boolMap.put( "fred", true );
     CPPUNIT_ASSERT(boolMap.size() == 2 );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testValue(){
 
-    Map<string, bool> boolMap;
+    STLMap<string, bool> boolMap;
 
-    boolMap.setValue( "fred", true );
-    CPPUNIT_ASSERT( boolMap.getValue("fred") == true );
+    boolMap.put( "fred", true );
+    CPPUNIT_ASSERT( boolMap.get("fred") == true );
 
-    boolMap.setValue( "bob", false );
-    CPPUNIT_ASSERT( boolMap.getValue("bob") == false );
-    CPPUNIT_ASSERT( boolMap.getValue("fred") == true );
+    boolMap.put( "bob", false );
+    CPPUNIT_ASSERT( boolMap.get("bob") == false );
+    CPPUNIT_ASSERT( boolMap.get("fred") == true );
 
     try{
-        boolMap.getValue( "mike" );
+        boolMap.get( "mike" );
         CPPUNIT_ASSERT(false);
     } catch( decaf::lang::exceptions::NoSuchElementException& e ){
     }
@@ -99,9 +100,9 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testRemove(){
-    Map<string, bool> boolMap;
+    STLMap<string, bool> boolMap;
 
-    boolMap.setValue( "fred", true );
+    boolMap.put( "fred", true );
     CPPUNIT_ASSERT( boolMap.containsKey("fred") == true );
     boolMap.remove( "fred" );
     CPPUNIT_ASSERT( boolMap.containsKey("fred") == false );
@@ -109,10 +110,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void MapTest::testContiansValue(){
-    Map<string, bool> boolMap;
+    STLMap<string, bool> boolMap;
 
-    boolMap.setValue( "fred", true );
-    boolMap.setValue( "fred1", false );
+    boolMap.put( "fred", true );
+    boolMap.put( "fred1", false );
     CPPUNIT_ASSERT( boolMap.containsValue(true) == true );
     boolMap.remove( "fred" );
     CPPUNIT_ASSERT( boolMap.containsValue(true) == false );

Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.h?rev=743068&r1=743067&r2=743068&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.h Tue Feb 10 19:24:55 2009
@@ -18,14 +18,12 @@
 #ifndef _DECAF_UTIL_MAPTEST_H_
 #define _DECAF_UTIL_MAPTEST_H_
 
-#include <decaf/util/Map.h>
-
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
 namespace decaf{
 namespace util{
-    
+
     class MapTest : public CppUnit::TestFixture
     {
         CPPUNIT_TEST_SUITE( MapTest );
@@ -37,11 +35,11 @@
         CPPUNIT_TEST( testContiansValue );
         CPPUNIT_TEST( testIsEmpty );
         CPPUNIT_TEST_SUITE_END();
-        
+
     public:
-    	MapTest();
-    	virtual ~MapTest();
-        
+        MapTest();
+        virtual ~MapTest();
+
         void testContainsKey();
         void testClear();
         void testSize();
@@ -49,7 +47,7 @@
         void testRemove();
         void testContiansValue();
         void testIsEmpty();
-        
+
     };
 
 }}

Added: activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp?rev=743068&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp (added)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp Tue Feb 10 19:24:55 2009
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 "STLMapTest.h"
+
+#include <string>
+#include <decaf/util/STLMap.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+
+template <typename K, typename V, typename COMPARATOR = std::less<K> > class STLTestMap :
+    public Map<K, V, COMPARATOR> {
+private:
+
+    std::map<K,V,COMPARATOR> valueMap;
+
+public:
+
+    STLTestMap() : Map<K,V,COMPARATOR>() {}
+
+    STLTestMap( const STLTestMap& source ) : Map<K,V,COMPARATOR>() {
+        copy( source );
+    }
+
+    STLTestMap( const Map<K,V,COMPARATOR>& source ) : Map<K,V,COMPARATOR>() {
+        copy( source );
+    }
+
+    virtual ~STLTestMap() {}
+
+    virtual bool equals( const STLTestMap& source ) const {
+        return this->valueMap == source.valueMap;
+    }
+    virtual bool equals( const Map<K,V,COMPARATOR>& source DECAF_UNUSED ) const {
+        return false; // TODO - this->valueMap == source.valueMap;
+    }
+
+    virtual void copy( const STLTestMap& source ) {
+        valueMap.clear();
+        valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
+    }
+    virtual void copy( const Map<K,V,COMPARATOR>& source DECAF_UNUSED ) {
+        // TODO
+    }
+
+    virtual void clear() {
+        valueMap.clear();
+    }
+
+    virtual bool containsKey( const K& key ) const {
+        typename std::map<K,V,COMPARATOR>::const_iterator iter;
+        iter = valueMap.find(key);
+        return iter != valueMap.end();
+    }
+
+    virtual bool containsValue( const V& value ) const {
+
+        if( valueMap.empty() ){
+            return false;
+        }
+
+        typename std::map<K,V,COMPARATOR>::const_iterator iter = valueMap.begin();
+        for( ; iter != valueMap.end(); ++iter ){
+            if( (*iter).second == value ) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    virtual bool isEmpty() const {
+        return valueMap.empty();
+    }
+
+    virtual std::size_t size() const {
+        return valueMap.size();
+    }
+
+    virtual V get( const K& key ) const
+        throw( lang::exceptions::NoSuchElementException ) {
+
+        typename std::map<K,V,COMPARATOR>::const_iterator iter;
+        iter = valueMap.find(key);
+        if( iter == valueMap.end() ){
+            throw lang::exceptions::NoSuchElementException(
+                __FILE__, __LINE__, "Key does not exist in map" );
+        }
+
+        return iter->second;
+    }
+
+    virtual void put( const K& key, V value ) {
+        valueMap[key] = value;
+    }
+
+    virtual void putAll( const STLMap<K,V,COMPARATOR>& other DECAF_UNUSED ) {
+        // TODO
+    }
+    virtual void putAll( const Map<K,V,COMPARATOR>& other DECAF_UNUSED ) {
+        // TODO
+    }
+
+    virtual void remove( const K& key ) {
+        valueMap.erase( key );
+    }
+
+    virtual std::vector<K> keySet() const{
+        std::vector<K> keys( valueMap.size() );
+
+        typename std::map<K,V,COMPARATOR>::const_iterator iter;
+        iter=valueMap.begin();
+        for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
+            keys[ix] = iter->first;
+        }
+
+        return keys;
+    }
+
+    virtual std::vector<V> values() const {
+        std::vector<V> values( valueMap.size() );
+
+        typename std::map<K,V,COMPARATOR>::const_iterator iter;
+        iter=valueMap.begin();
+        for( int ix=0; iter != valueMap.end(); ++iter, ++ix ){
+            values[ix] = iter->second;
+        }
+
+        return values;
+    }
+
+public:
+
+    virtual void lock() throw( lang::Exception ) {
+    }
+    virtual void unlock() throw( lang::Exception ) {
+    }
+    virtual void wait() throw( lang::Exception ) {
+    }
+    virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
+    }
+    virtual void notify() throw( lang::Exception ) {
+    }
+    virtual void notifyAll() throw( lang::Exception ) {
+    }
+};
+
+////////////////////////////////////////////////////////////////////////////////
+void STLMapTest::testConstructor() {
+
+    STLMap<string, int> map1;
+    CPPUNIT_ASSERT( map1.isEmpty() );
+    CPPUNIT_ASSERT( map1.size() == 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should Throw a NoSuchElementException",
+        map1.get( "TEST" ),
+        decaf::lang::exceptions::NoSuchElementException );
+
+    STLMap<string, int> destMap;
+    STLTestMap<string, int> srcMap;
+
+    srcMap.put( "A", 1 );
+    srcMap.put( "B", 1 );
+    srcMap.put( "C", 1 );
+
+    CPPUNIT_ASSERT( srcMap.size() == 3 );
+    CPPUNIT_ASSERT( destMap.size() == 0 );
+
+    destMap.copy( srcMap );
+    CPPUNIT_ASSERT( srcMap.size() == 3 );
+    CPPUNIT_ASSERT( destMap.size() == 3 );
+
+    STLTestMap<string, int> srcMap2;
+    srcMap2.put( "D", 1 );
+    srcMap2.put( "E", 1 );
+    srcMap2.put( "F", 1 );
+
+    destMap.putAll( srcMap2 );
+    CPPUNIT_ASSERT( destMap.size() == 6 );
+
+}

Propchange: activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message