|
OpenWalnut
1.2.5
|
This class provides a common interface for thread-safe access to sequence containers (list, vector, dequeue ). More...
#include <WSharedSequenceContainer.h>
Inheritance diagram for WSharedSequenceContainer< S >:Public Types | |
| typedef S::const_iterator | ConstIterator |
| A typedef for the correct const iterator useful to traverse this sequence container. | |
| typedef S::iterator | Iterator |
| A typedef for the correct iterator to traverse this sequence container. | |
| typedef S::value_type | value_type |
| The type of the elements. | |
Public Types inherited from WSharedObject< S > | |
| typedef boost::shared_ptr < WSharedObjectTicketRead< S > > | ReadTicket |
| Type for read tickets. | |
| typedef boost::shared_ptr < WSharedObjectTicketWrite< S > > | WriteTicket |
| Type for write tickets. | |
Public Member Functions | |
| WSharedSequenceContainer () | |
| Default constructor. | |
| virtual | ~WSharedSequenceContainer () |
| Destructor. | |
| void | push_back (const typename S::value_type &x) |
| Adds a new element at the end of the container. | |
| void | push_front (const typename S::value_type &x) |
| Adds a new element at the beginning of the container. | |
| void | pop_back () |
| Removes an element from the end. | |
| void | clear () |
| Clears the container. | |
| size_t | size () const |
| The size of the container. | |
| S::value_type & | operator[] (size_t n) |
| Get item at position n. | |
| const S::value_type & | operator[] (size_t n) const |
| Get item at position n. | |
| S::value_type & | at (size_t n) |
| Get item at position n. | |
| const S::value_type & | at (size_t n) const |
| Get item at position n. | |
| void | remove (const typename S::value_type &element) |
| Searches and removes the specified element. | |
| WSharedSequenceContainer< S > ::Iterator | erase (typename WSharedSequenceContainer< S >::Iterator position) |
| Erase the element at the specified position. | |
| WSharedSequenceContainer< S > ::Iterator | erase (typename WSharedSequenceContainer< S >::Iterator first, typename WSharedSequenceContainer< S >::Iterator last) |
| Erase the specified range of elements. | |
| void | replace (const typename S::value_type &oldValue, const typename S::value_type &newValue) |
| Replaces the specified old value by a new one. | |
| size_t | count (const value_type &value) |
| Counts the number of occurrences of the specified value inside the container. | |
| template<typename Comparator > | |
| void | sort (Comparator comp) |
| Resorts the container using the specified comparator from its begin to its end. | |
| template<typename Comparator > | |
| void | sort (typename WSharedSequenceContainer< S >::Iterator first, typename WSharedSequenceContainer< S >::Iterator last, Comparator comp) |
| Resorts the container using the specified comparator between [first,last) in ascending order. | |
| WSharedSequenceContainer< S > ::Iterator | find (typename WSharedSequenceContainer< S >::Iterator first, typename WSharedSequenceContainer< S >::Iterator last, const typename S::value_type &value) |
| Searches the specified value in the range [first,last). | |
| WSharedSequenceContainer< S > ::ConstIterator | find (const typename S::value_type &value) |
| Searches the specified value in the range [begin,end). | |
Public Member Functions inherited from WSharedObject< S > | |
| WSharedObject () | |
| Default constructor. | |
| virtual | ~WSharedObject () |
| Destructor. | |
| ReadTicket | getReadTicket () const |
| Returns a ticket to get read access to the contained data. | |
| WriteTicket | getWriteTicket (bool suppressNotify=false) const |
| Returns a ticket to get write access to the contained data. | |
| boost::shared_ptr< WCondition > | getChangeCondition () const |
| This condition fires whenever the encapsulated object changed. | |
Additional Inherited Members | |
Protected Attributes inherited from WSharedObject< S > | |
| S | m_object |
| The object wrapped by this class. | |
| boost::shared_ptr < boost::shared_mutex > | m_lock |
| The lock to ensure thread safe access. | |
| boost::shared_ptr< WCondition > | m_changeCondition |
| This condition set fires whenever the contained object changes. | |
This class provides a common interface for thread-safe access to sequence containers (list, vector, dequeue ).
| S | the sequence container to use. Everything is allowed here which provides push_back and pop_back as well as size functionality. |
Definition at line 39 of file WSharedSequenceContainer.h.
| typedef S::const_iterator WSharedSequenceContainer< S >::ConstIterator |
A typedef for the correct const iterator useful to traverse this sequence container.
Definition at line 48 of file WSharedSequenceContainer.h.
| typedef S::iterator WSharedSequenceContainer< S >::Iterator |
A typedef for the correct iterator to traverse this sequence container.
Definition at line 53 of file WSharedSequenceContainer.h.
| typedef S::value_type WSharedSequenceContainer< S >::value_type |
The type of the elements.
Definition at line 58 of file WSharedSequenceContainer.h.
| WSharedSequenceContainer< S >::WSharedSequenceContainer | ( | ) |
Default constructor.
Definition at line 245 of file WSharedSequenceContainer.h.
|
virtual |
Destructor.
Definition at line 252 of file WSharedSequenceContainer.h.
| S::value_type & WSharedSequenceContainer< S >::at | ( | size_t | n | ) |
Get item at position n.
Uses the at-method of the underlying container. Please do not use this for iteration as it locks every access. Use iterators and read/write tickets for fast iteration.
| n | the item index |
Definition at line 314 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
| const S::value_type & WSharedSequenceContainer< S >::at | ( | size_t | n | ) | const |
Get item at position n.
Uses the at-method of the underlying container. Please do not use this for iteration as it locks every access. Use iterators and read/write tickets for fast iteration.
| n | the item index |
Definition at line 322 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
| void WSharedSequenceContainer< S >::clear | ( | ) |
Clears the container.
Definition at line 282 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
| size_t WSharedSequenceContainer< S >::count | ( | const value_type & | value | ) |
Counts the number of occurrences of the specified value inside the container.
This is a comfortable forwarder for std::count.
| value | the value to count |
Definition at line 362 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
Referenced by WGEColormapping::deregisterTextureInst(), WGEColormapping::registerTextureInst(), and WGEColormapping::replaceTextureInst().
| WSharedSequenceContainer< S >::Iterator WSharedSequenceContainer< S >::erase | ( | typename WSharedSequenceContainer< S >::Iterator | position | ) |
Erase the element at the specified position.
Read your STL reference for more details.
| position | where to erase |
Definition at line 337 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
| WSharedSequenceContainer< S >::Iterator WSharedSequenceContainer< S >::erase | ( | typename WSharedSequenceContainer< S >::Iterator | first, |
| typename WSharedSequenceContainer< S >::Iterator | last | ||
| ) |
Erase the specified range of elements.
Read your STL reference for more details.
| first | Iterators specifying a range within the vector to be removed: [first,last). |
| last | Iterators specifying a range within the vector to be removed: [first,last). |
Definition at line 345 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
| WSharedSequenceContainer< S >::Iterator WSharedSequenceContainer< S >::find | ( | typename WSharedSequenceContainer< S >::Iterator | first, |
| typename WSharedSequenceContainer< S >::Iterator | last, | ||
| const typename S::value_type & | value | ||
| ) |
Searches the specified value in the range [first,last).
| first | the first element |
| last | the last element |
| value | the value to search. |
Definition at line 386 of file WSharedSequenceContainer.h.
| WSharedSequenceContainer< S >::ConstIterator WSharedSequenceContainer< S >::find | ( | const typename S::value_type & | value | ) |
Searches the specified value in the range [begin,end).
| value | the value to search. |
Definition at line 395 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
| S::value_type & WSharedSequenceContainer< S >::operator[] | ( | size_t | n | ) |
Get item at position n.
Uses the [] operator of the underlying container. Please do not use this for iteration as it locks every access. Use iterators and read/write tickets for fast iteration.
| n | the item index |
Definition at line 299 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
| const S::value_type & WSharedSequenceContainer< S >::operator[] | ( | size_t | n | ) | const |
Get item at position n.
Uses the [] operator of the underlying container. Please do not use this for iteration as it locks every access. Use iterators and read/write tickets for fast iteration.
| n | the item index |
Definition at line 307 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
| void WSharedSequenceContainer< S >::pop_back | ( | ) |
Removes an element from the end.
Definition at line 274 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
| void WSharedSequenceContainer< S >::push_back | ( | const typename S::value_type & | x | ) |
Adds a new element at the end of the container.
| x | the new element. |
Definition at line 258 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
Referenced by WSubject::addDataSet(), WLogger::addStream(), WDataHandler::addSubject(), and WLogger::WLogger().
| void WSharedSequenceContainer< S >::push_front | ( | const typename S::value_type & | x | ) |
Adds a new element at the beginning of the container.
| x | the new element. |
Definition at line 266 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
Referenced by WGEColormapping::registerTextureInst().
| void WSharedSequenceContainer< S >::remove | ( | const typename S::value_type & | element | ) |
Searches and removes the specified element.
If it is not found, nothing happens. It mainly is a comfortable forwarder for std::remove and S::erase.
| element | the element to remove |
Definition at line 329 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
Referenced by WGEColormapping::deregisterTextureInst().
| void WSharedSequenceContainer< S >::replace | ( | const typename S::value_type & | oldValue, |
| const typename S::value_type & | newValue | ||
| ) |
Replaces the specified old value by a new one.
If the old one does not exist, nothing happens. This is a comfortable forwarder for std::replace.
| oldValue | the old value to replace |
| newValue | the new value |
Definition at line 355 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
Referenced by WGEColormapping::replaceTextureInst().
| size_t WSharedSequenceContainer< S >::size | ( | ) | const |
The size of the container.
Definition at line 290 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getReadTicket().
Referenced by WGEColormapping::size(), WSubjectTest::testAddGetDataSet(), and WSubjectTest::testGetNumberOfDataSet().
| void WSharedSequenceContainer< S >::sort | ( | Comparator | comp | ) |
Resorts the container using the specified comparator from its begin to its end.
| Comparator | the comparator type. Usually a boost::function or class providing the operator(). |
| comp | the comparator |
Definition at line 370 of file WSharedSequenceContainer.h.
References WSharedObject< T >::getWriteTicket().
Referenced by WGEColormapping::sort().
| void WSharedSequenceContainer< S >::sort | ( | typename WSharedSequenceContainer< S >::Iterator | first, |
| typename WSharedSequenceContainer< S >::Iterator | last, | ||
| Comparator | comp | ||
| ) |
Resorts the container using the specified comparator between [first,last) in ascending order.
| first | the first element |
| last | the last element |
| comp | the comparator |
Definition at line 378 of file WSharedSequenceContainer.h.
1.8.1