Creating Components

Components can be created from a string identifier (symbol) or from a run-time type identifier.

Creating a component from a String Identifier

Components registered in the Kernel Component Factory can be created from a NsSymbol. This allows creating components that dot not expose its implementation or allows creating components whose new operation cannot be decided at compile time (for example, creating components from a disk stream in the serialization manager or when distributing component creations through the network).

Ptr<IStream> stream = NsCreateComponent<IStream>(NSS(MemoryStream));

Creating a component from a Type Identifier

Components can be created from the run-time type identifier as normal classes:

Ptr<GroupMeta> type = *new GroupMeta(mRoot, id, numElements);

As shown in the example, in this case, parameters can be passed to the component constructor.

© 2017 Noesis Technologies