Public Member Functions | List of all members
ecl::BluePrint< Derived > Class Template Reference

This is a parent template for blueprints using crtp. More...

#include <blueprints.hpp>

Public Member Functions

 BluePrint ()
 Blueprint concept checking. More...
 
template<typename BaseType >
void implementApply (BaseType &object) const
 Apply the blueprint rules to an existing object. More...
 
template<typename BaseType >
BaseType implementInstantiate ()
 Use the blueprint to instantiate a new object. More...
 
virtual ~BluePrint ()
 

Detailed Description

template<typename Derived>
class ecl::BluePrint< Derived >

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).

Definition at line 47 of file blueprints.hpp.

Constructor & Destructor Documentation

◆ BluePrint()

template<typename Derived >
ecl::BluePrint< Derived >::BluePrint ( )
inline

Blueprint concept checking.

Check that the derived class satisfies the blueprint concept.

Definition at line 54 of file blueprints.hpp.

◆ ~BluePrint()

template<typename Derived >
virtual ecl::BluePrint< Derived >::~BluePrint ( )
inlinevirtual

Definition at line 95 of file blueprints.hpp.

Member Function Documentation

◆ implementApply()

template<typename Derived >
template<typename BaseType >
void ecl::BluePrint< Derived >::implementApply ( BaseType &  object) const
inline

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.

Definition at line 91 of file blueprints.hpp.

◆ implementInstantiate()

template<typename Derived >
template<typename BaseType >
BaseType ecl::BluePrint< Derived >::implementInstantiate ( )
inline

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.

Definition at line 72 of file blueprints.hpp.


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


ecl_utilities
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:41