Develop Biology
The language of life
|
#include <Elementary.h>
Public Member Functions | |
Elementary () | |
Elementary (const Properties properties) | |
virtual | ~Elementary () |
void | RegisterProperties (const Properties properties) |
Static Public Attributes | |
static bool | hasRegistered |
Elements are used to make entries in the PeriodicTable. When constructing an Elementary<>, you must provide its Properties.
When to use: You have a class that implements an interface and/or an interface which will be non-virtually inherited by downstream classes and you want those downstream classes to be able to call a method for each of your inherited classes without having to force the child classes to disambiguate each parent instance in a virtual override of your class method.
How to use:
Once all that is done and you utilize Atom Bonding methods (or derive from chemical::Class) you will have essentially inverted the inheritance tree, allowing base classes to call what would be derived class methods without the derived classes having to implement those methods. To elaborate, if you have a class that derives from multiple high-level wrappers, under normal inheritance, you would have to create a MyImplementation() override method of the abstract base class method which calls all the different parent class methods (e.g. operator== comparing all parent equivalencies). If you do not do this, the method becomes ambiguous because each wrapper provides an equally valid interface. However, by recording which wrappers have the properties of the abstract base, you can call each wrapper's interface of a base class method by casting the wrapper to the base and calling the virtual function (the base is NOT virtually inherited). The reason Elementary must be used on the wrapper and not on your multi-wrapper child is that doing so would create multiple eligible Bonds within an Atom, some of which would have ambiguous definitions, as mentioned.
T |
Definition at line 51 of file Elementary.h.
|
inline |
properties |
Definition at line 76 of file Elementary.h.
References bio::chemical::Elementary< T >::RegisterProperties().
|
inline |
If you don't know the class Properties at time of construction, you can use this. Though RegisterProperties should be as close to, if not directly, a constexpr and should be known even before *this is constructed.
Definition at line 85 of file Elementary.h.
|
inlinevirtual |
Definition at line 94 of file Elementary.h.
|
inline |
Records the given Properties as those for the type T within the PeriodicTable.
properties |
Definition at line 64 of file Elementary.h.
References bio::chemical::Elementary< T >::hasRegistered.
Referenced by bio::chemical::Elementary< T >::Elementary().
|
static |
Ensure we only Record the Properties of T once. They should always be the same.
Definition at line 58 of file Elementary.h.
Referenced by bio::chemical::Elementary< T >::RegisterProperties().