activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r743923 [1/3] - in /activemq/activemq-cpp/trunk/src: main/ main/activemq/cmsutil/ main/activemq/core/ main/activemq/state/ main/activemq/transport/ main/activemq/transport/correlator/ main/activemq/transport/failover/ main/activemq/transpor...
Date Thu, 12 Feb 2009 23:19:56 GMT
Author: tabish
Date: Thu Feb 12 23:19:54 2009
New Revision: 743923

URL: http://svn.apache.org/viewvc?rev=743923&view=rev
Log:
1. Refactored decaf util collection classes.
2. Code uses new isXX method of Commands to remove several casts and now unecessary checking for nulls.

Added:
    activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h   (with props)
    activemq/activemq-cpp/trunk/src/main/decaf/util/StlMap.h
      - copied, changed from r743068, activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/StlQueue.h   (with props)
    activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h   (with props)
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentStlMap.h
      - copied, changed from r743103, activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentSTLMap.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/StlMapTest.cpp
      - copied, changed from r743068, activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/StlMapTest.h
      - copied, changed from r743068, activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ConcurrentStlMapTest.cpp
      - copied, changed from r743103, activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ConcurrentSTLMapTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ConcurrentStlMapTest.h
      - copied, changed from r743103, activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ConcurrentSTLMapTest.h
Removed:
    activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentSTLMap.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ConcurrentSTLMapTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/concurrent/ConcurrentSTLMapTest.h
Modified:
    activemq/activemq-cpp/trunk/src/main/Makefile.am
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.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/ActiveMQConsumer.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/core/ActiveMQTransactionContext.h
    activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
    activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
    activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h
    activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h
    activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.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.h
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h
    activemq/activemq-cpp/trunk/src/main/decaf/lang/Iterable.h
    activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp
    activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/List.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/ListIterator.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h
    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-benchmarks/decaf/util/QueueBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h
    activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp
    activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h
    activemq/activemq-cpp/trunk/src/test-integration/activemq/test/SlowListenerTest.cpp
    activemq/activemq-cpp/trunk/src/test/Makefile.am
    activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.h
    activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.cpp
    activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.h
    activemq/activemq-cpp/trunk/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/trunk/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/Makefile.am?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/main/Makefile.am Thu Feb 12 23:19:54 2009
@@ -340,7 +340,7 @@
     decaf/util/concurrent/CancellationException.h \
     decaf/util/concurrent/Concurrent.h \
     decaf/util/concurrent/ConcurrentMap.h \
-    decaf/util/concurrent/ConcurrentSTLMap.h \
+    decaf/util/concurrent/ConcurrentStlMap.h \
     decaf/util/concurrent/CountDownLatch.h \
     decaf/util/concurrent/Executor.h \
     decaf/util/concurrent/ExecutionException.h \
@@ -370,6 +370,9 @@
     decaf/util/Comparator.h \
     decaf/util/List.h \
     decaf/util/Map.h \
+    decaf/util/StlMap.h \
+    decaf/util/StlList.h \
+    decaf/util/StlSet.h \
     decaf/util/Properties.h \
     decaf/util/Queue.h \
     decaf/util/Set.h \

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.h Thu Feb 12 23:19:54 2009
@@ -19,7 +19,7 @@
 
 #include <activemq/cmsutil/DestinationResolver.h>
 #include <cms/Session.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
 #include <activemq/util/Config.h>
 
 namespace activemq {
@@ -39,8 +39,8 @@
 
             ResourceLifecycleManager* resourceLifecycleManager;
             cms::Session* session;
-            decaf::util::STLMap<std::string, cms::Topic*> topicMap;
-            decaf::util::STLMap<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::STLMap< 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.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/PooledSession.h Thu Feb 12 23:19:54 2009
@@ -19,7 +19,7 @@
 #define ACTIVEMQ_CMSUTIL_POOLEDSESSION_H_
 
 #include <cms/Session.h>
-#include <decaf/util/STLMap.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::STLMap<std::string, CachedProducer*> producerCache;
+        decaf::util::StlMap<std::string, CachedProducer*> producerCache;
 
-        decaf::util::STLMap<std::string, CachedConsumer*> consumerCache;
+        decaf::util::StlMap<std::string, CachedConsumer*> consumerCache;
 
     public:
 

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.cpp Thu Feb 12 23:19:54 2009
@@ -443,7 +443,7 @@
 
         std::auto_ptr<commands::Command> commandPtr( command );
 
-        if( typeid( *command ) == typeid( commands::MessageDispatch ) ) {
+        if( command->isMessageDispatch() ) {
 
             commands::MessageDispatch* dispatch =
                 dynamic_cast<commands::MessageDispatch*>( command );
@@ -472,7 +472,7 @@
                 }
             }
 
-        } else if( typeid( *command ) == typeid( commands::ProducerAck ) ) {
+        } else if( command->isProducerAck() ) {
 
             commands::ProducerAck* producerAck =
                 dynamic_cast<commands::ProducerAck*>( command );
@@ -486,13 +486,13 @@
                 }
             }
 
-        } else if( typeid( *command ) == typeid( commands::WireFormatInfo ) ) {
+        } else if( command->isWireFormatInfo() ) {
             this->brokerWireFormatInfo.reset(
                 dynamic_cast<commands::WireFormatInfo*>( commandPtr.release() ) );
-        } else if( typeid( *command ) == typeid( commands::BrokerInfo ) ) {
+        } else if( command->isBrokerInfo() ) {
             this->brokerInfo.reset(
                 dynamic_cast<commands::BrokerInfo*>( commandPtr.release() ) );
-        } else if( typeid( *command ) == typeid( commands::KeepAliveInfo ) ) {
+        } else if( command->isKeepAliveInfo() ) {
 
             if( command->isResponseRequired() ) {
                 command->setResponseRequired( false );
@@ -500,7 +500,7 @@
                 oneway( command );
             }
 
-        } else if( typeid( *command ) == typeid( commands::ShutdownInfo ) ) {
+        } else if( command->isShutdownInfo() ) {
 
             try {
                 if( !this->isClosed() ) {

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConnection.h Thu Feb 12 23:19:54 2009
@@ -32,8 +32,8 @@
 #include <activemq/commands/WireFormatInfo.h>
 #include <activemq/exceptions/ActiveMQException.h>
 #include <decaf/util/Properties.h>
-#include <decaf/util/STLMap.h>
-#include <decaf/util/Set.h>
+#include <decaf/util/StlMap.h>
+#include <decaf/util/StlSet.h>
 #include <decaf/lang/exceptions/UnsupportedOperationException.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
 #include <decaf/lang/exceptions/IllegalStateException.h>
@@ -56,11 +56,11 @@
     {
     private:
 
-        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ConsumerId>,
+        typedef decaf::util::StlMap< decaf::lang::Pointer<commands::ConsumerId>,
                                      Dispatcher*,
                                      commands::ConsumerId::COMPARATOR > DispatcherMap;
 
-        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ProducerId>,
+        typedef decaf::util::StlMap< decaf::lang::Pointer<commands::ProducerId>,
                                      ActiveMQProducer*,
                                      commands::ProducerId::COMPARATOR > ProducerMap;
 
@@ -100,7 +100,7 @@
         /**
          * Maintain the set of all active sessions.
          */
-        decaf::util::Set<ActiveMQSession*> activeSessions;
+        decaf::util::StlSet<ActiveMQSession*> activeSessions;
 
         /**
          * Connection Information for this connection to the Broker

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQConsumer.h Thu Feb 12 23:19:54 2009
@@ -28,7 +28,7 @@
 #include <activemq/core/ActiveMQAckHandler.h>
 #include <activemq/core/Dispatcher.h>
 
-#include <decaf/util/Queue.h>
+#include <decaf/util/StlQueue.h>
 #include <decaf/util/concurrent/Mutex.h>
 #include <memory>
 
@@ -68,12 +68,12 @@
         /**
          * Queue of unconsumed messages.
          */
-        decaf::util::Queue<DispatchData> unconsumedMessages;
+        decaf::util::StlQueue<DispatchData> unconsumedMessages;
 
         /**
          * Queue of consumed messages.
          */
-        decaf::util::Queue< decaf::lang::Pointer<commands::Message> > dispatchedMessages;
+        decaf::util::StlQueue< decaf::lang::Pointer<commands::Message> > dispatchedMessages;
 
         /**
          * Boolean that indicates if the consumer has been closed

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp Thu Feb 12 23:19:54 2009
@@ -665,9 +665,9 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::redispatch( decaf::util::Queue<DispatchData>& unconsumedMessages ) {
+void ActiveMQSession::redispatch( decaf::util::StlQueue<DispatchData>& unconsumedMessages ) {
 
-    decaf::util::Queue<DispatchData> reversedList;
+    decaf::util::StlQueue<DispatchData> reversedList;
 
     // Copy the list in reverse order then clear the original list.
     synchronized( &unconsumedMessages ) {

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.h Thu Feb 12 23:19:54 2009
@@ -31,9 +31,8 @@
 #include <activemq/commands/TransactionId.h>
 #include <activemq/core/Dispatcher.h>
 
-#include <decaf/util/STLMap.h>
-#include <decaf/util/Set.h>
-#include <decaf/util/Queue.h>
+#include <decaf/util/StlMap.h>
+#include <decaf/util/StlQueue.h>
 #include <decaf/util/Properties.h>
 
 #include <string>
@@ -53,11 +52,11 @@
     class AMQCPP_API ActiveMQSession : public cms::Session, public Dispatcher {
     private:
 
-        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ConsumerId>,
+        typedef decaf::util::StlMap< decaf::lang::Pointer<commands::ConsumerId>,
                                      ActiveMQConsumer*,
                                      commands::ConsumerId::COMPARATOR> ConsumersMap;
 
-        typedef decaf::util::STLMap< decaf::lang::Pointer<commands::ProducerId>,
+        typedef decaf::util::StlMap< decaf::lang::Pointer<commands::ProducerId>,
                                      ActiveMQProducer*,
                                      commands::ProducerId::COMPARATOR> ProducersMap;
 
@@ -122,7 +121,7 @@
          * Redispatches the given set of unconsumed messages to the consumers.
          * @param unconsumedMessages - unconsumed messages to be redelivered.
          */
-        void redispatch( decaf::util::Queue<DispatchData>& unconsumedMessages );
+        void redispatch( decaf::util::StlQueue<DispatchData>& unconsumedMessages );
 
         /**
          * Stops asynchronous message delivery.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQTransactionContext.h Thu Feb 12 23:19:54 2009
@@ -30,7 +30,7 @@
 
 #include <decaf/lang/exceptions/InvalidStateException.h>
 #include <decaf/lang/exceptions/IllegalArgumentException.h>
-#include <decaf/util/Set.h>
+#include <decaf/util/StlSet.h>
 #include <decaf/util/Properties.h>
 #include <decaf/util/concurrent/Mutex.h>
 
@@ -66,7 +66,7 @@
         std::auto_ptr<commands::TransactionInfo> transactionInfo;
 
         // List of Registered Synchronizations
-        decaf::util::Set<Synchronization*> synchronizations;
+        decaf::util::StlSet<Synchronization*> synchronizations;
 
         // Lock object to protect the rollback Map
         decaf::util::concurrent::Mutex mutex;

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h Thu Feb 12 23:19:54 2009
@@ -31,8 +31,8 @@
 #include <activemq/state/TransactionState.h>
 
 #include <decaf/util/concurrent/atomic/AtomicBoolean.h>
-#include <decaf/util/STLMap.h>
-#include <decaf/util/List.h>
+#include <decaf/util/StlMap.h>
+#include <decaf/util/StlList.h>
 
 #include <string>
 #include <memory>
@@ -44,9 +44,9 @@
     private:
 
         std::auto_ptr<commands::ConnectionInfo> info;
-        decaf::util::STLMap< commands::TransactionId, TransactionState* > transactions;
-        decaf::util::STLMap< commands::SessionId, SessionState* > sessions;
-        decaf::util::List< commands::DestinationInfo* > tempDestinations;
+        decaf::util::StlMap< commands::TransactionId, TransactionState* > transactions;
+        decaf::util::StlMap< commands::SessionId, SessionState* > sessions;
+        decaf::util::StlList< commands::DestinationInfo* > tempDestinations;
         decaf::util::concurrent::atomic::AtomicBoolean disposed;
 
     public:

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h Thu Feb 12 23:19:54 2009
@@ -26,7 +26,7 @@
 #include <activemq/state/ProducerState.h>
 
 #include <decaf/util/concurrent/atomic/AtomicBoolean.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
 
 #include <string>
 #include <memory>
@@ -42,11 +42,11 @@
 
         Pointer<SessionInfo> info;
 
-        decaf::util::STLMap< Pointer<ProducerId>,
+        decaf::util::StlMap< Pointer<ProducerId>,
                              Pointer<ProducerState>,
                              ProducerId::COMPARATOR > producers;
 
-        decaf::util::STLMap< Pointer<ConsumerId>,
+        decaf::util::StlMap< Pointer<ConsumerId>,
                              Pointer<ConsumerState>,
                              ConsumerId::COMPARATOR > consumers;
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.cpp Thu Feb 12 23:19:54 2009
@@ -28,7 +28,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 TransactionState::TransactionState( const Pointer<TransactionId>& id ) :
-    disposed( false ), id( id ), prepared( false ), preparedResult( 0 ) {
+    id( id ), disposed( false ), prepared( false ), preparedResult( 0 ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h Thu Feb 12 23:19:54 2009
@@ -23,7 +23,7 @@
 #include <activemq/commands/TransactionId.h>
 
 #include <decaf/lang/Pointer.h>
-#include <decaf/util/List.h>
+#include <decaf/util/StlList.h>
 #include <decaf/util/concurrent/atomic/AtomicBoolean.h>
 
 #include <string>
@@ -35,7 +35,7 @@
     class AMQCPP_API TransactionState {
     private:
 
-        decaf::util::List< decaf::lang::Pointer<commands::Command> > commands;
+        decaf::util::StlList< decaf::lang::Pointer<commands::Command> > commands;
         decaf::lang::Pointer<commands::TransactionId> id;
         decaf::util::concurrent::atomic::AtomicBoolean disposed;
         bool prepared;

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/TransportRegistry.h Thu Feb 12 23:19:54 2009
@@ -24,7 +24,7 @@
 #include <vector>
 #include <activemq/transport/TransportFactory.h>
 
-#include <decaf/util/STLMap.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::STLMap<std::string, TransportFactory*> registry;
+        decaf::util::StlMap<std::string, TransportFactory*> registry;
 
     private:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/correlator/ResponseCorrelator.cpp Thu Feb 12 23:19:54 2009
@@ -185,15 +185,15 @@
 void ResponseCorrelator::onCommand( commands::Command* command ) {
 
     // Let's see if the incoming command is a response.
-    commands::Response* response = dynamic_cast<commands::Response*>( command );
-
-    if( response == NULL ){
+    if( !command->isResponse() ){
 
         // It's a non-response - just notify the listener.
         fire( command );
         return;
     }
 
+    commands::Response* response = dynamic_cast<commands::Response*>( command );
+
     // It is a response - let's correlate ...
     synchronized( &mapMutex ){
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.h Thu Feb 12 23:19:54 2009
@@ -23,7 +23,7 @@
 #include <activemq/commands/Command.h>
 #include <activemq/transport/CompositeTransport.h>
 
-#include <decaf/util/Set.h>
+#include <decaf/util/StlSet.h>
 #include <decaf/util/Properties.h>
 #include <decaf/net/URI.h>
 
@@ -40,7 +40,7 @@
         bool connected;
         bool started;
 
-        decaf::util::Set<decaf::net::URI> uris;
+        decaf::util::StlSet<decaf::net::URI> uris;
 
         long long timeout;
         long long initialReconnectDelay;

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/mock/MockTransport.h Thu Feb 12 23:19:54 2009
@@ -27,7 +27,7 @@
 #include <activemq/wireformat/WireFormat.h>
 
 #include <decaf/lang/Thread.h>
-#include <decaf/util/Queue.h>
+#include <decaf/util/StlQueue.h>
 #include <decaf/util/concurrent/Concurrent.h>
 #include <decaf/util/concurrent/atomic/AtomicInteger.h>
 #include <decaf/util/concurrent/CountDownLatch.h>
@@ -82,7 +82,7 @@
              */
             virtual void buildIncomingCommands(
                 const commands::Command* cmd,
-                decaf::util::Queue<commands::Command*>& queue ) = 0;
+                decaf::util::StlQueue<commands::Command*>& queue ) = 0;
 
         };
 
@@ -103,7 +103,7 @@
             ResponseBuilder* responseBuilder;
             bool done;
             decaf::util::concurrent::CountDownLatch startedLatch;
-            decaf::util::Queue<commands::Command*> inboundQueue;
+            decaf::util::StlQueue<commands::Command*> inboundQueue;
 
         public:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.cpp Thu Feb 12 23:19:54 2009
@@ -32,12 +32,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveList::PrimitiveList( const decaf::util::List<PrimitiveValueNode>& src )
-  : List<PrimitiveValueNode>( src ){
+  : StlList<PrimitiveValueNode>( src ){
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveList::PrimitiveList( const PrimitiveList& src )
-  : List<PrimitiveValueNode>( src ){
+  : StlList<PrimitiveValueNode>( src ){
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveList.h Thu Feb 12 23:19:54 2009
@@ -20,7 +20,7 @@
 
 #include <string>
 #include <vector>
-#include <decaf/util/List.h>
+#include <decaf/util/StlList.h>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <stdio.h>
 #include <activemq/util/PrimitiveValueNode.h>
@@ -31,7 +31,7 @@
     /**
      * List of primitives.
      */
-    class AMQCPP_API PrimitiveList : public decaf::util::List<PrimitiveValueNode> {
+    class AMQCPP_API PrimitiveList : public decaf::util::StlList<PrimitiveValueNode> {
     public:
 
         /**

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.cpp Thu Feb 12 23:19:54 2009
@@ -33,12 +33,12 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveMap::PrimitiveMap( const decaf::util::Map<std::string, PrimitiveValueNode>& src )
-  : decaf::util::STLMap<std::string, PrimitiveValueNode>( src ) {
+  : decaf::util::StlMap<std::string, PrimitiveValueNode>( src ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 PrimitiveMap::PrimitiveMap( const PrimitiveMap& src )
-  : decaf::util::STLMap<std::string, PrimitiveValueNode>( src ) {
+  : decaf::util::StlMap<std::string, PrimitiveValueNode>( src ) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveMap.h Thu Feb 12 23:19:54 2009
@@ -22,7 +22,7 @@
 #include <vector>
 #include <activemq/util/Config.h>
 #include <decaf/util/Config.h>
-#include <decaf/util/STLMap.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::STLMap<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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.cpp Thu Feb 12 23:19:54 2009
@@ -20,6 +20,8 @@
 #include <activemq/util/PrimitiveList.h>
 #include <activemq/util/PrimitiveMap.h>
 #include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/util/StlMap.h>
+#include <decaf/util/StlList.h>
 
 using namespace std;
 using namespace activemq;
@@ -413,11 +415,11 @@
 void PrimitiveValueNode::setList( const decaf::util::List<PrimitiveValueNode>& lvalue ){
     clear();
     valueType = LIST_TYPE;
-    value.listValue = new decaf::util::List<PrimitiveValueNode>( lvalue );
+    value.listValue = new decaf::util::StlList<PrimitiveValueNode>( lvalue );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-decaf::util::List<PrimitiveValueNode> PrimitiveValueNode::getList() const
+const decaf::util::List<PrimitiveValueNode>& PrimitiveValueNode::getList() const
     throw( decaf::lang::exceptions::NoSuchElementException ) {
 
     if( valueType != LIST_TYPE ){
@@ -428,7 +430,10 @@
     }
 
     if( value.listValue == NULL ){
-        return decaf::util::List<PrimitiveValueNode>();
+        throw decaf::lang::exceptions::NullPointerException(
+            __FILE__,
+            __LINE__,
+            "PrimitiveValue is not set but an element was placed in the Map" );
     }
 
     return *value.listValue;
@@ -440,7 +445,7 @@
 
     clear();
     valueType = MAP_TYPE;
-    value.mapValue = new decaf::util::STLMap<std::string, PrimitiveValueNode>( lvalue );
+    value.mapValue = new decaf::util::StlMap<std::string, PrimitiveValueNode>( lvalue );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/util/PrimitiveValueNode.h Thu Feb 12 23:19:54 2009
@@ -202,7 +202,7 @@
 
         /**
          * Gets the internal Primitive Value object from this wrapper.
-         * @return a copy of the contianed PrimitiveValue
+         * @return a copy of the contained PrimitiveValue
          */
         PrimitiveValue getValue() const {
             return this->value;
@@ -404,7 +404,7 @@
          * @throw NoSuchElementException this node cannot be returned as the
          * requested type.
          */
-        decaf::util::List<PrimitiveValueNode> getList() const
+        const decaf::util::List<PrimitiveValueNode>& getList() const
             throw( decaf::lang::exceptions::NoSuchElementException );
 
         /**

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/WireFormatRegistry.h Thu Feb 12 23:19:54 2009
@@ -24,7 +24,7 @@
 #include <vector>
 #include <activemq/wireformat/WireFormatFactory.h>
 
-#include <decaf/util/STLMap.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::STLMap<std::string, WireFormatFactory*> registry;
+        decaf::util::StlMap<std::string, WireFormatFactory*> registry;
 
     private:
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp Thu Feb 12 23:19:54 2009
@@ -141,13 +141,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 void OpenWireFormatNegotiator::onCommand( commands::Command* command ) {
 
-    DataStructure* dataStructure =
-        dynamic_cast<DataStructure*>( command );
+    if( command->isWireFormatInfo() ) {
 
-    if( dataStructure != NULL &&
-        dataStructure->getDataStructureType() == WireFormatInfo::ID_WIREFORMATINFO ) {
-
-        WireFormatInfo* info = dynamic_cast<WireFormatInfo*>( dataStructure );
+        WireFormatInfo* info = dynamic_cast<WireFormatInfo*>( command );
 
         try {
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp Thu Feb 12 23:19:54 2009
@@ -78,7 +78,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void OpenWireResponseBuilder::buildIncomingCommands(
-    const commands::Command* command, decaf::util::Queue<commands::Command*>& queue ){
+    const commands::Command* command, decaf::util::StlQueue<commands::Command*>& queue ){
 
     // Delegate this to buildResponse
     if( command->isResponseRequired() ) {

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h Thu Feb 12 23:19:54 2009
@@ -20,6 +20,7 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/transport/mock/MockTransport.h>
+#include <decaf/util/StlQueue.h>
 
 namespace activemq{
 namespace wireformat{
@@ -36,7 +37,7 @@
 
         virtual void buildIncomingCommands(
             const commands::Command* command,
-            decaf::util::Queue<commands::Command*>& queue );
+            decaf::util::StlQueue<commands::Command*>& queue );
 
     };
 

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=743923&r1=743922&r2=743923&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 Thu Feb 12 23:19:54 2009
@@ -267,7 +267,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 void PrimitiveMapMarshaller::unmarshalPrimitiveList(
     decaf::io::DataInputStream& dataIn,
-    decaf::util::List<PrimitiveValueNode>& list )
+    decaf::util::StlList<PrimitiveValueNode>& list )
         throw ( decaf::io::IOException ) {
 
     try{

Modified: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h Thu Feb 12 23:19:54 2009
@@ -129,7 +129,7 @@
          */
         static void unmarshalPrimitiveList(
             decaf::io::DataInputStream& dataIn,
-            decaf::util::List<util::PrimitiveValueNode>& list )
+            decaf::util::StlList<util::PrimitiveValueNode>& list )
                 throw ( decaf::io::IOException );
 
         /**

Modified: activemq/activemq-cpp/trunk/src/main/decaf/lang/Iterable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/lang/Iterable.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/lang/Iterable.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/lang/Iterable.h Thu Feb 12 23:19:54 2009
@@ -19,6 +19,7 @@
 #define _DECAF_LANG_ITERABLE_H_
 
 #include <decaf/util/Config.h>
+#include <decaf/util/Iterator.h>
 
 namespace decaf{
 namespace lang{
@@ -27,7 +28,7 @@
      * Implementing this interface allows an object to be cast to an Iterable
      * type for generic collections API calls.
      */
-    template< typename T >
+    template< typename E >
     class DECAF_API Iterable {
     public:
 
@@ -36,8 +37,8 @@
         /**
          * @returns an iterator over a set of elements of type T.
          */
-        T iterator() = 0;
-        const T iterator() = 0;
+        virtual decaf::util::Iterator<E>* iterator() = 0;
+        virtual decaf::util::Iterator<E>* iterator() const = 0;
 
     };
 

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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/lang/System.cpp Thu Feb 12 23:19:54 2009
@@ -22,7 +22,7 @@
 #include <decaf/lang/exceptions/RuntimeException.h>
 #include <decaf/util/Date.h>
 #include <decaf/util/StringTokenizer.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
 #include <apr.h>
 #include <apr_errno.h>
 #include <apr_env.h>
@@ -134,7 +134,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 const Map<string, string>& System::getenv() throw ( Exception ) {
 
-    static STLMap<string, string> values;
+    static StlMap<string, string> values;
     values.clear();
 
     StringTokenizer tokenizer( "" );

Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Collection.h Thu Feb 12 23:19:54 2009
@@ -19,10 +19,12 @@
 #define _DECAF_UTIL_COLLECTION_H_
 
 #include <decaf/util/Config.h>
-#include <devaf/lang/exceptions/UnsupportedOperationException.h>
-#include <devaf/lang/exceptions/NullPointerException.h>
-#include <devaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/Iterable.h>
 #include <decaf/util/Iterator.h>
+#include <decaf/util/concurrent/Synchronizable.h>
 
 namespace decaf{
 namespace util{
@@ -62,9 +64,9 @@
      *
      * @since 1.0
      */
-    template< typename T >
-    class Collection
-    {
+    template< typename E >
+    class DECAF_API Collection : public lang::Iterable<E>,
+        virtual public util::concurrent::Synchronizable {
     public:
 
         virtual ~Collection() {}
@@ -74,12 +76,20 @@
          * contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
          * @returns the number of elements in this collection
          */
-        virtual int size() = 0;
+        virtual std::size_t size() const = 0;
 
         /**
          * @returns true if this collection contains no elements.
          */
-        virtual bool isEmpty() = 0;
+        virtual bool isEmpty() const = 0;
+
+        /**
+         * Compares the passed collection to this one, if they contain the
+         * same elements, i.e. all their elements are equivalent, then it
+         * returns true.
+         * @returns true if the Collections contain the same elements.
+         */
+        virtual bool equals( const Collection<E>& value ) const = 0;
 
         /**
          * Returns true if this collection contains the specified element. More
@@ -87,19 +97,18 @@
          * least one element e such that (o==null ? e==null : o.equals(e)).
          * @param value - value to check for presence in the collection
          * @returns true if there is at least one of the elements in the collection
-         * @thorws NullPointerException
+         * @throw Exception
          */
-        virtual bool contains( const E& value )
-            throw ( lang::exceptions::NullPointerException ) = 0;
+        virtual bool contains( const E& value ) const throw ( lang::Exception ) = 0;
 
         /**
-         * Returns an iterator over the elements in this collection. There are
-         * no guarantees concerning the order in which the elements are
-         * returned (unless this collection is an instance of some class that
-         * provides a guarantee).
-         * @returns an Iterator over the elements in this collection
+         * Returns true if this collection contains all of the elements in
+         * the specified collection.
+         * @param source - Collection to compare to this one.
+         * @throw Exception
          */
-        virtual Iterator<E>* iterator() = 0;
+        virtual bool containsAll( const Collection<E>& source ) const
+            throw ( lang::Exception ) = 0;
 
         /**
          * Returns an array containing all of the elements in this collection. If
@@ -110,7 +119,7 @@
          * This method acts as bridge between array-based and collection-based APIs.
          * @returns an array of the elements in this collection.
          */
-        virtual std::vector<E> toArray() = 0;
+        virtual std::vector<E> toArray() const = 0;
 
         /**
          * Returns true if this collection changed as a result of the call.
@@ -138,12 +147,10 @@
          * @param value - reference to the element to add.
          * @returns true if the element was added
          * @throw UnsupportedOperationException
-         * @throw NullPointerException
          * @throw IllegalArgumentException
          */
         virtual bool add( const E& value )
             throw ( lang::exceptions::UnsupportedOperationException,
-                    lang::exceptions::NullPointerException,
                     lang::exceptions::IllegalArgumentException ) = 0;
 
         /**
@@ -156,20 +163,11 @@
          * @param value - reference to the element to remove.
          * @returns true if the collection was changed
          * @throw UnsupportedOperationException
-         * @throw NullPointerException
+         * @throw IllegalArgumentException
          */
         virtual bool remove( const E& value )
             throw ( lang::exceptions::UnsupportedOperationException,
-                    lang::exceptions::NullPointerException ) = 0;
-
-        /**
-         * Returns true if this collection contains all of the elements in
-         * the specified collection.
-         * @param source - Collection to compare to this one.
-         * @thorw Exception
-         */
-        virtual bool containsAll( const Collection<E>& source )
-            throw ( lang::Exception ) = 0;
+                    lang::exceptions::IllegalArgumentException ) = 0;
 
         /**
          * Adds all of the elements in the specified collection to this
@@ -181,12 +179,10 @@
          * @param source - Collection whose elements are added to this one.
          * @return true if this collection changed as a result of the call
          * @throw UnsupportedOperationException
-         * @throw NullPointerException
          * @throw IllegalArgumentException
          */
         virtual bool addAll( const Collection<E>& source )
             throw ( lang::exceptions::UnsupportedOperationException,
-                    lang::exceptions::NullPointerException,
                     lang::exceptions::IllegalArgumentException ) = 0;
 
         /**
@@ -197,12 +193,10 @@
          * @param value - The Collection whose elements are to be removed
          * @returns true if the collection changed as a result of this call
          * @throw UnsupportedOperationException
-         * @throw NullPointerException
          * @throw IllegalArgumentException
          */
         virtual bool removeAll( const Collection<E>& value )
             throw ( lang::exceptions::UnsupportedOperationException,
-                    lang::exceptions::NullPointerException,
                     lang::exceptions::IllegalArgumentException ) = 0;
 
         /**
@@ -213,12 +207,10 @@
          * @param value - The Collection whose elements are to be retained
          * @returns true if the collection changed as a result of this call
          * @throw UnsupportedOperationException
-         * @throw NullPointerException
          * @throw IllegalArgumentException
          */
-        virtual bool retainAll( const Collection<E> value )
+        virtual bool retainAll( const Collection<E>& value )
             throw ( lang::exceptions::UnsupportedOperationException,
-                    lang::exceptions::NullPointerException,
                     lang::exceptions::IllegalArgumentException ) = 0;
 
         /**
@@ -230,14 +222,6 @@
         virtual void clear()
             throw ( lang::exceptions::UnsupportedOperationException ) = 0;
 
-        /**
-         * Compares the passed collection to this one, if they contain the
-         * same elements, i.e. all their elements are equivalent, then it
-         * returns true.
-         * @returns true if the Collections contain the same elements.
-         */
-        virtual bool equals( const Collection<E>& value ) = 0;
-
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/List.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/List.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/List.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/List.h Thu Feb 12 23:19:54 2009
@@ -18,139 +18,59 @@
 #ifndef _DECAF_UTIL_LIST_H_
 #define _DECAF_UTIL_LIST_H_
 
-#include <list>
-#include <algorithm>
 #include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Config.h>
 #include <decaf/util/Iterator.h>
+#include <decaf/util/Collection.h>
+#include <decaf/util/ListIterator.h>
 
 namespace decaf{
 namespace util{
 
     /**
-     * Set template that wraps around a std::set to provide a more
-     * user-friendly interface and to provide common functions that do
-     * not exist in std::list.
+     * An ordered collection (also known as a sequence). The user of this interface has
+     * precise control over where in the list each element is inserted. The user can
+     * access elements by their integer index (position in the list), and search for
+     * elements in the list.
+     *
+     * Unlike sets, lists typically allow duplicate elements. More formally, lists
+     * typically allow pairs of elements e1 and e2 such that e1.equals(e2), and they
+     * typically allow multiple null elements if they allow null elements at all.
+     * It is not inconceivable that someone might wish to implement a list that
+     * prohibits duplicates, by throwing runtime exceptions when the user attempts
+     * to insert them, but we expect this usage to be rare.
      */
-    template <typename E> class List : public util::concurrent::Synchronizable {
-    private:
-
-        std::list<E> values;
-        util::concurrent::Mutex mutex;
-
-    private:
-
-        class ListIterator : public Iterator<E> {
-        private:
-
-            typename std::list<E>::iterator current;
-            typename std::list<E>::iterator previous;
-            typename std::list<E>* list;
-
-        public:
-
-            ListIterator( typename std::list<E>* list ) {
-                this->current = list->begin();
-                this->previous = list->end();
-                this->list = list;
-            }
-            virtual ~ListIterator() {}
-
-            virtual E next() throw( lang::exceptions::NoSuchElementException ){
-                if( this->current == list->end() ) {
-                    throw lang::exceptions::NoSuchElementException(
-                        __FILE__, __LINE__,
-                        "List::Iterator::next - No more elements to return" );
-                }
-
-                this->previous = this->current;
-                return *( this->current++ );
-            }
-
-            virtual bool hasNext() const {
-                return ( this->current != list->end() );
-            }
-
-            virtual void remove() throw ( lang::exceptions::IllegalStateException,
-                                          lang::exceptions::UnsupportedOperationException ){
-                if( this->previous == list->end() ) {
-                    throw lang::exceptions::IllegalStateException(
-                        __FILE__, __LINE__,
-                        "List::Iterator::remove - Invalid State to call remove" );
-                }
-
-                this->list->erase( this->previous );
-                this->previous = this->list->end();
-            }
-        };
-
+    template <typename E>
+    class DECAF_API List : public decaf::util::Collection<E> {
     public:
 
-        /**
-         * Default constructor - does nothing.
-         */
-        List(){}
-
-        /**
-         * Copy constructor - copies the content of the given set into this
-         * one.
-         * @param source The source set.
-         */
-        List( const List& source ) : decaf::util::concurrent::Synchronizable() {
-            copy( source );
-        }
-
-        virtual ~List(){}
+        virtual ~List() {}
 
         /**
-         * Comparison, equality is dependant on the method of determining
-         * if the element are equal.
-         * @param source - List to compare to this one.
-         * @returns true if the List passed is equal in value to this one.
+         * @return a list iterator over the elements in this list (in proper sequence).
          */
-        virtual bool equals( const List& source ) const {
-            return this->values == source.values;
-        }
+        virtual ListIterator<E>* listIterator() = 0;
+        virtual ListIterator<E>* listIterator() const = 0;
 
         /**
-         * Returns an iterator for this collection.  The order of Iteration
-         * is in no particular order other than the natural ording of the
-         * elements in the List class.
-         * @returns Iterator<E> for this collection
-         */
-        Iterator<E>* iterator() {
-            return new ListIterator( &values );
-        }
-
-        /**
-         * Copies the content of the source set into this set.  Erases
-         * all existing data in this st.
-         * @param source The source object to copy from.
-         */
-        virtual void copy( const List& source ) {
-            // Add all of the entries to this map.
-            values = source.values;
-        }
-
-        /**
-         * Removes all values from this set.
-         */
-        virtual void clear() {
-            values.clear();
-        }
-
-        /**
-         * Indicates whether or this set contains the given value.
-         * @param value The value to look up.
-         * @return true if this set contains the value, otherwise false.
+         * @param index index of first element to be returned from the list iterator
+         *              (by a call to the next method).
+         *
+         * @return a list iterator of the elements in this list (in proper sequence),
+         *         starting at the specified position in this list. The specified index
+         *         indicates the first element that would be returned by an initial call
+         *         to next. An initial call to previous would return the element with the
+         *         specified index minus one.
+         *
+         * @throws IndexOutOfBoundsException if the index is out of range
+         *         (index < 0 || index > size())
          */
-        virtual bool contains( const E& value ) const {
-            typename std::list<E>::const_iterator iter;
-            iter = std::find( values.begin(), values.end(), value );
-            return iter != values.end();
-        }
+        virtual ListIterator<E>* listIterator( std::size_t index )
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
+        virtual ListIterator<E>* listIterator( std::size_t index ) const
+            throw( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Returns the index of the first occurrence of the specified element in
@@ -163,20 +83,8 @@
          * this list,
          * @throw NoSuchElementException if value is not in the list
          */
-        virtual size_t indexOf( const E& value )
-            throw ( decaf::lang::exceptions::NoSuchElementException ) {
-
-            typename std::list<E>::iterator iter;
-            iter = std::find( values.begin(), values.end(), value );
-
-            if( iter == values.end() ) {
-                throw decaf::lang::exceptions::NoSuchElementException(
-                    __FILE__, __LINE__,
-                    "List::indexOf - No matching element in list" );
-            }
-
-            return std::distance( values.begin(), iter );
-        }
+        virtual std::size_t indexOf( const E& value )
+            throw ( decaf::lang::exceptions::NoSuchElementException ) = 0;
 
         /**
          * Returns the index of the last occurrence of the specified element in
@@ -189,33 +97,8 @@
          * this list.
          * @throw NoSuchElementException if value is not in the list
          */
-        virtual size_t lastIndexOf( const E& value ) {
-            typename std::list<E>::reverse_iterator iter;
-            iter = std::find( values.rbegin(), values.rend(), value );
-
-            if( iter == values.rend() ) {
-                throw decaf::lang::exceptions::NoSuchElementException(
-                    __FILE__, __LINE__,
-                    "List::lastIndexOf - No matching element in list" );
-            }
-
-            // Now reverse the result to get the last index
-            return this->size() - std::distance( values.rbegin(), iter ) - 1;
-        }
-
-        /**
-         * @return if the set contains any element or not, TRUE or FALSE
-         */
-        virtual bool isEmpty() const {
-            return values.empty();
-        }
-
-        /**
-         * @return The number of elements in this set.
-         */
-        virtual std::size_t size() const {
-            return values.size();
-        }
+        virtual size_t lastIndexOf( const E& value )
+            throw ( decaf::lang::exceptions::NoSuchElementException ) = 0;
 
         /**
          * Gets the element contained at position passed
@@ -223,19 +106,7 @@
          * @return value at index
          */
         virtual E get( std::size_t index ) const
-            throw ( decaf::lang::exceptions::IndexOutOfBoundsException ) {
-
-            if( index >= this->size() ) {
-                throw decaf::lang::exceptions::IndexOutOfBoundsException(
-                    __FILE__, __LINE__,
-                    "List::get - Index greater than size()" );
-            }
-
-            // Advance from begin and return the value at that location.
-            typename std::list<E>::const_iterator iter = this->values.begin();
-            std::advance( iter, index );
-            return *( iter );
-        }
+            throw ( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Replaces the element at the specified position in this list with the
@@ -244,34 +115,10 @@
          * @param index - index of the element to replace
          * @param element - element to be stored at the specified position
          * @return the element previously at the specified position
-         * @throw IndexOutOfBoundsException - if the index is greater tham size
+         * @throw IndexOutOfBoundsException - if the index is greater than size
          */
-        virtual E set( std::size_t index, E element )
-            throw ( decaf::lang::exceptions::IndexOutOfBoundsException ){
-
-            if( index >= this->size() ) {
-                throw decaf::lang::exceptions::IndexOutOfBoundsException(
-                    __FILE__, __LINE__,
-                    "List::get - Index greater than size()" );
-            }
-
-            // Advance from begin and return the value at that location
-            // after setting the value to the new value.
-            typename std::list<E>::iterator iter = this->values.begin();
-            std::advance( iter, index );
-            E oldValue = *iter;
-            *iter = element;
-
-            return oldValue;
-        }
-
-        /**
-         * Adds the given value to the set.
-         * @param value The value to add.
-         */
-        virtual void add( const E& value ) {
-            values.insert( values.end(), value );
-        }
+        virtual E set( std::size_t index, const E& element )
+            throw ( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Inserts the specified element at the specified position in this list.
@@ -280,30 +127,35 @@
          *
          * @param index - index at which the specified element is to be inserted
          * @param element - element to be inserted
-         * @throw IndexOutOfBoundsException - if the index is greater tham size
+         *
+         * @throw IndexOutOfBoundsException - if the index is greater than size
+         * @throw UnsupportedOperationException - If the collection is non-modifiable.
          */
-        virtual void add( std::size_t index, E element )
-            throw ( decaf::lang::exceptions::IndexOutOfBoundsException ){
-
-            if( index > this->size() ) {
-                throw decaf::lang::exceptions::IndexOutOfBoundsException(
-                    __FILE__, __LINE__,
-                    "List::add - Index greater than size()" );
-            }
-
-            // Advance from begin and insert the value at that location
-            typename std::list<E>::iterator iter = this->values.begin();
-            std::advance( iter, index );
-            this->values.insert( iter, element );
-        }
-
-        /**
-         * Removes the value from the set.
-         * @param value The value to be removed.
+        virtual void add( std::size_t index, const E& element )
+            throw ( decaf::lang::exceptions::UnsupportedOperationException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
+
+        /**
+         * Inserts all of the elements in the specified collection into this list at
+         * the specified position (optional operation). Shifts the element currently at
+         * that position (if any) and any subsequent elements to the right (increases
+         * their indices). The new elements will appear in this list in the order that
+         * they are returned by the specified collection's iterator. The behavior of this
+         * operation is undefined if the specified collection is modified while the
+         * operation is in progress. (Note that this will occur if the specified collection
+         * is this list, and it's nonempty.)
+         *
+         * @param index index at which to insert the first element from the specified collection
+         * @param c collection containing elements to be added to this list
+         *
+         * @return true if this list changed as a result of the call
+         *
+         * @throw IndexOutOfBoundsException - if the index is greater than size
+         * @throw UnsupportedOperationException - If the collection is non-modifiable.
          */
-        virtual void remove( const E& value ) {
-            values.remove( value );
-        }
+        virtual bool addAll( std::size_t index, const Collection<E>& c )
+            throw ( decaf::lang::exceptions::UnsupportedOperationException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Removes the element at the specified position in this list.
@@ -312,101 +164,12 @@
          *
          * @param index - the index of the element to be removed
          * @return the element previously at the specified position
-         * @throw IndexOutOfBoundsException - if the index >= size()
-         */
-        virtual E remove( std::size_t index ) {
-
-            if( index > this->size() ) {
-                throw decaf::lang::exceptions::IndexOutOfBoundsException(
-                    __FILE__, __LINE__,
-                    "List::add - Index greater than size()" );
-            }
-
-            // Advance from begin and insert the value at that location
-            typename std::list<E>::iterator iter = this->values.begin();
-            std::advance( iter, index );
-            E oldValue = *iter;
-            this->values.erase( iter );
-
-            return oldValue;
-        }
-
-        /**
-         * @return the all values in this set as a std::vector.
-         */
-        virtual std::vector<E> toArray() const {
-            std::vector<E> valueArray( values.size() );
-
-            typename std::list<E>::const_iterator iter;
-            iter=values.begin();
-            for( int ix=0; iter != values.end(); ++iter, ++ix ){
-                valueArray[ix] = *iter;
-            }
-
-            return valueArray;
-        }
-
-    public:     // Methods from Synchronizable
-
-        /**
-         * Locks the object.
-         * @throws Exception
-         */
-        virtual void lock() throw( lang::Exception ) {
-            mutex.lock();
-        }
-
-        /**
-         * Unlocks the object.
-         * @throws Exception
-         */
-        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 Exception
-         */
-        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 Exception
-         */
-        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 Exception
-         */
-        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 Exception
+         * @throw IndexOutOfBoundsException - if the index is greater than size
+         * @throw UnsupportedOperationException - If the collection is non-modifiable.
          */
-        virtual void notifyAll() throw(  lang::Exception  ) {
-            mutex.notifyAll();
-        }
+        virtual E remove( std::size_t index )
+            throw ( decaf::lang::exceptions::UnsupportedOperationException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/ListIterator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/ListIterator.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/ListIterator.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/ListIterator.h Thu Feb 12 23:19:54 2009
@@ -18,7 +18,9 @@
 #ifndef _DECAF_UTIL_LISTITERATOR_H_
 #define _DECAF_UTIL_LISTITERATOR_H_
 
-#include <decaf/til/Iterator.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
 
 namespace decaf{
 namespace util{
@@ -33,7 +35,7 @@
      * returned by a call to next() or previous().
      */
     template< typename E>
-    class ListIterator : public decaf::util::Iterator<E> {
+    class DECAF_API ListIterator : public decaf::util::Iterator<E> {
     public:
 
         virtual ~ListIterator() {}
@@ -75,7 +77,20 @@
          * called, or remove or add have been called after the last call to next
          * or previous.
          */
-        virtual void set( const E& e ) = 0;
+        virtual void set( const E& e )
+            throw ( decaf::lang::exceptions::UnsupportedOperationException,
+                    decaf::lang::exceptions::IllegalArgumentException,
+                    decaf::lang::exceptions::IllegalStateException ) = 0;
+
+        /**
+         * Returns true if this list iterator has more elements when traversing the
+         * list in the reverse direction. (In other words, returns true if previous
+         * would return an element rather than throwing an exception.)
+         *
+         * @return true if the list iterator has more elements when traversing the list
+         *         in the reverse direction.
+         */
+        virtual bool hasPrevious() const = 0;
 
         /**
          * Returns the previous element in the list. This method may be called
@@ -97,7 +112,7 @@
          * subsequent call to next, or list size if list iterator is at end
          * of list.
          */
-        virtual int nextIndex() = 0;
+        virtual int nextIndex() const = 0;
 
         /**
          * Returns the index of the element that would be returned by a
@@ -108,7 +123,7 @@
          * subsequent call to previous, or -1 if list iterator is at beginning
          * of list.
          */
-        virtual int previousIndex() = 0;
+        virtual int previousIndex() const = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h Thu Feb 12 23:19:54 2009
@@ -17,246 +17,95 @@
 #ifndef _DECAF_UTIL_QUEUE_H_
 #define _DECAF_UTIL_QUEUE_H_
 
-#include <list>
-#include <vector>
-#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Config.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/Collection.h>
 #include <decaf/lang/Exception.h>
+#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
 
 namespace decaf{
 namespace util{
 
     /**
-     * The Queue class accepts messages with an psuh(m) command
-     * where m is the message to be queued.  It destructively
-     * returns the message with pop().  pop() returns messages in
-     * the order they were enqueued.
+     * A kind of collection provides advanced operations than other basic
+     * collections, such as insertion, extraction, and inspection.
      *
-     * Queue is implemented with an instance of the STL queue object.
-     * The interface is essentially the same as that of the STL queue
-     * except that the pop method actually reaturns a reference to the
-     * element popped.  This frees the app from having to call the
-     * <code>front</code> method before calling pop.
+     * Generally, a queue orders its elements by means of first-in-first-out. While
+     * priority queue orders its elements according to a comparator specified or the
+     * elements' natural order. Furthermore, a stack orders its elements
+     * last-in-first out.
      *
-     *  Queue<string> sq;     // make a queue to hold string messages
-     *  sq.push(s);           // enqueues a message m
-     *  string s = sq.pop();  // dequeues a message
+     * Queue does not provide blocking queue methods, which will block until the
+     * operation of the method is allowed. BlockingQueue interface defines such
+     * methods.
      *
-     * = DESIGN CONSIDERATIONS
-     *
-     * The Queue class inherits from the Synchronizable interface and
-     * provides methods for locking and unlocking this queue as well as
-     * waiting on this queue.  In a multi-threaded app this can allow
-     * for multiple threads to be reading from and writing to the same
-     * Queue.
-     *
-     * Clients should consider that in a multiple threaded app it is
-     * possible that items could be placed on the queue faster than
-     * you are taking them off, so protection should be placed in your
-     * polling loop to ensure that you don't get stuck there.
+     * Certain methods in the Queue interface return a special value instead of throwing
+     * an exception if there is no element in the Queue to return, this special value
+     * can be obtained by calling the Queue method <code>getEmptyMarker</code>.
      */
-
-    template <typename T> class Queue : public concurrent::Synchronizable {
+    template <typename E>
+    class DECAF_API Queue : public decaf::util::Collection<E> {
     public:
 
-        Queue() {}
         virtual ~Queue() {}
 
         /**
-         * Empties this queue.
-         */
-        void clear() {
-            queue.clear();
-        }
-
-        /**
-         * Returns a Reference to the element at the head of the queue
-         * @return reference to a queue type object or (safe)
-         */
-        T& front() {
-            if( queue.empty() ) {
-                return getSafeValue();
-            }
-
-            return queue.front();
-        }
-
-        /**
-         * Returns a Reference to the element at the head of the queue
-         * @return reference to a queue type object or (safe)
+         * Returns a reference to the Marker value that is returned from methods that
+         * do not throw an exception when there is no element in the Queue to return.
          */
-        const T& front() const {
-            if( queue.empty() ) {
-                return getSafeValue();
-            }
-
-            return queue.front();
-        }
+        virtual const E& getEmptyMarker() const = 0;
 
         /**
-         * Returns a Reference to the element at the tail of the queue
-         * @return reference to a queue type object or (safe)
+         * Inserts the specified element into the queue provided that the condition
+         * allows such an operation. The method is generally preferable to the
+         * collection.add(E), since the latter might throw an exception if the
+         * operation fails.
+         *
+         * @param value
+         *        the specified element to insert into the queue.
+         *
+         * @return true if the operation succeeds and false if it fails.
          */
-        T& back() {
-            if( queue.empty() ) {
-                return getSafeValue();
-            }
-
-            return queue.back();
-        }
-
-        /**
-         * Returns a Reference to the element at the tail of the queue
-         * @return reference to a queue type object or (safe)
-         */
-        const T& back() const {
-            if( queue.empty() ) {
-                return getSafeValue();
-            }
-
-            return queue.back();
-        }
-
-        /**
-         * Places a new Object at the Tail of the queue
-         * @param t - Queue Object Type reference.
-         */
-        void push( const T &t ) {
-            queue.push_back( t );
-        }
-
-        /**
-         * Places a new Object at the front of the queue
-         * @param t - Queue Object Type reference.
-         */
-        void enqueueFront( const T &t ) {
-            queue.push_front( t );
-        }
-
-        /**
-         * Removes and returns the element that is at the Head of the queue
-         * @return reference to a queue type object or (safe)
-         */
-        T pop() {
-            if( queue.empty() ) {
-                return getSafeValue();
-            }
-
-            // Pop the element into a temp, since we need to remain locked.
-            // this means getting front and then popping.
-            T temp = queue.front();
-            queue.pop_front();
-
-            return temp;
-        }
+        virtual bool offer( const E& value ) = 0;
 
         /**
-         * Gets the Number of elements currently in the Queue
-         * @return Queue Size
+         * Gets and removes the element in the head of the queue, or returns null if
+         * there is no element in the queue.
+         *
+         * @return the element in the head of the queue or null if there is no
+         *         element in the queue.
          */
-        size_t size() const{
-            return queue.size();
-        }
+        virtual E poll() = 0;
 
         /**
-         * Checks if this Queue is currently empty
-         * @return boolean indicating queue emptiness
+         * Gets and removes the element in the head of the queue. Throws a
+         * NoSuchElementException if there is no element in the queue.
+         *
+         * @return the element in the head of the queue.
+         * @throws NoSuchElementException
+         *         if there is no element in the queue.
          */
-        bool empty() const {
-            return queue.empty();
-        }
+        virtual E remove() throw ( decaf::lang::exceptions::NoSuchElementException ) = 0;
 
         /**
-         * @return the all values in this queue as a std::vector.
+         * Gets but not removes the element in the head of the queue.
+         *
+         * @return the element in the head of the queue or null if there is no
+         *         element in the queue.
          */
-        virtual std::vector<T> toArray() const {
-            std::vector<T> valueArray( queue.begin(), queue.end() );
-            return valueArray;
-        }
+        virtual const E& peek() const = 0;
 
         /**
-         * Reverses the order of the contents of this queue and stores them
-         * in the target queue.
-         * @param target - The target queue that will receive the contents of
-         * this queue in reverse order.
+         * Gets but not removes the element in the head of the queue. Throws a
+         * NoSuchElementException if there is no element in the queue.
+         *
+         * @return the element in the head of the queue.
+         * @throws NoSuchElementException
+         *         if there is no element in the queue.
          */
-        void reverse( Queue<T>& target ) const {
-            target.queue.insert( target.queue.end(), queue.rbegin(), queue.rend() );
-        }
-
-        /**
-         * Locks the object.
-         */
-        virtual void lock() throw( lang::Exception ){
-            mutex.lock();
-        }
-
-        /**
-         * Unlocks the object.
-         */
-        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.
-         */
-        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 time 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.
-         */
-        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.
-         */
-        virtual void notifyAll() throw( lang::Exception ){
-            mutex.notifyAll();
-        }
-
-    public:   // Statics
-
-        /**
-         * Fetch a reference to the safe value this object will return
-         * when there is nothing to fetch from the queue.
-         * @return Reference to this Queues safe object
-         */
-        T& getSafeValue() {
-            static T safe;
-            return safe;
-        }
-
-    private:
-
-        // The real queue
-        std::list<T> queue;
-
-        // Object used for sync
-        util::concurrent::Mutex mutex;
+        virtual const E& element() const
+            throw( decaf::lang::exceptions::NoSuchElementException ) = 0;
 
     };
 



Mime
View raw message