MT Showcase SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Showcase::Component Class Referenceabstract

Interface for the basic building block of Showcase. More...

#include <Component.hpp>

Inheritance diagram for Showcase::Component:
Showcase::ServiceComponent Showcase::UIComponent Showcase::SystemConfiguration Showcase::OperatorComponent Showcase::ScheduleComponent Showcase::WidgetComponent Showcase::CustomWidgetInstanceComponent

Public Member Functions

 Component (CachedGraphPtr uiGraph=nullptr)
 Create a new component. More...
 
void setCachedGraph (CachedGraphPtr uiGraph)
 Showcase nodes are stored in cached graphs. More...
 
void init (const GraphNode &confNode)
 Initializes the component and links it to the given graph node. More...
 
const QString & name () const
 Each component has a unique name that identifies it. More...
 
void setComponentName (const QString &name)
 Set a new name for this coomponent. More...
 
void setSchema (const Schema &schema)
 Schema holds the definition of the component. More...
 
const Schemaschema () const
 Get the schema of this component. More...
 
ComponentInstancePtr createInstance ()
 A single component can have multiple instances, each instance behaves independently from one another, but is tied to the creator component. More...
 
void instanceDestroyed (ComponentInstanceKey key)
 Component keeps track of its instances, and must be notified when an instance is destroyed. More...
 
size_t numInstances () const
 Returns the current number of alive instances created from this component. More...
 
CachedGraphPtr cachedGraph () const
 Returns the cached graph that this component is part of. More...
 
CachedNodePtr cachedNode () const
 Returns the cached graph node that links to this component. More...
 
const NodeIdnodeId () const
 Returns the node id of this component's cached node. More...
 
const std::list
< ComponentInstancePtr > & 
instances () const
 Returns all current instances of this component. More...
 

Protected Member Functions

void applyForInstances (std::function< void(ComponentInstancePtr)> &&f)
 Calls f for each instance.
 

Detailed Description

Interface for the basic building block of Showcase.

Component is a factory class, that creates instances of the actual classes providing UI-functionality

Constructor & Destructor Documentation

Showcase::Component::Component ( CachedGraphPtr  uiGraph = nullptr)

Create a new component.

Parameters
uiGraphthe cached graph for the component

Member Function Documentation

CachedGraphPtr Showcase::Component::cachedGraph ( ) const

Returns the cached graph that this component is part of.

Returns
cached graph of the component
CachedNodePtr Showcase::Component::cachedNode ( ) const

Returns the cached graph node that links to this component.

Returns
cached graph node of the component
ComponentInstancePtr Showcase::Component::createInstance ( )

A single component can have multiple instances, each instance behaves independently from one another, but is tied to the creator component.

Create a new instance of this component.

Returns
new instance of the component

This is possible to be called even before initialization..

void Showcase::Component::init ( const GraphNode confNode)

Initializes the component and links it to the given graph node.

Need to be called right after the construction

Parameters
confNodenode in a graph that maps to this component

Should we do anything with properties on construction?

There may be children hidden in properties, so setup onChildEvent before going through them

void Showcase::Component::instanceDestroyed ( ComponentInstanceKey  key)

Component keeps track of its instances, and must be notified when an instance is destroyed.

Parameters
keyof the destroyed instance

In destruction this is already emptied

const std::list< ComponentInstancePtr > & Showcase::Component::instances ( ) const

Returns all current instances of this component.

Returns
list of instances
const QString & Showcase::Component::name ( ) const

Each component has a unique name that identifies it.

Returns
name of this component
const NodeId & Showcase::Component::nodeId ( ) const

Returns the node id of this component's cached node.

Returns
node id of the cached node
size_t Showcase::Component::numInstances ( ) const

Returns the current number of alive instances created from this component.

Returns
number of instances
const Schema & Showcase::Component::schema ( ) const

Get the schema of this component.

Returns
schema of the component
void Showcase::Component::setCachedGraph ( CachedGraphPtr  uiGraph)

Showcase nodes are stored in cached graphs.

Each component maps to a single graph node. Set the graph for this component

Parameters
uiGraphnew cached graph for the component

Only meaningfuld before init & setConfigurationNode

void Showcase::Component::setComponentName ( const QString &  name)

Set a new name for this coomponent.

Parameters
namenew name for the component
void Showcase::Component::setSchema ( const Schema schema)

Schema holds the definition of the component.

Parameters
schemanew schema to set for the component