Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mantid::Kernel::Chainable< ChainableType > Class Template Referenceabstract

Chainable. More...

#include <Chainable.h>

Inheritance diagram for Mantid::Kernel::Chainable< ChainableType >:
Mantid::Kernel::ChainableFactory< MDFrameFactory, MDFrame, MDFrameArgument > Mantid::Kernel::ChainableFactory< MDUnitFactory, MDUnit, std::string > Mantid::Geometry::MDFrameFactory Mantid::Kernel::MDUnitFactory Mantid::Geometry::GeneralFrameFactory Mantid::Geometry::HKLFrameFactory Mantid::Geometry::QLabFrameFactory Mantid::Geometry::QSampleFrameFactory Mantid::Geometry::UnknownFrameFactory Mantid::Kernel::InverseAngstromsUnitFactory Mantid::Kernel::LabelUnitFactory Mantid::Kernel::ReciprocalLatticeUnitFactory

Public Member Functions

bool hasSuccessor () const
 
template<typename T >
ChainablesetSuccessor (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...
 

Detailed Description

template<typename ChainableType>
class Mantid::Kernel::Chainable< ChainableType >

Chainable.

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.

Constructor & Destructor Documentation

◆ ~Chainable()

template<typename ChainableType >
Mantid::Kernel::Chainable< ChainableType >::~Chainable ( )
pure virtualdefault

Keep our destructor pure virtual, but require an implementation.

Member Function Documentation

◆ checkSuccessor()

template<typename ChainableType >
virtual void Mantid::Kernel::Chainable< ChainableType >::checkSuccessor ( ) const
inlineprotectedvirtual

Provide option for derived classes to check successor and throw if bad.

Definition at line 37 of file Chainable.h.

◆ hasSuccessor()

template<typename ChainableType >
bool Mantid::Kernel::Chainable< ChainableType >::hasSuccessor ( ) const
inline

Definition at line 46 of file Chainable.h.

◆ setSuccessor()

template<typename ChainableType >
template<typename T >
Chainable & Mantid::Kernel::Chainable< ChainableType >::setSuccessor ( T &&  successor)
inline

Set the successor.

Definition at line 41 of file Chainable.h.

Member Data Documentation

◆ m_successor

template<typename ChainableType >
std::unique_ptr<ChainableType> Mantid::Kernel::Chainable< ChainableType >::m_successor
protected

Successor factory boost::optional<std::unique_ptr<ChainableType>> m_successor;.

Definition at line 35 of file Chainable.h.


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