1 #ifndef _utl_MultiObject_h_
2 #define _utl_MultiObject_h_
5 #include <utl/IteratorRange.h>
6 #include <boost/iterator/transform_iterator.hpp>
53 template<
typename T,
typename LabeledObjectType>
56 operator()(
const typename std::map<int, T*>::value_type& pair)
const
57 {
return LabeledObjectType(pair); }
70 template<
typename T,
typename LabeledObjectType>
77 typename MultiObjectContainer::iterator,
80 typename MultiObjectContainer::const_iterator,
99 explicit operator bool()
const {
return !
fObjects.empty(); }
117 fObjects = std::move(mobj.fObjects);
125 const T&
GetObject(
const int label = 0)
const;
132 void AddObject(T*
const obj,
const int label);
boost::transform_iterator< LabeledObjectFunctor, typename MultiObjectContainer::iterator, LabeledObjectType > Iterator
LabeledObjectType operator()(const typename std::map< int, T * >::value_type &pair) const
#define OFFLINE_MAKE_BOTH_FRIEND_RANGES(_Iterator_, _ConstIterator_, _Class_)
MultiObjectContainer::const_iterator InternalConstIterator
ConstIterator End() const
LabeledObject(const std::pair< int, T * > &pair)
MultiObjectContainer::iterator InternalIterator
std::map< int, T * > MultiObjectContainer
boost::transform_iterator< LabeledObjectFunctor, typename MultiObjectContainer::const_iterator, LabeledObjectType > ConstIterator
void RemoveObject(const int label)
bool operator==(const MultiObject &mobj) const
MultiObject(MultiObject &&mobj)
ConstIterator Begin() const
LabeledObject(const int label, T &obj)
int GetLabel() const
Return the label for the object.
MultiObject & operator=(MultiObject &&mobj)
bool operator!=(const LabeledObject &lobj) const
container for object and associated labels
MultiObject(const MultiObject &mobj)
bool operator==(const LabeledObject &lobj) const
bool operator!=(const MultiObject &mobj) const
utl::detail::LabeledObjectFunctor< T, LabeledObjectType > LabeledObjectFunctor
unsigned int GetNLabels() const
const T & GetObject() const
MultiObject & operator=(const MultiObject &mobj)
Class for attaching a label to an object.
MultiObjectContainer fObjects
void AddObject(const T &obj, const int label)
add with deep copy of the object
T & GetObject(const int label=0)
bool HasLabel(const int label) const