You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/02/13 00:19:56 UTC
svn commit: r743923 [2/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...
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h Thu Feb 12 23:19:54 2009
@@ -18,235 +18,32 @@
#ifndef _DECAF_UTIL_SET_H_
#define _DECAF_UTIL_SET_H_
-#include <set>
-#include <vector>
#include <decaf/lang/exceptions/NoSuchElementException.h>
#include <decaf/util/concurrent/Synchronizable.h>
#include <decaf/util/concurrent/Mutex.h>
#include <decaf/util/Iterator.h>
+#include <decaf/util/Collection.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::set.
+ * A collection that contains no duplicate elements. More formally, sets contain no
+ * pair of elements e1 and e2 such that e1 == e2, and at most one null element.
+ * As implied by its name, this interface models the mathematical set abstraction.
+ *
+ * The additional stipulation on constructors is, not surprisingly, that all constructors
+ * must create a set that contains no duplicate elements (as defined above).
+ *
+ * Note: Great care must be exercised if mutable objects are used as set elements.
+ * The behavior of a set is not specified if the value of an object is changed in a
+ * manner that affects equals comparisons while the object is an element in the set.
*/
- template <typename E> class Set : public util::concurrent::Synchronizable {
- private:
-
- std::set<E> values;
- util::concurrent::Mutex mutex;
-
- private:
-
- class SetIterator : public Iterator<E> {
- private:
-
- typename std::set<E>::iterator current;
- typename std::set<E>::iterator previous;
- typename std::set<E>* set;
-
- public:
-
- SetIterator( typename std::set<E>* set ) {
- this->current = set->begin();
- this->previous = set->end();
- this->set = set;
- }
- virtual ~SetIterator() {}
-
- virtual E next() throw( lang::exceptions::NoSuchElementException ){
- if( this->current == set->end() ) {
- throw lang::exceptions::NoSuchElementException(
- __FILE__, __LINE__,
- "Set::Iterator::next - No more elements to return" );
- }
-
- this->previous = this->current;
- return *( this->current++ );
- }
-
- virtual bool hasNext() const {
- return ( this->current != set->end() );
- }
-
- virtual void remove() throw ( lang::exceptions::IllegalStateException,
- lang::exceptions::UnsupportedOperationException ){
- if( this->previous == set->end() ) {
- throw lang::exceptions::IllegalStateException(
- __FILE__, __LINE__,
- "Set::Iterator::remove - Invalid State to call remove" );
- }
-
- this->set->erase( this->previous );
- this->previous = this->set->end();
- }
- };
-
+ template <typename E>
+ class Set : public decaf::util::Collection<E> {
public:
- /**
- * Default constructor - does nothing.
- */
- Set(){}
-
- /**
- * Copy constructor - copies the content of the given set into this
- * one.
- * @param source The source set.
- */
- Set( const Set& source ){
- copy( source );
- }
-
- virtual ~Set(){}
-
- /**
- * 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 Set class.
- * @returns Iterator<E> for this collection
- */
- Iterator<E>* iterator() {
- return new SetIterator( &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 Set& 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.
- */
- virtual bool contains( const E& value ) const {
- typename std::set<E>::const_iterator iter;
- iter = values.find( value );
- return iter != values.end();
- }
-
- /**
- * @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();
- }
-
- /**
- * Adds the given value to the set.
- * @param value The value to add.
- */
- virtual void add( const E& value ) {
- values.insert( value );
- }
-
- /**
- * Removes the value from the set.
- * @param value The value to be removed.
- */
- virtual void remove( const E& value ) {
- values.erase( value );
- }
-
- /**
- * @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::set<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
- */
- virtual void notifyAll() throw( lang::Exception ) {
- mutex.notifyAll();
- }
+ virtual ~Set() {}
};
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h?rev=743923&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h Thu Feb 12 23:19:54 2009
@@ -0,0 +1,663 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_UTIL_STLLIST_H_
+#define _DECAF_UTIL_STLLIST_H_
+
+#include <list>
+#include <algorithm>
+#include <memory>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#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/ListIterator.h>
+#include <decaf/util/List.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.
+ */
+ template <typename E>
+ class DECAF_API StlList : public decaf::util::List<E> {
+ private:
+
+ std::list<E> values;
+ util::concurrent::Mutex mutex;
+
+ private:
+
+ class StlListIterator : public ListIterator<E> {
+ private:
+
+ typename std::list<E>::iterator current;
+ typename std::list<E>::iterator prev;
+ typename std::list<E>* list;
+
+ public:
+
+ StlListIterator( typename std::list<E>* list ) {
+ this->current = list->begin();
+ this->prev = list->end();
+ this->list = list;
+ }
+ StlListIterator( typename std::list<E>* list, std::size_t index ) {
+ this->current = list->begin();
+ std::advance( this->current, index );
+ this->prev = list->end();
+ this->list = list;
+ }
+ virtual ~StlListIterator() {}
+
+ 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->prev = 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->prev == list->end() ) {
+ throw lang::exceptions::IllegalStateException(
+ __FILE__, __LINE__,
+ "List::Iterator::remove - Invalid State to call remove" );
+ }
+
+ this->list->erase( this->prev );
+ this->prev = this->list->end();
+ }
+
+ virtual void add( const E& e DECAF_UNUSED )
+ throw ( decaf::lang::exceptions::UnsupportedOperationException,
+ decaf::lang::exceptions::IllegalArgumentException ) {
+
+ throw lang::exceptions::UnsupportedOperationException(
+ __FILE__, __LINE__,
+ "List::ListIterator::add - Not Implemented Yet." );
+ }
+
+ virtual void set( const E& e )
+ throw ( decaf::lang::exceptions::UnsupportedOperationException,
+ decaf::lang::exceptions::IllegalArgumentException,
+ decaf::lang::exceptions::IllegalStateException )
+ {
+ if( this->current == list->end() ) {
+ throw lang::exceptions::IllegalStateException(
+ __FILE__, __LINE__,
+ "List::Iterator::set - Not a valid state for set" );
+ }
+
+ *( this->current ) = e;
+ }
+
+ virtual bool hasPrevious() const {
+ return ( this->current != this->list->begin() );
+ }
+
+ virtual const E& previous() {
+ if( this->current == this->list->begin() ) {
+ throw lang::exceptions::NoSuchElementException(
+ __FILE__, __LINE__,
+ "List::ListIterator::previous - No Previous element." );
+ }
+
+ typename std::list<E>::const_iterator iter = this->current;
+ return *( iter-- );
+ }
+
+ virtual int nextIndex() const {
+ if( this->current == this->list->end() ) {
+ return this->list->size();
+ }
+
+ return std::distance( this->list->begin(), this->current );
+ }
+
+ virtual int previousIndex() const {
+ if( this->current == this->list->begin() ) {
+ return -1;
+ }
+
+ return std::distance( this->list->begin(), this->current ) - 1;
+ }
+
+ };
+
+ class ConstStlListIterator : public decaf::util::ListIterator<E> {
+ private:
+
+ typename std::list<E>::const_iterator current;
+ typename std::list<E>::const_iterator prev;
+ const typename std::list<E>* list;
+
+ public:
+
+ ConstStlListIterator( const typename std::list<E>* list ) {
+ this->current = list->begin();
+ this->prev = list->end();
+ this->list = list;
+ }
+ ConstStlListIterator( const typename std::list<E>* list, std::size_t index ) {
+ this->current = list->begin();
+ std::advance( this->current, index );
+ this->prev = list->end();
+ this->list = list;
+ }
+ virtual ~ConstStlListIterator() {}
+
+ 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->prev = this->current;
+ return *( this->current++ );
+ }
+
+ virtual bool hasNext() const {
+ return ( this->current != list->end() );
+ }
+
+ virtual void remove() throw ( lang::exceptions::IllegalStateException,
+ lang::exceptions::UnsupportedOperationException ){
+
+ throw lang::exceptions::UnsupportedOperationException(
+ __FILE__, __LINE__,
+ "List::ListIterator::remove - Const Iterator." );
+ }
+
+ virtual void add( const E& e DECAF_UNUSED )
+ throw ( decaf::lang::exceptions::UnsupportedOperationException,
+ decaf::lang::exceptions::IllegalArgumentException ) {
+
+ throw lang::exceptions::UnsupportedOperationException(
+ __FILE__, __LINE__,
+ "List::ListIterator::add - Const Iterator." );
+ }
+
+ virtual void set( const E& e DECAF_UNUSED )
+ throw ( decaf::lang::exceptions::UnsupportedOperationException,
+ decaf::lang::exceptions::IllegalArgumentException,
+ decaf::lang::exceptions::IllegalStateException )
+ {
+ throw lang::exceptions::UnsupportedOperationException(
+ __FILE__, __LINE__,
+ "List::ListIterator::set - Const Iterator." );
+ }
+
+ virtual bool hasPrevious() const {
+ return ( this->current != this->list->begin() );
+ }
+
+ virtual const E& previous() {
+ if( this->current == this->list->begin() ) {
+ throw lang::exceptions::NoSuchElementException(
+ __FILE__, __LINE__,
+ "List::ListIterator::previous - No Previous element." );
+ }
+
+ typename std::list<E>::const_iterator iter = this->current;
+ return *( iter-- );
+ }
+
+ virtual int nextIndex() const {
+ if( this->current == this->list->end() ) {
+ return this->list->size();
+ }
+
+ return std::distance( this->list->begin(), this->current );
+ }
+
+ virtual int previousIndex() const {
+ if( this->current == this->list->begin() ) {
+ return -1;
+ }
+
+ return std::distance( this->list->begin(), this->current ) - 1;
+ }
+ };
+
+ public:
+
+ /**
+ * Default constructor - does nothing.
+ */
+ StlList() {}
+
+ /**
+ * Copy constructor - copies the content of the given set into this
+ * one.
+ * @param source The source set.
+ */
+ StlList( const StlList& source ) : List<E>() {
+ copy( source );
+ }
+
+ /**
+ * Copy constructor - copies the content of the given set into this
+ * one.
+ * @param source The source set.
+ */
+ StlList( const Collection<E>& source ) : List<E>() {
+ copy( source );
+ }
+
+ virtual ~StlList() {}
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool equals( const StlList& source ) const {
+ return this->values == source.values;
+ }
+ virtual bool equals( const Collection<E>& source ) const {
+ if( this->values.size() != source.size() ) {
+ return false;
+ }
+
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ std::auto_ptr< Iterator<E> > thisIter( this->iterator() );
+
+ while( srcIter->hasNext() ) {
+ if( !( thisIter->next() == srcIter->next() ) ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual Iterator<E>* iterator() {
+ return new StlListIterator( &values );
+ }
+ virtual Iterator<E>* iterator() const {
+ return new ConstStlListIterator( &values );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual ListIterator<E>* listIterator() {
+ return new StlListIterator( &values );
+ }
+ virtual ListIterator<E>* listIterator() const {
+ return new ConstStlListIterator( &values );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual ListIterator<E>* listIterator( std::size_t index )
+ throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
+
+ if( index >= this->size() ) {
+ throw decaf::lang::exceptions::IndexOutOfBoundsException(
+ __FILE__, __LINE__,
+ "List::listIterator - Index greater than size()" );
+ }
+
+ return new StlListIterator( &values, index );
+ }
+ virtual ListIterator<E>* listIterator( std::size_t index ) const
+ throw( decaf::lang::exceptions::IndexOutOfBoundsException ) {
+
+ if( index >= this->size() ) {
+ throw decaf::lang::exceptions::IndexOutOfBoundsException(
+ __FILE__, __LINE__,
+ "List::listIterator - Index greater than size()" );
+ }
+
+ return new ConstStlListIterator( &values, index );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual void copy( const StlList& source ) {
+ this->values.clear();
+ this->values = source.values;
+ }
+ virtual void copy( const Collection<E>& source ) {
+ this->values.clear();
+
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ this->add( srcIter->next() );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual void clear() throw ( lang::exceptions::UnsupportedOperationException ) {
+ values.clear();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool contains( const E& value ) const throw ( lang::Exception ) {
+ typename std::list<E>::const_iterator iter;
+ iter = std::find( values.begin(), values.end(), value );
+ return iter != values.end();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool containsAll( const Collection<E>& source ) const
+ throw ( lang::Exception ) {
+
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ if( !this->contains( srcIter->next() ) ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual std::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 );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual std::size_t lastIndexOf( const E& value )
+ throw ( decaf::lang::exceptions::NoSuchElementException ) {
+
+ 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;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool isEmpty() const {
+ return values.empty();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual std::size_t size() const {
+ return values.size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ 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 );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual E set( std::size_t index, const 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;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool add( const E& value )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ values.insert( values.end(), value );
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual void add( std::size_t index, const E& element )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ 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 );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool addAll( const Collection<E>& source )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ return this->addAll( 0, source );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool addAll( std::size_t index, const Collection<E>& source )
+ throw ( decaf::lang::exceptions::UnsupportedOperationException,
+ decaf::lang::exceptions::IndexOutOfBoundsException ) {
+
+ if( index != 0 && index > this->size() ) {
+ throw decaf::lang::exceptions::IndexOutOfBoundsException(
+ __FILE__, __LINE__,
+ "List::addAll - Index greater than size()" );
+ }
+
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ this->add( index++, srcIter->next() );
+ }
+
+ return !source.isEmpty();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool remove( const E& value )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ std::size_t origSize = this->size();
+ this->values.remove( value );
+ return origSize != this->size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual E remove( std::size_t index )
+ throw ( decaf::lang::exceptions::UnsupportedOperationException,
+ 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 );
+ E oldValue = *iter;
+ this->values.erase( iter );
+
+ return oldValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool removeAll( const Collection<E>& source )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ std::size_t origSize = this->size();
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ this->remove( srcIter->next() );
+ }
+
+ return origSize == this->size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool retainAll( const Collection<E>& collection )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ bool result = false;
+ std::auto_ptr< Iterator<E> > iter( this->iterator() );
+ while( iter->hasNext() ) {
+ if( !collection.contains( iter->next() ) ) {
+ iter->remove();
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ 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:
+
+ virtual void lock() throw( lang::Exception ) {
+ mutex.lock();
+ }
+
+ virtual void unlock() throw( lang::Exception ) {
+ mutex.unlock();
+ }
+
+ virtual void wait() throw( lang::Exception ) {
+ mutex.wait();
+ }
+
+ virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
+ mutex.wait( millisecs );
+ }
+
+ virtual void notify() throw( lang::Exception ) {
+ mutex.notify();
+ }
+
+ virtual void notifyAll() throw( lang::Exception ) {
+ mutex.notifyAll();
+ }
+
+ };
+
+}}
+
+#endif /*_DECAF_UTIL_STLLIST_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h
------------------------------------------------------------------------------
svn:eol-style = native
Copied: activemq/activemq-cpp/trunk/src/main/decaf/util/StlMap.h (from r743068, activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.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/STLMap.h&r1=743068&r2=743923&rev=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/STLMap.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/StlMap.h Thu Feb 12 23:19:54 2009
@@ -33,8 +33,8 @@
* a more user-friendly interface and to provide common
* functions that do not exist in std::map.
*/
- template <typename K, typename V, typename COMPARATOR = std::less<K> > class STLMap :
- public Map<K, V, COMPARATOR> {
+ template <typename K, typename V, typename COMPARATOR = std::less<K> >
+ class StlMap : public Map<K, V, COMPARATOR> {
private:
std::map<K,V,COMPARATOR> valueMap;
@@ -45,14 +45,14 @@
/**
* Default constructor - does nothing.
*/
- STLMap() : Map<K,V,COMPARATOR>() {}
+ StlMap() : Map<K,V,COMPARATOR>() {}
/**
* Copy constructor - copies the content of the given map into this
* one.
* @param source The source map.
*/
- STLMap( const STLMap& source ) : Map<K,V,COMPARATOR>() {
+ StlMap( const StlMap& source ) : Map<K,V,COMPARATOR>() {
copy( source );
}
@@ -61,11 +61,11 @@
* one.
* @param source The source map.
*/
- STLMap( const Map<K,V,COMPARATOR>& source ) : Map<K,V,COMPARATOR>() {
+ StlMap( const Map<K,V,COMPARATOR>& source ) : Map<K,V,COMPARATOR>() {
copy( source );
}
- virtual ~STLMap() {}
+ virtual ~StlMap() {}
/**
* Comparison, equality is dependent on the method of determining
@@ -73,7 +73,7 @@
* @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 STLMap& source ) const {
+ virtual bool equals( const StlMap& source ) const {
return this->valueMap == source.valueMap;
}
@@ -99,7 +99,7 @@
* all existing data in this map.
* @param source The source object to copy from.
*/
- virtual void copy( const STLMap& source ) {
+ virtual void copy( const StlMap& source ) {
this->valueMap.clear();
this->valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
}
@@ -198,7 +198,7 @@
* @param key The target key.
* @param value The value to be set.
*/
- virtual void putAll( const STLMap<K,V,COMPARATOR>& other ) {
+ 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 ) {
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/StlQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/StlQueue.h?rev=743923&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/StlQueue.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/StlQueue.h Thu Feb 12 23:19:54 2009
@@ -0,0 +1,265 @@
+/*
+ * 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.
+ */
+#ifndef _DECAF_UTIL_STLQUEUE_H_
+#define _DECAF_UTIL_STLQUEUE_H_
+
+#include <list>
+#include <vector>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/lang/Exception.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.
+ *
+ * Queue is implemented with an instance of the STL queue object.
+ * The interface is essentially the same as that of the STL queue
+ * except that the pop method actually reaturns a reference to the
+ * element popped. This frees the app from having to call the
+ * <code>front</code> method before calling pop.
+ *
+ * Queue<string> sq; // make a queue to hold string messages
+ * sq.push(s); // enqueues a message m
+ * string s = sq.pop(); // dequeues a message
+ *
+ * = DESIGN CONSIDERATIONS
+ *
+ * The Queue class inherits from the Synchronizable interface and
+ * provides methods for locking and unlocking this queue as well as
+ * waiting on this queue. In a multi-threaded app this can allow
+ * for multiple threads to be reading from and writing to the same
+ * Queue.
+ *
+ * Clients should consider that in a multiple threaded app it is
+ * possible that items could be placed on the queue faster than
+ * you are taking them off, so protection should be placed in your
+ * polling loop to ensure that you don't get stuck there.
+ */
+
+ template <typename T> class StlQueue : public concurrent::Synchronizable {
+ public:
+
+ StlQueue() {}
+ virtual ~StlQueue() {}
+
+ /**
+ * 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)
+ */
+ const T& front() const {
+ if( queue.empty() ) {
+ return getSafeValue();
+ }
+
+ return queue.front();
+ }
+
+ /**
+ * Returns a Reference to the element at the tail of the queue
+ * @return reference to a queue type object or (safe)
+ */
+ 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;
+ }
+
+ /**
+ * Gets the Number of elements currently in the Queue
+ * @return Queue Size
+ */
+ size_t size() const{
+ return queue.size();
+ }
+
+ /**
+ * Checks if this Queue is currently empty
+ * @return boolean indicating queue emptiness
+ */
+ bool empty() const {
+ return queue.empty();
+ }
+
+ /**
+ * @return the all values in this queue as a std::vector.
+ */
+ virtual std::vector<T> toArray() const {
+ std::vector<T> valueArray( queue.begin(), queue.end() );
+ return valueArray;
+ }
+
+ /**
+ * 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.
+ */
+ void reverse( StlQueue<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;
+
+ };
+
+}}
+
+#endif /*_DECAF_UTIL_STLQUEUE_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/StlQueue.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h?rev=743923&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h Thu Feb 12 23:19:54 2009
@@ -0,0 +1,368 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_UTIL_STLSET_H_
+#define _DECAF_UTIL_STLSET_H_
+
+#include <set>
+#include <vector>
+#include <memory>
+#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/concurrent/Synchronizable.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/Set.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::set.
+ */
+ template <typename E>
+ class StlSet : public decaf::util::Set<E> {
+ private:
+
+ std::set<E> values;
+ util::concurrent::Mutex mutex;
+
+ private:
+
+ class SetIterator : public Iterator<E> {
+ private:
+
+ typename std::set<E>::iterator current;
+ typename std::set<E>::iterator previous;
+ typename std::set<E>* set;
+
+ public:
+
+ SetIterator( typename std::set<E>* set ) {
+ this->current = set->begin();
+ this->previous = set->end();
+ this->set = set;
+ }
+ virtual ~SetIterator() {}
+
+ virtual E next() throw( lang::exceptions::NoSuchElementException ){
+ if( this->current == set->end() ) {
+ throw lang::exceptions::NoSuchElementException(
+ __FILE__, __LINE__,
+ "Set::Iterator::next - No more elements to return" );
+ }
+
+ this->previous = this->current;
+ return *( this->current++ );
+ }
+
+ virtual bool hasNext() const {
+ return ( this->current != set->end() );
+ }
+
+ virtual void remove() throw ( lang::exceptions::IllegalStateException,
+ lang::exceptions::UnsupportedOperationException ){
+ if( this->previous == set->end() ) {
+ throw lang::exceptions::IllegalStateException(
+ __FILE__, __LINE__,
+ "Set::Iterator::remove - Invalid State to call remove" );
+ }
+
+ this->set->erase( this->previous );
+ this->previous = this->set->end();
+ }
+ };
+
+ class ConstSetIterator : public Iterator<E> {
+ private:
+
+ typename std::set<E>::const_iterator current;
+ typename std::set<E>::const_iterator previous;
+ const typename std::set<E>* set;
+
+ public:
+
+ ConstSetIterator( const typename std::set<E>* set ) {
+ this->current = set->begin();
+ this->previous = set->end();
+ this->set = set;
+ }
+ virtual ~ConstSetIterator() {}
+
+ virtual E next() throw( lang::exceptions::NoSuchElementException ){
+ if( this->current == set->end() ) {
+ throw lang::exceptions::NoSuchElementException(
+ __FILE__, __LINE__,
+ "Set::Iterator::next - No more elements to return" );
+ }
+
+ this->previous = this->current;
+ return *( this->current++ );
+ }
+
+ virtual bool hasNext() const {
+ return ( this->current != set->end() );
+ }
+
+ virtual void remove() throw ( lang::exceptions::IllegalStateException,
+ lang::exceptions::UnsupportedOperationException ){
+ throw lang::exceptions::UnsupportedOperationException(
+ __FILE__, __LINE__,
+ "Set::Iterator::remove - Not Valid on a Const Iterator" );
+ }
+ };
+
+ public:
+
+ /**
+ * Default constructor - does nothing.
+ */
+ StlSet() {}
+
+ /**
+ * Copy constructor - copies the content of the given set into this
+ * one.
+ * @param source The source set.
+ */
+ StlSet( const StlSet& source ){
+ copy( source );
+ }
+
+ /**
+ * Copy constructor - copies the content of the given set into this
+ * one.
+ * @param source The source set.
+ */
+ StlSet( const Collection<E>& source ){
+ copy( source );
+ }
+
+ virtual ~StlSet() {}
+
+ /**
+ * {@inheritDoc}
+ */
+ Iterator<E>* iterator() {
+ return new SetIterator( &values );
+ }
+ Iterator<E>* iterator() const {
+ return new ConstSetIterator( &values );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool equals( const StlSet& source ) const {
+ return this->values == source.values;
+ }
+ virtual bool equals( const Collection<E>& source ) const {
+ if( this->values.size() != source.size() ) {
+ return false;
+ }
+
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ std::auto_ptr< Iterator<E> > thisIter( this->iterator() );
+
+ while( srcIter->hasNext() ) {
+ if( !( thisIter->next() == srcIter->next() ) ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual void copy( const StlSet& source ) {
+ this->values.clear();
+ this->values = source.values;
+ }
+ virtual void copy( const Collection<E>& source ) {
+ this->values.clear();
+
+ std::auto_ptr< Iterator<E> > iter( source.iterator() );
+ while( iter->hasNext() ) {
+ this->values.insert( iter->next() );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual void clear() throw ( lang::exceptions::UnsupportedOperationException ) {
+ values.clear();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool contains( const E& value ) const throw ( lang::Exception ) {
+ typename std::set<E>::const_iterator iter;
+ iter = values.find( value );
+ return iter != values.end();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool containsAll( const Collection<E>& source ) const
+ throw ( lang::Exception ) {
+
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ if( !this->contains( srcIter->next() ) ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @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();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool add( const E& value )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ return values.insert( value ).second;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool addAll( const Collection<E>& source )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ bool result = false;
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ result = this->add( srcIter->next() );
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool remove( const E& value )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ return values.erase( value ) != 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool removeAll( const Collection<E>& source )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ bool result = false;
+ std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
+ while( srcIter->hasNext() ) {
+ result = this->remove( srcIter->next() );
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual bool retainAll( const Collection<E>& collection )
+ throw ( lang::exceptions::UnsupportedOperationException,
+ lang::exceptions::IllegalArgumentException ) {
+
+ bool result = false;
+ std::auto_ptr< Iterator<E> > iter( this->iterator() );
+ while( iter->hasNext() ) {
+ if( !collection.contains( iter->next() ) ) {
+ iter->remove();
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ virtual std::vector<E> toArray() const {
+ std::vector<E> valueArray( values.size() );
+
+ typename std::set<E>::const_iterator iter;
+ iter=values.begin();
+ for( int ix=0; iter != values.end(); ++iter, ++ix ){
+ valueArray[ix] = *iter;
+ }
+
+ return valueArray;
+ }
+
+ public:
+
+ virtual void lock() throw( lang::Exception ) {
+ mutex.lock();
+ }
+
+ virtual void unlock() throw( lang::Exception ) {
+ mutex.unlock();
+ }
+
+ virtual void wait() throw( lang::Exception ) {
+ mutex.wait();
+ }
+
+ virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
+ mutex.wait( millisecs );
+ }
+
+ virtual void notify() throw( lang::Exception ) {
+ mutex.notify();
+ }
+
+ virtual void notifyAll() throw( lang::Exception ) {
+ mutex.notifyAll();
+ }
+
+ };
+
+}}
+
+#endif /*_DECAF_UTIL_STLSET_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h
------------------------------------------------------------------------------
svn:eol-style = native
Copied: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentStlMap.h (from r743103, activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentSTLMap.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentStlMap.h?p2=activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentStlMap.h&p1=activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentSTLMap.h&r1=743103&r2=743923&rev=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentSTLMap.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ConcurrentStlMap.h Thu Feb 12 23:19:54 2009
@@ -41,7 +41,7 @@
* Java HashTable.
*/
template <typename K, typename V, typename COMPARATOR = std::less<K> >
- class ConcurrentSTLMap : public ConcurrentMap<K, V, COMPARATOR> {
+ class ConcurrentStlMap : public ConcurrentMap<K, V, COMPARATOR> {
private:
std::map<K,V,COMPARATOR> valueMap;
@@ -52,14 +52,14 @@
/**
* Default constructor - does nothing.
*/
- ConcurrentSTLMap() : ConcurrentMap<K,V,COMPARATOR>() {}
+ ConcurrentStlMap() : ConcurrentMap<K,V,COMPARATOR>() {}
/**
* Copy constructor - copies the content of the given map into this
* one.
* @param source The source map.
*/
- ConcurrentSTLMap( const ConcurrentSTLMap& source ) : ConcurrentMap<K,V,COMPARATOR>() {
+ ConcurrentStlMap( const ConcurrentStlMap& source ) : ConcurrentMap<K,V,COMPARATOR>() {
copy( source );
}
@@ -68,11 +68,11 @@
* one.
* @param source The source map.
*/
- ConcurrentSTLMap( const Map<K,V,COMPARATOR>& source ) : ConcurrentMap<K,V,COMPARATOR>() {
+ ConcurrentStlMap( const Map<K,V,COMPARATOR>& source ) : ConcurrentMap<K,V,COMPARATOR>() {
copy( source );
}
- virtual ~ConcurrentSTLMap() {}
+ virtual ~ConcurrentStlMap() {}
/**
* Comparison, equality is dependent on the method of determining
@@ -80,7 +80,7 @@
* @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 ConcurrentSTLMap& source ) const {
+ virtual bool equals( const ConcurrentStlMap& source ) const {
synchronized( &mutex ) {
return this->valueMap == source.valueMap;
}
@@ -113,7 +113,7 @@
* all existing data in this map.
* @param source The source object to copy from.
*/
- virtual void copy( const ConcurrentSTLMap& source ) {
+ virtual void copy( const ConcurrentStlMap& source ) {
synchronized( &mutex ) {
this->valueMap.clear();
this->valueMap.insert( source.valueMap.begin(), source.valueMap.end() );
@@ -237,7 +237,7 @@
* @param key The target key.
* @param value The value to be set.
*/
- virtual void putAll( const ConcurrentSTLMap<K,V,COMPARATOR>& other ) {
+ virtual void putAll( const ConcurrentStlMap<K,V,COMPARATOR>& other ) {
synchronized( &mutex ) {
this->valueMap.insert( other.valueMap.begin(), other.valueMap.end() );
}
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h Thu Feb 12 23:19:54 2009
@@ -22,7 +22,7 @@
#include <decaf/util/concurrent/PooledThreadListener.h>
#include <decaf/util/concurrent/TaskListener.h>
#include <decaf/util/concurrent/Mutex.h>
-#include <decaf/util/Queue.h>
+#include <decaf/util/StlQueue.h>
#include <decaf/util/logging/LoggerDefines.h>
#include <decaf/util/Config.h>
@@ -40,16 +40,15 @@
* is queued then a new batch is allocated. The user can specify
* the size of the blocks, otherwise a default value is used.
* <P>
- * When the user queues a task they must also queue a listner to
+ * When the user queues a task they must also queue a listener to
* be notified when the task has completed, this provides the user
* with a mechanism to know when a task object can be freed.
* <P>
* To have the Thread Pool perform a task, the user enqueue's an
- * object that implements the <code>Runnable</code> insterface and
+ * object that implements the <code>Runnable</code> interface and
* one of the worker threads will executing it in its thread context.
*/
- class DECAF_API ThreadPool : public PooledThreadListener
- {
+ class DECAF_API ThreadPool : public PooledThreadListener {
public:
// Constants
@@ -65,18 +64,18 @@
std::vector< PooledThread* > pool;
// Queue of Task that are in need of completion
- util::Queue<Task> queue;
+ util::StlQueue<Task> queue;
- // Max number of Threads this Pool can contian
+ // Max number of Threads this Pool can contain
std::size_t maxThreads;
// Max number of tasks that can be allocated at a time
std::size_t blockSize;
- // boolean flag use to indocate that this object is shutting down.
+ // boolean flag use to indicate that this object is shutting down.
bool shutdown;
- // Count of threads that are currently free to perfom some work.
+ // Count of threads that are currently free to perform some work.
std::size_t freeThreads;
// Mutex for locking operations that affect the pool.
@@ -123,7 +122,7 @@
* Returns the current number of Threads in the Pool, this is
* how many there are now, not how many are active or the max
* number that might exist.
- * @return integer number of threads in existance.
+ * @return integer number of threads in existence.
*/
virtual std::size_t getPoolSize() const { return pool.size(); }
@@ -175,9 +174,9 @@
/**
* Returns the current number of available threads in the pool, threads
* that are performing a user task are considered unavailable. This value
- * could change immeadiately after calling as Threads could finish right
+ * could change immediately after calling as Threads could finish right
* after and be available again. This is informational only.
- * @return totoal free threads
+ * @return total free threads
*/
virtual std::size_t getFreeThreadCount() const {
return freeThreads;
@@ -208,7 +207,7 @@
* the callee should assume that the PooledThread is now no longer
* running.
* @param thread Pointer to the Pooled Thread that is making this call
- * @param ex The Exception that occured.
+ * @param ex The Exception that occurred.
*/
virtual void onTaskException( PooledThread* thread,
lang::Exception& ex );
@@ -226,7 +225,7 @@
private:
/**
- * Allocates the requested ammount of Threads, won't exceed
+ * Allocates the requested amount of Threads, won't exceed
* <code>maxThreads</code>.
* @param count the number of threads to create
*/
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=743923&r1=743922&r2=743923&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 Thu Feb 12 23:19:54 2009
@@ -17,7 +17,7 @@
#include "MapBenchmark.h"
#include <decaf/lang/Integer.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
using namespace decaf;
using namespace decaf::util;
@@ -33,8 +33,8 @@
int numRuns = 500;
std::string test = "test";
std::string resultStr = "";
- STLMap<std::string, std::string> stringCopy;
- STLMap<int, int> intCopy;
+ StlMap<std::string, std::string> stringCopy;
+ StlMap<int, int> intCopy;
for( int i = 0; i < numRuns; ++i ) {
stringMap.put( test + Integer::toString(i), test + Integer::toString(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=743923&r1=743922&r2=743923&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 Thu Feb 12 23:19:54 2009
@@ -19,7 +19,7 @@
#define _DECAF_UTIL_MAPBENCHMARK_H_
#include <benchmark/BenchmarkBase.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
namespace decaf{
namespace util{
@@ -30,8 +30,8 @@
{
private:
- STLMap< std::string, std::string> stringMap;
- STLMap<int, int> intMap;
+ StlMap< std::string, std::string> stringMap;
+ StlMap<int, int> intMap;
public:
Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.cpp Thu Feb 12 23:19:54 2009
@@ -35,8 +35,8 @@
std::string test = "test";
std::string resultStr = "";
int resultInt = 0;
- Queue<std::string> stringQCopy;
- Queue<int> intQCopy;
+ StlQueue<std::string> stringQCopy;
+ StlQueue<int> intQCopy;
for( int i = 0; i < numRuns; ++i ) {
stringQ.push( test );
Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/QueueBenchmark.h Thu Feb 12 23:19:54 2009
@@ -19,19 +19,19 @@
#define _DECAF_QUEUE_QUEUEBENCHMARK_H_
#include <benchmark/BenchmarkBase.h>
-#include <decaf/util/Queue.h>
+#include <decaf/util/StlQueue.h>
namespace decaf{
namespace util{
class QueueBenchmark :
public benchmark::BenchmarkBase<
- decaf::util::QueueBenchmark, Queue<int> >
+ decaf::util::QueueBenchmark, StlQueue<int> >
{
private:
- Queue<std::string> stringQ;
- Queue<int> intQ;
+ StlQueue<std::string> stringQ;
+ StlQueue<int> intQ;
public:
Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.cpp Thu Feb 12 23:19:54 2009
@@ -34,8 +34,8 @@
int numRuns = 500;
std::string test = "test";
std::string resultStr = "";
- Set<std::string> stringCopy;
- Set<int> intCopy;
+ StlSet<std::string> stringCopy;
+ StlSet<int> intCopy;
for( int i = 0; i < numRuns; ++i ) {
stringSet.add( test + Integer::toString(i) );
Modified: activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h (original)
+++ activemq/activemq-cpp/trunk/src/test-benchmarks/decaf/util/SetBenchmark.h Thu Feb 12 23:19:54 2009
@@ -19,7 +19,7 @@
#define _DECAF_UTIL_SETBENCHMARK_H_
#include <benchmark/BenchmarkBase.h>
-#include <decaf/util/Set.h>
+#include <decaf/util/StlSet.h>
namespace decaf{
namespace util{
@@ -30,8 +30,8 @@
{
private:
- Set<int> intSet;
- Set<std::string> stringSet;
+ StlSet<int> intSet;
+ StlSet<std::string> stringSet;
public:
Modified: activemq/activemq-cpp/trunk/src/test-integration/activemq/test/SlowListenerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test-integration/activemq/test/SlowListenerTest.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test-integration/activemq/test/SlowListenerTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test-integration/activemq/test/SlowListenerTest.cpp Thu Feb 12 23:19:54 2009
@@ -20,7 +20,7 @@
#include <decaf/lang/Thread.h>
#include <decaf/util/concurrent/Mutex.h>
#include <decaf/util/Date.h>
-#include <decaf/util/Set.h>
+#include <decaf/util/StlSet.h>
#include <activemq/exceptions/ActiveMQException.h>
@@ -43,7 +43,7 @@
public:
unsigned int count;
- decaf::util::Set<long long> threadIds;
+ decaf::util::StlSet<long long> threadIds;
SlowListener() { count = 0; }
Modified: activemq/activemq-cpp/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/Makefile.am?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/test/Makefile.am Thu Feb 12 23:19:54 2009
@@ -99,11 +99,11 @@
decaf/util/UUIDTest.cpp \
decaf/util/RandomTest.cpp \
decaf/util/MapTest.cpp \
- decaf/util/STLMapTest.cpp \
+ decaf/util/StlMapTest.cpp \
decaf/util/QueueTest.cpp \
decaf/util/ListTest.cpp \
decaf/util/SetTest.cpp \
- decaf/util/concurrent/ConcurrentSTLMapTest.cpp \
+ decaf/util/concurrent/ConcurrentStlMapTest.cpp \
decaf/util/concurrent/CountDownLatchTest.cpp \
decaf/util/concurrent/MutexTest.cpp \
decaf/util/concurrent/ThreadPoolTest.cpp \
@@ -200,10 +200,10 @@
decaf/util/RandomTest.h \
decaf/util/ListTest.h \
decaf/util/MapTest.h \
- decaf/util/STLMapTest.h \
+ decaf/util/StlMapTest.h \
decaf/util/QueueTest.h \
decaf/util/SetTest.h \
- decaf/util/concurrent/ConcurrentSTLMapTest.h \
+ decaf/util/concurrent/ConcurrentStlMapTest.h \
decaf/util/concurrent/CountDownLatchTest.h \
decaf/util/concurrent/MutexTest.h \
decaf/util/concurrent/ThreadPoolTest.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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/commands/BrokerIdTest.cpp Thu Feb 12 23:19:54 2009
@@ -18,7 +18,7 @@
#include "BrokerIdTest.h"
#include <activemq/commands/BrokerId.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
#include <decaf/lang/Pointer.h>
#include <decaf/lang/Comparable.h>
@@ -66,7 +66,7 @@
myCommand2.setValue( "B" );
myCommand3.setValue( "C" );
- STLMap< BrokerId*, int, BrokerIdComparitor > testMap;
+ StlMap< BrokerId*, int, BrokerIdComparitor > testMap;
testMap.put( &myCommand1, 0 );
testMap.put( &myCommand3, 0 );
@@ -93,7 +93,7 @@
CPPUNIT_ASSERT( myCommand1->compareTo( *myCommand2 ) == 0 );
CPPUNIT_ASSERT( myCommand1->compareTo( *myCommand3 ) == -1 );
- STLMap< Pointer<BrokerId>, int, COMPARATOR > testMap;
+ StlMap< Pointer<BrokerId>, int, COMPARATOR > testMap;
testMap.put( myCommand3, 0 );
testMap.put( myCommand1, 0 );
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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/lang/SystemTest.cpp Thu Feb 12 23:19:54 2009
@@ -18,7 +18,7 @@
#include "SystemTest.h"
#include <decaf/lang/System.h>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
using namespace std;
using namespace decaf;
@@ -44,7 +44,7 @@
////////////////////////////////////////////////////////////////////////////////
void SystemTest::test_getenv2() {
- STLMap<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() {
- STLMap<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" );
- STLMap<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() {
- STLMap<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" );
- STLMap<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" );
- STLMap<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/ListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.cpp Thu Feb 12 23:19:54 2009
@@ -17,6 +17,10 @@
#include "ListTest.h"
+#include <decaf/util/List.h>
+#include <decaf/util/StlList.h>
+#include <decaf/util/Iterator.h>
+
using namespace std;
using namespace decaf;
using namespace decaf::util;
@@ -28,7 +32,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testContains(){
- List<string> list;
+ StlList<string> list;
CPPUNIT_ASSERT( list.contains( "bob" ) == false);
list.add( "bob" );
@@ -40,7 +44,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testIndexOf(){
- List<string> list;
+ StlList<string> list;
list.add( "bob" ); // 0
list.add( "fred" ); // 1
@@ -68,7 +72,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testLastIndexOf(){
- List<string> list;
+ StlList<string> list;
list.add( "bob" ); // 0
list.add( "fred" ); // 1
@@ -99,7 +103,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testClear(){
- List<string> list;
+ StlList<string> list;
list.add( "bob" );
list.add( "fred" );
@@ -111,7 +115,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testIsEmpty(){
- List<string> list;
+ StlList<string> list;
list.add( "bob" );
list.add( "fred" );
@@ -123,7 +127,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testSize(){
- List<string> list;
+ StlList<string> list;
CPPUNIT_ASSERT( list.size() == 0 );
list.add( "bob" );
@@ -134,7 +138,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testGet(){
- List<string> list;
+ StlList<string> list;
list.add( "fred" );
list.add( "fred" );
@@ -151,7 +155,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testSet(){
- List<string> list;
+ StlList<string> list;
list.add( "fred" );
list.add( "fred" );
@@ -174,7 +178,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testAdd(){
- List<string> list;
+ StlList<string> list;
list.add( "fred" );
list.add( "fred" );
@@ -188,7 +192,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testAdd2(){
- List<string> list;
+ StlList<string> list;
list.add( "fred" );
list.add( "fred" );
@@ -223,7 +227,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testRemove(){
- List<string> list;
+ StlList<string> list;
list.add( "fred" );
CPPUNIT_ASSERT( list.contains( "fred" ) == true );
@@ -233,7 +237,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testRemove2(){
- List<string> list;
+ StlList<string> list;
list.add( "fred" );
list.add( "bob" );
@@ -256,7 +260,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testToArray(){
- List<string> list;
+ StlList<string> list;
list.add( "fred1" );
list.add( "fred2" );
@@ -271,7 +275,7 @@
////////////////////////////////////////////////////////////////////////////////
void ListTest::testIterator(){
- List<string> list;
+ StlList<string> list;
list.add( "fred1" );
list.add( "fred2" );
Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/ListTest.h Thu Feb 12 23:19:54 2009
@@ -21,9 +21,6 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <decaf/util/List.h>
-#include <decaf/util/Iterator.h>
-
namespace decaf{
namespace util{
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=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/MapTest.cpp Thu Feb 12 23:19:54 2009
@@ -17,7 +17,7 @@
#include "MapTest.h"
#include <string>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
using namespace std;
using namespace decaf;
@@ -34,7 +34,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testContainsKey(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
CPPUNIT_ASSERT(boolMap.containsKey("bob") == false);
boolMap.put( "bob", true );
@@ -46,7 +46,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testClear(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
boolMap.put( "bob", true );
boolMap.put( "fred", true );
@@ -58,7 +58,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testIsEmpty(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
boolMap.put( "bob", true );
boolMap.put( "fred", true );
@@ -70,7 +70,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testSize(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
CPPUNIT_ASSERT(boolMap.size() == 0 );
boolMap.put( "bob", true );
@@ -82,7 +82,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testValue(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
boolMap.put( "fred", true );
CPPUNIT_ASSERT( boolMap.get("fred") == true );
@@ -100,7 +100,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testRemove(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
boolMap.put( "fred", true );
CPPUNIT_ASSERT( boolMap.containsKey("fred") == true );
@@ -110,7 +110,7 @@
////////////////////////////////////////////////////////////////////////////////
void MapTest::testContiansValue(){
- STLMap<string, bool> boolMap;
+ StlMap<string, bool> boolMap;
boolMap.put( "fred", true );
boolMap.put( "fred1", false );
Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.cpp Thu Feb 12 23:19:54 2009
@@ -17,6 +17,8 @@
#include "QueueTest.h"
+#include <decaf/util/StlQueue.h>
+
using namespace std;
using namespace decaf;
using namespace decaf::util;
@@ -24,7 +26,7 @@
////////////////////////////////////////////////////////////////////////////////
void QueueTest::test()
{
- Queue<char> q;
+ StlQueue<char> q;
CPPUNIT_ASSERT( q.empty() == true );
CPPUNIT_ASSERT( q.size() == 0 );
Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/QueueTest.h Thu Feb 12 23:19:54 2009
@@ -21,8 +21,6 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <decaf/util/Queue.h>
-
namespace decaf{
namespace util{
Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.cpp?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.cpp Thu Feb 12 23:19:54 2009
@@ -17,6 +17,9 @@
#include "SetTest.h"
+#include <decaf/util/StlSet.h>
+#include <decaf/util/Iterator.h>
+
using namespace std;
using namespace decaf;
using namespace decaf::util;
@@ -28,7 +31,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testContains(){
- Set<string> set;
+ StlSet<string> set;
CPPUNIT_ASSERT( set.contains( "bob" ) == false);
set.add( "bob" );
@@ -40,7 +43,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testClear(){
- Set<string> set;
+ StlSet<string> set;
set.add( "bob" );
set.add( "fred" );
@@ -52,7 +55,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testIsEmpty(){
- Set<string> set;
+ StlSet<string> set;
set.add( "bob" );
set.add( "fred" );
@@ -64,7 +67,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testSize(){
- Set<string> set;
+ StlSet<string> set;
CPPUNIT_ASSERT( set.size() == 0 );
set.add( "bob" );
@@ -75,7 +78,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testAdd(){
- Set<string> set;
+ StlSet<string> set;
set.add( "fred" );
set.add( "fred" );
@@ -89,7 +92,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testRemove(){
- Set<string> set;
+ StlSet<string> set;
set.add( "fred" );
CPPUNIT_ASSERT( set.contains( "fred" ) == true );
@@ -100,7 +103,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testToArray(){
- Set<string> set;
+ StlSet<string> set;
set.add( "fred1" );
set.add( "fred2" );
@@ -115,7 +118,7 @@
////////////////////////////////////////////////////////////////////////////////
void SetTest::testIterator(){
- Set<string> set;
+ StlSet<string> set;
set.add( "fred1" );
set.add( "fred2" );
Modified: activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.h?rev=743923&r1=743922&r2=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.h (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/SetTest.h Thu Feb 12 23:19:54 2009
@@ -21,9 +21,6 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <decaf/util/Set.h>
-#include <decaf/util/Iterator.h>
-
namespace decaf{
namespace util{
Copied: activemq/activemq-cpp/trunk/src/test/decaf/util/StlMapTest.cpp (from r743068, 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?p2=activemq/activemq-cpp/trunk/src/test/decaf/util/StlMapTest.cpp&p1=activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp&r1=743068&r2=743923&rev=743923&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/decaf/util/STLMapTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/decaf/util/StlMapTest.cpp Thu Feb 12 23:19:54 2009
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-#include "STLMapTest.h"
+#include "StlMapTest.h"
#include <string>
-#include <decaf/util/STLMap.h>
+#include <decaf/util/StlMap.h>
using namespace std;
using namespace decaf;
@@ -110,7 +110,7 @@
valueMap[key] = value;
}
- virtual void putAll( const STLMap<K,V,COMPARATOR>& other DECAF_UNUSED ) {
+ virtual void putAll( const StlMap<K,V,COMPARATOR>& other DECAF_UNUSED ) {
// TODO
}
virtual void putAll( const Map<K,V,COMPARATOR>& other DECAF_UNUSED ) {
@@ -162,9 +162,9 @@
};
////////////////////////////////////////////////////////////////////////////////
-void STLMapTest::testConstructor() {
+void StlMapTest::testConstructor() {
- STLMap<string, int> map1;
+ StlMap<string, int> map1;
CPPUNIT_ASSERT( map1.isEmpty() );
CPPUNIT_ASSERT( map1.size() == 0 );
@@ -173,7 +173,7 @@
map1.get( "TEST" ),
decaf::lang::exceptions::NoSuchElementException );
- STLMap<string, int> destMap;
+ StlMap<string, int> destMap;
STLTestMap<string, int> srcMap;
srcMap.put( "A", 1 );