OpenWalnut
1.4.0
|
A class containing a list of named items. More...
#include <WItemSelection.h>
Public Types | |
typedef boost::shared_ptr< WItemSelection > | SPtr |
Convenience typedef for a boost::shared_ptr< WItemSelection > More... | |
typedef boost::shared_ptr< const WItemSelection > | ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WItemSelection > More... | |
![]() | |
typedef std::vector< boost::shared_ptr< WItemSelectionItem > >::const_iterator | ConstIterator |
A typedef for the correct const iterator useful to traverse this sequence container. More... | |
typedef std::vector< boost::shared_ptr< WItemSelectionItem > >::iterator | Iterator |
A typedef for the correct iterator to traverse this sequence container. More... | |
typedef std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type | value_type |
The type of the elements. More... | |
![]() | |
typedef std::vector< boost::shared_ptr< WItemSelectionItem > > | ValueT |
The type protected by this shared object class. More... | |
typedef boost::shared_ptr< WSharedObjectTicketRead< std::vector< boost::shared_ptr< WItemSelectionItem > > > > | ReadTicket |
Type for read tickets. More... | |
typedef boost::shared_ptr< WSharedObjectTicketWrite< std::vector< boost::shared_ptr< WItemSelectionItem > > > > | WriteTicket |
Type for write tickets. More... | |
typedef boost::shared_ptr< WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > > > | SPtr |
Shared pointer abbreviation. More... | |
typedef boost::shared_ptr< WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > > > | ConstSPtr |
Const shared ptr abbreviation. More... | |
Public Member Functions | |
WItemSelection () | |
Default constructor. More... | |
virtual | ~WItemSelection () |
Destructor. More... | |
virtual WItemSelector | getSelectorAll () |
Creates an default selection (all items selected). More... | |
virtual WItemSelector | getSelectorNone () |
Creates an default selection (no items selected). More... | |
virtual WItemSelector | getSelectorFirst () |
Creates an default selection (first item selected). More... | |
virtual WItemSelector | getSelectorLast () |
Creates an default selection (last item selected). More... | |
virtual WItemSelector | getSelector (size_t item) |
Creates an default selection (a specified items selected). More... | |
void | addItem (std::string name, std::string description="", const char **icon=NULL) |
Convenience method to add a new item. More... | |
void | addItem (boost::shared_ptr< WItemSelectionItem > item) |
Method to add a new item, which can be derived from WItemSelectionItem. More... | |
![]() | |
WSharedSequenceContainer () | |
Default constructor. More... | |
virtual | ~WSharedSequenceContainer () |
Destructor. More... | |
void | push_back (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &x) |
Adds a new element at the end of the container. More... | |
void | push_front (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &x) |
Adds a new element at the beginning of the container. More... | |
void | pop_back () |
Removes an element from the end. More... | |
void | clear () |
Clears the container. More... | |
size_t | size () const |
The size of the container. More... | |
std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type & | operator[] (size_t n) |
Get item at position n. More... | |
const std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type & | operator[] (size_t n) const |
Get item at position n. More... | |
std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type & | at (size_t n) |
Get item at position n. More... | |
const std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type & | at (size_t n) const |
Get item at position n. More... | |
void | remove (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &element) |
Searches and removes the specified element. More... | |
WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator | erase (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator position) |
Erase the element at the specified position. More... | |
WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator | erase (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last) |
Erase the specified range of elements. More... | |
void | replace (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &oldValue, const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &newValue) |
Replaces the specified old value by a new one. More... | |
size_t | count (const value_type &value) |
Counts the number of occurrences of the specified value inside the container. More... | |
void | sort (Comparator comp) |
Resorts the container using the specified comparator from its begin to its end. More... | |
void | sort (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last, Comparator comp) |
Resorts the container using the specified comparator between [first,last) in ascending order. More... | |
void | stableSort (Comparator comp) |
Resorts the container using the specified comparator from its begin to its end. More... | |
void | stableSort (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last, Comparator comp) |
Resorts the container using the specified comparator between [first,last) in ascending order. More... | |
WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator | find (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last, const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &value) |
Searches the specified value in the range [first,last). More... | |
WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::ConstIterator | find (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &value) |
Searches the specified value in the range [begin,end). More... | |
![]() | |
WSharedObject () | |
Default constructor. More... | |
virtual | ~WSharedObject () |
Destructor. More... | |
ReadTicket | getReadTicket () const |
Returns a ticket to get read access to the contained data. More... | |
WriteTicket | getWriteTicket (bool suppressNotify=false) const |
Returns a ticket to get write access to the contained data. More... | |
boost::shared_ptr< WCondition > | getChangeCondition () const |
This condition fires whenever the encapsulated object changed. More... | |
Static Public Member Functions | |
static boost::shared_ptr< WItemSelectionItem > | Item (std::string name, std::string description="", const char **icon=NULL) |
Convenience method to create a new item. More... | |
Friends | |
class | WItemSelector |
Additional Inherited Members | |
![]() | |
std::vector< boost::shared_ptr< WItemSelectionItem > > | m_object |
The object wrapped by this class. More... | |
boost::shared_ptr< boost::shared_mutex > | m_lock |
The lock to ensure thread safe access. More... | |
boost::shared_ptr< WCondition > | m_changeCondition |
This condition set fires whenever the contained object changes. More... | |
A class containing a list of named items.
It is mainly a container for an std::vector but with the difference that there can be so called Selectors which are able to select some subset of the item set. This is especially useful in properties where item selection is needed. The class is kept very restrictive to keep the interface clean and sleek and to keep the item set consistent among several threads. So please do not implement any function that might change the item list, use the provided ones. If the item list changes, existing selectors get invalid automatically using the change condition of the inherited WSharedSequenceContainer.
Definition at line 49 of file WItemSelection.h.
typedef boost::shared_ptr< const WItemSelection > WItemSelection::ConstSPtr |
Convenience typedef for a boost::shared_ptr< const WItemSelection >
Definition at line 62 of file WItemSelection.h.
typedef boost::shared_ptr< WItemSelection > WItemSelection::SPtr |
Convenience typedef for a boost::shared_ptr< WItemSelection >
Definition at line 57 of file WItemSelection.h.
WItemSelection::WItemSelection | ( | ) |
Default constructor.
Definition at line 36 of file WItemSelection.cpp.
|
virtual |
Destructor.
Definition at line 42 of file WItemSelection.cpp.
void WItemSelection::addItem | ( | std::string | name, |
std::string | description = "" , |
||
const char ** | icon = NULL |
||
) |
Convenience method to add a new item.
name | name of the item |
description | the description, can be empty |
icon | the icon, can be NULL |
Definition at line 103 of file WItemSelection.cpp.
References WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::push_back().
void WItemSelection::addItem | ( | boost::shared_ptr< WItemSelectionItem > | item | ) |
Method to add a new item, which can be derived from WItemSelectionItem.
item | WItemSelectionItem or derivation which should be add. |
Definition at line 108 of file WItemSelection.cpp.
References WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::push_back().
|
virtual |
Creates an default selection (a specified items selected).
The selector gets invalid if another item is added.
item | the item to select. |
Definition at line 90 of file WItemSelection.cpp.
References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().
|
virtual |
Creates an default selection (all items selected).
The selector gets invalid if another item is added.
Definition at line 47 of file WItemSelection.cpp.
References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().
|
virtual |
Creates an default selection (first item selected).
The selector gets invalid if another item is added.
Definition at line 66 of file WItemSelection.cpp.
References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().
|
virtual |
Creates an default selection (last item selected).
The selector gets invalid if another item is added.
Definition at line 78 of file WItemSelection.cpp.
References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().
|
virtual |
Creates an default selection (no items selected).
The selector gets invalid if another item is added.
Definition at line 59 of file WItemSelection.cpp.
References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().
|
inlinestatic |
Convenience method to create a new item.
name | name of the item |
description | the description, can be empty |
icon | the icon, can be NULL |
Definition at line 120 of file WItemSelection.h.