Node factory.
More...
#include <NodeFactory.h>
|
template<typename C > |
void | registerType (std::string type, std::string description, std::string category, bool instantiatable, const std::vector< Libpf::Persistency::IntegerOption > &integerOptions={ }, const std::vector< Libpf::Persistency::StringOption > &stringOptions={ }, const std::vector< Libpf::Persistency::QuantityOption > &quantityOptions={ }, std::string icon="", double width=100.0, double heigth=100.0) |
|
void | registerAlias (std::string baseType, std::string type, std::string description, Libpf::Persistency::Defaults defaults, std::string icon="", double width=100.0, double heigth=100.0) |
|
Node * | create (std::string type, Libpf::Persistency::Defaults defaults=Libpf::Persistency::Defaults(), uint32_t id=0, Persistency *persistency=nullptr, Persistent *parent=nullptr, Persistent *root=nullptr) |
|
int | size (void) |
| Returns the number of registrered objects of the NodeFactory. More...
|
|
void | dump (void) const |
| write to std::cout the list of supported types More...
|
|
const Libpf::Persistency::TypeDescriptor & | typeDescriptor (std::string name) const |
|
void | clear (void) |
| remove any user-defined type (but the builtin types will stay) More...
|
|
const Icon & | icon (std::string type) const |
|
F is a function pointer to a function that calls the main constructor: create a new node.
◆ Map
internal data structure to keep the association between the unique identifiers and the function pointers
◆ clear()
void NodeFactory::clear |
( |
void |
| ) |
|
remove any user-defined type (but the builtin types will stay)
◆ create()
Creates a new object of type and returns a pointer to it; if persistency is non-null, restores from persistency database; if persistency is null, creates a brand new object with the supplied defaults and id
- Parameters
-
type | type unique identifier |
defaults | default informations to build and configure the Node and its descendants |
id | integer identifier in the database; defaults to 0 |
persistency | database connection; defaults to nullptr |
parent | pointer to the parent Node; set to nullptr if Node is self-standing or the root Node in a tree; defaults to nullptr |
root | pointer to the root Node; set to nullptr if Node is self-standing or the root Node in a tree; defaults to nullptr |
◆ dump()
void NodeFactory::dump |
( |
void |
| ) |
const |
write to std::cout the list of supported types
◆ icon()
const Icon & NodeFactory::icon |
( |
std::string |
type | ) |
const |
- Returns
- the default icon for the supplied type
- Parameters
-
type | type unique identifier |
◆ registerAlias()
void NodeFactory::registerAlias |
( |
std::string |
baseType, |
|
|
std::string |
type, |
|
|
std::string |
description, |
|
|
Libpf::Persistency::Defaults |
defaults, |
|
|
std::string |
icon = "" , |
|
|
double |
width = 100.0 , |
|
|
double |
heigth = 100.0 |
|
) |
| |
Registers an alias with its unique id and a set of default options
- Parameters
-
baseType | the base type of the alias |
type | unique type id of the alias |
description | UTF-8 encoded string |
icon | UTF-8 encoded string with the icon name, without extension |
width | the width in px of the icon; the default is 80.0 |
heigth | the heigth in px of the SVG icon; the default is 80.0 |
defaults | the default options of the alias |
◆ registerType()
Registers a C object with its unique id
- Parameters
-
type | unique type id |
description | UTF-8 encoded string |
category | one of: phase, stream, unit, flowsheet or option |
icon | UTF-8 encoded string with the icon name, without extension |
width | the width in px of the icon; the default is 80.0 |
heigth | the heigth in px of the SVG icon; the default is 80.0 |
instantiatable | true if type is instantiable |
integerOptions | supported integer options |
stringOptions | supported string options |
◆ size()
int NodeFactory::size |
( |
void |
| ) |
|
|
inline |
Returns the number of registrered objects of the NodeFactory.
◆ typeDescriptor()
◆ initializeLibpf
bool initializeLibpf |
( |
void |
| ) |
|
|
friend |
initialize library, executes only once discarding subsequent calls in detail:
- sets verbosityGlobal to 2
- calls rollContext
- prints the startup banner
- sets strict_ro to true
- Returns
- true if the library has actually been initialized
◆ Libpf::User::listTypes
◆ NodeFactoryInitializer
◆ builtin_
int* NodeFactory::builtin_ |
|
staticprotected |
the count of builtin types
◆ creators_
Map* NodeFactory::creators_ |
|
staticprotected |
◆ defaults_
internal data structure to keep the defaults for aliases
◆ icons_
std::map<std::string, Icon>* NodeFactory::icons_ |
|
staticprotected |
◆ types_
internal data structure to keep the list of supported types
The documentation for this class was generated from the following file: