μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Macros
DerivedNode.hpp File Reference
#include <type_traits>
#include "uhal/Node.hpp"
#include "uhal/TemplateDefinitions/DerivedNode.hxx"
Include dependency graph for DerivedNode.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  uhal::RegistrationHelper< T >
 Experimental!! Helper struct for adding the DerivedNode to the Node Factory Declaring an instance of an object at global scope means that it is created before the main code is entered We can use this to our advantage by using the constructor of this object to add entries to the factory in a distributed fashion (for instance, in the file where the derived node is defined), rather than manually having to add entries in one file To make things even simpler, the REGISTER macro expands the template argument to a string and passes it to the constructor. More...
 

Namespaces

namespace  uhal
 

Macros

#define UHAL_REGISTER_DERIVED_NODE(classname)
 Macro which adds a Derived Node Class to the factory It takes a classname and then creates a registration helper object, with the classname as its template parameter and a stringified version of the classname as its constructor argument. More...
 
#define UHAL_DERIVEDNODE(DerivedType)
 Macro which adds the clone method implementation for derived classes. More...
 

Detailed Description

Author
Andrew W. Rose
Date
2012

Definition in file DerivedNode.hpp.

Macro Definition Documentation

◆ UHAL_DERIVEDNODE

#define UHAL_DERIVEDNODE (   DerivedType)
Value:
protected: \
virtual uhal::Node* clone() const;
A heirarchical node for navigating heirarchical firmwares.
Definition: Node.hpp:85

Macro which adds the clone method implementation for derived classes.

Definition at line 63 of file DerivedNode.hpp.

◆ UHAL_REGISTER_DERIVED_NODE

#define UHAL_REGISTER_DERIVED_NODE (   classname)
Value:
uhal::RegistrationHelper< classname > classname##RegistrationHelper( #classname ); \
uhal::Node* classname::clone() const \
{ \
static_assert((std::is_base_of<uhal::Node, classname>::value), "Derived node class must be a descendant of uhal::Node"); \
return new classname ( static_cast<const classname&> ( *this ) ); \
}
Experimental!! Helper struct for adding the DerivedNode to the Node Factory Declaring an instance of ...
Definition: DerivedNode.hpp:80

Macro which adds a Derived Node Class to the factory It takes a classname and then creates a registration helper object, with the classname as its template parameter and a stringified version of the classname as its constructor argument.

Definition at line 53 of file DerivedNode.hpp.