8 #ifndef SCHNEK_BLOCKCONTAINER_HPP_ 9 #define SCHNEK_BLOCKCONTAINER_HPP_ 13 #include <boost/range.hpp> 21 template<
class BlockType>
38 template<
class ChildType>
44 typedef boost::iterator_range<typename std::list<std::shared_ptr<ChildType> >::const_iterator>
iterator_range;
46 typedef typename iterator_range::iterator
iterator;
49 std::list<std::shared_ptr<ChildType> > children;
55 void addChild(std::shared_ptr<ChildType> child)
57 children.push_back(child);
74 return children.size();
78 template<
class BlockType>
88 std::shared_ptr<BlockType>
self = std::dynamic_pointer_cast<BlockType>(this->shared_from_this());
89 if (parent &&
self) parent->addChild(
self);
95 #endif // SCHNEK_BLOCKCONTAINER_HPP_ boost::iterator_range< typename std::list< std::shared_ptr< ChildType > >::const_iterator > iterator_range
The iterator range type that is returned by childBlocks()
Definition: blockcontainer.hpp:44
A container for child blocks of a given type.
Definition: blockcontainer.hpp:39
Definition: blockcontainer.hpp:22
iterator_range childBlocks()
Return the child blocks.
Definition: blockcontainer.hpp:66
size_t numChildren()
Returns the number of child blocks.
Definition: blockcontainer.hpp:72
iterator_range::iterator iterator
The iterator type.
Definition: blockcontainer.hpp:46