iv::Sub< Type, LocalItems, LocalStorage > Class Template Reference
#include <Sub.hpp>
Public Member Functions | |
Sub () | |
~Sub () | |
Sub (Sub const &src) | |
Sub & | operator= (Sub const &src) |
void | clear () |
Removes all content, effectively resetting it to default values. More... | |
template<class SubType > | |
SubType & | operator[] (SubId< Type, SubType > const &id) |
Detailed Description
template<class Type, size_t LocalItems = 0, size_t LocalStorage = 0>
class iv::Sub< Type, LocalItems, LocalStorage >
\ingroup ModelTools \brief Allow other modules to have something like a private member variables in your class.
Class that can contain sub-data:
// in .hpp
class Item
{
public:
iv::Sub< Item > sub; //< This says that Item must have static member SubdirectoryInst of type SubDirectory.
static iv::SubDirectory SubDirectoryInst;
};
// in .cpp
iv::SubDirectory Item::SubDirectoryInst;
Defining data that can be added:
// in .hpp
struct ExtraValue
{
int extra_value;
};
// in .cpp
const iv::SubId< Item, ExtraValue > ExtraValue::Id;
Accessing data:
Item item;
ExtraValue & data = item.sub[ ExtraValue::Id ];
data.extra_value = 125;
Constructor & Destructor Documentation
◆ Sub() [1/2]
◆ ~Sub()
◆ Sub() [2/2]
Member Function Documentation
◆ operator=()
◆ clear()
template<class SubType , size_t LocalItems, size_t LocalStorage>
void iv::Sub< SubType, LocalItems, LocalStorage >::clear |
◆ operator[]()
The documentation for this class was generated from the following files: