Template Class BluePrint
Defined in File blueprints.hpp
Class Documentation
-
template<typename Derived>
class BluePrint This is a parent template for blueprints using crtp.
Blueprints of various sorts are often passed to a constructor of their associated class. If a template is used to in the constructor call, e.g.
template<typename BluePrint> A(const BluePrint& blueprint);
then this tends to create function collisions with other template functions (especially streaming operators). To avoid this, we need a parent class, so for this we use the crtp style (because it avoids any virtual costs).
Classes that are of type Derived must satisfy the blueprint concept (ecl::concepts::BluePrint).
Public Functions
-
inline BluePrint()
Blueprint concept checking.
Check that the derived class satisfies the blueprint concept.
-
template<typename BaseType>
inline BaseType implementInstantiate() Use the blueprint to instantiate a new object.
A crtp virtual call to its children’s instantiate method. The template argument is used, because the crtp base cannot catch typedef’s in its children at this point of the compilation. With the template parameter this check is delayed until enough of this base class is known.
Note, this cannot have the same name as the blueprint method because then the child will inherit it, even if it doesn’t have the class and the concept check will fail.
- Returns:
BaseType : the type to be generated by the blueprint.
-
template<typename BaseType>
inline void implementApply(BaseType &object) const Apply the blueprint rules to an existing object.
A crtp virtual call to its children’s apply method. This acts on the blueprint’s target class to configure it according to the blueprint. The template parameter is a trick to delay the determination of the target type, because at this point of the compilation it cannot retrieve the base_type from the derived type.
Note, this cannot have the same name as the blueprint method because then the child will inherit it, even if it doesn’t have the class and the concept check will fail.
- Parameters:
object – : the object to be configured.
-
inline virtual ~BluePrint()
-
inline BluePrint()