Mantid
|
#include <Chainable.h>
Public Member Functions | |
bool | hasSuccessor () const |
template<typename T > | |
Chainable & | setSuccessor (T &&successor) |
Set the successor. More... | |
virtual | ~Chainable ()=0 |
Keep our destructor pure virtual, but require an implementation. More... | |
Protected Member Functions | |
virtual void | checkSuccessor () const |
Provide option for derived classes to check successor and throw if bad. More... | |
Protected Attributes | |
std::unique_ptr< ChainableType > | m_successor |
Successor factory boost::optional<std::unique_ptr<ChainableType>> m_successor;. More... | |
CRTP class
Chainable gives the ability to set successors, but chainable items do not define create. This is important because the return from setSuccessor should not be the factory directly. Otherwise you could do this
factory.setSuccessor(new Factory).create()
and create would be bypass the chain of resposibility, which should be executed along the chain top to bottom.
Definition at line 31 of file Chainable.h.
|
pure virtualdefault |
Keep our destructor pure virtual, but require an implementation.
|
inlineprotectedvirtual |
Provide option for derived classes to check successor and throw if bad.
Definition at line 37 of file Chainable.h.
|
inline |
Definition at line 46 of file Chainable.h.
|
inline |
Set the successor.
Definition at line 41 of file Chainable.h.
|
protected |
Successor factory boost::optional<std::unique_ptr<ChainableType>> m_successor;.
Definition at line 35 of file Chainable.h.