Schnek
schnek::BlockContainer< ChildType > Class Template Reference

A container for child blocks of a given type. More...

#include <blockcontainer.hpp>

Public Types

typedef boost::iterator_range< typename std::list< std::shared_ptr< ChildType > >::const_iterator > iterator_range
 The iterator range type that is returned by childBlocks()
 
typedef iterator_range::iterator iterator
 The iterator type.
 

Protected Member Functions

iterator_range childBlocks ()
 Return the child blocks. More...
 
size_t numChildren ()
 Returns the number of child blocks.
 

Detailed Description

template<class ChildType>
class schnek::BlockContainer< ChildType >

A container for child blocks of a given type.

Block implementations can inherit from this class template to signal that they contain a number of child blocks of a given type. The ChildType can be a base class with multiple implementations.

This class works in conjunction with ChildBlock<ChildType>. Only if the ChildType extends ChildBlock<ChildType> will any children be added to this container.

BlockContainer makes available two methods that allow querying and iterating over the child blocks

Member Function Documentation

◆ childBlocks()

template<class ChildType>
iterator_range schnek::BlockContainer< ChildType >::childBlocks ( )
inlineprotected

Return the child blocks.

This method returns an iterator range over the child blocks. Children are returned in the order they have been added which is usually the order in which they have been specified in the setup file.


The documentation for this class was generated from the following file: