20#ifndef HURRICANE_SET_COLLECTION
21#define HURRICANE_SET_COLLECTION
23#include "hurricane/Commons.h"
25#include "hurricane/Tabulation.h"
36template<
class Element,
class Compare = less<Element> >
43 public:
typedef Collection<Element> Inherit;
45 public:
typedef set<Element, Compare> ElementSet;
52 private:
const ElementSet* _elementSet;
53 private:
typename ElementSet::const_iterator _iterator;
55 public: Locator(
const ElementSet* elementSet)
58 _elementSet(elementSet),
61 if (_elementSet) _iterator = _elementSet->begin();
67 return (
isValid()) ? *_iterator : Element();
73 return new Locator(_elementSet);
76 public:
virtual bool isValid()
const
79 return (_elementSet && (_iterator != _elementSet->end()));
93 private:
const ElementSet* _elementSet;
101 _elementSet(elementSet)
108 _elementSet(&elementSet)
115 _elementSet(setCollection._elementSet)
125 _elementSet = setCollection._elementSet;
132 public:
virtual Collection<Element>*
getClone() const
138 public:
virtual Hurricane::Locator<Element>*
getLocator() const
143 return (_elementSet) ?
new Locator(_elementSet) : NULL;
146 public:
virtual unsigned getSize() const
149 return (_elementSet) ? _elementSet->size() : 0;
155 public:
virtual string _getTypeName() const
158 return _TName(
"SetCollection");
161 public:
virtual string _getString() const
165 return "<" + _getTypeName() +
" unbound>";
167 if (_elementSet->empty())
168 return "<" + _getTypeName() +
" empty>";
170 return "<" + _getTypeName() +
" " + getString(_elementSet->size()) +
">";
174 Record* _getRecord() const
177 Record* record = NULL;
178 if (!_elementSet->empty()) {
179 record =
new Record(_getString());
181 typename set<Element, Compare>::const_iterator iterator = _elementSet->begin();
182 while (iterator != _elementSet->end()) {
183 record->add(getSlot(getString(n++), *iterator));
198template<
class Element,
class Compare>
205template<
class Element,
class Compare>
virtual unsigned getSize() const
Definition Collection.h:78
virtual Collection< Element > * getClone() const=0
virtual Locator< Element > * getLocator() const=0
Generic Collection auto-pointer.
Definition Collection.h:235
Locator description (API).
Definition Locator.h:33
virtual Element getElement() const=0
virtual bool isValid() const=0
virtual void progress()=0
virtual Locator< Element > * getClone() const=0
Hurricane Collection wrapper around a std::set.
Definition SetCollection.h:37
SetCollection(const ElementSet *elementSet=NULL)
Definition SetCollection.h:98
Contains Almost Everything.
Definition BasicLayer.h:39