openDAQ
Open data acquisition platform
GenericComponentPtr< InterfaceType > Class Template Reference

Acts as a base interface for components, such as device, function block, channel and signal. More...

Detailed Description

template<typename InterfaceType>
class GenericComponentPtr< InterfaceType >

Acts as a base interface for components, such as device, function block, channel and signal.

The IComponent provides a set of methods that are common to all components: LocalID, GlobalID and Active properties.

Public Member Functions

daq::StringPtr getLocalId () const
 Gets the local ID of the component. More...
 
daq::StringPtr getGlobalId () const
 Gets the global ID of the component. More...
 
daq::Bool getActive () const
 Returns true if the component is active; false otherwise. More...
 
void setActive (daq::Bool active) const
 Sets the component to be either active or inactive. Also recursively sets the active field of all child components if component is a folder. More...
 
daq::ContextPtr getContext () const
 Gets the context object. More...
 
daq::ComponentPtr getParent () const
 Gets the parent of the component. More...
 
daq::StringPtr getName () const
 Gets the name of the component. More...
 
void setName (const daq::StringPtr &name) const
 Sets the name of the component. More...
 
daq::StringPtr getDescription () const
 Gets the description of the component. More...
 
void setDescription (const daq::StringPtr &description) const
 Sets the description of the component. More...
 
daq::TagsPtr getTags () const
 Gets the tags of the component. More...
 
daq::Bool getVisible () const
 Gets visible metadata state of the component. More...
 
void setVisible (daq::Bool visible) const
 Sets visible attribute state of the component. More...
 
daq::ListPtr< daq::IString > getLockedAttributes () const
 Gets a list of the component's locked attributes. The locked attributes cannot be modified via their respective setters. More...
 
daq::Event< daq::ComponentPtr, daq::CoreEventArgsPtr > getOnComponentCoreEvent () const
 Gets the Core Event object that triggers whenever a change to this component happens within the openDAQ core structure. More...
 
daq::ComponentStatusContainerPtr getStatusContainer () const
 Gets the container of Component statuses. More...
 
daq::ComponentPtr findComponent (const daq::StringPtr &id) const
 Finds the component (signal/device/function block) with the specified (global) id. More...
 

Member Function Documentation

◆ findComponent()

daq::ComponentPtr findComponent ( const daq::StringPtr &  id) const
inline

Finds the component (signal/device/function block) with the specified (global) id.

Parameters
idThe id of the component to search for.
Returns
The resulting component.

If the component parameter is true, the starting component is the root device.

The id provided should be in relative form from the starting component. E.g., to find a signal in the starting component, the id should be in the form of "Dev/dev_id/Ch/ch_id/Sig/sig_id.

◆ getActive()

daq::Bool getActive ( ) const
inline

Returns true if the component is active; false otherwise.

Returns
True if the component is active; false otherwise.

An active component acquires data, performs calculations and send packets on the signal path.

◆ getContext()

daq::ContextPtr getContext ( ) const
inline

Gets the context object.

Returns
The context object.

◆ getDescription()

daq::StringPtr getDescription ( ) const
inline

Gets the description of the component.

Returns
The description of the component. Empty if not configured.

The object that implements this interface defines how the description is specified.

◆ getGlobalId()

daq::StringPtr getGlobalId ( ) const
inline

Gets the global ID of the component.

Returns
The global ID of the component.

Represents the identifier that is globally unique. Globally unique identifier is composed from local identifiers from the parent components separated by '/' character. Device component must make sure that its ID is globally unique.

◆ getLocalId()

daq::StringPtr getLocalId ( ) const
inline

Gets the local ID of the component.

Returns
The local ID of the component.

Represents the identifier that is unique in a relation to the parent component. There is no predefined format for local ID. It is a string defined by its parent component.

◆ getLockedAttributes()

daq::ListPtr<daq::IString> getLockedAttributes ( ) const
inline

Gets a list of the component's locked attributes. The locked attributes cannot be modified via their respective setters.

Returns
A list of strings containing the names of locked attributes in capital case (eg. "Name", "Description").

◆ getName()

daq::StringPtr getName ( ) const
inline

Gets the name of the component.

Returns
The name of the component. Local ID if name is not configured.

The object that implements this interface defines how the name is specified.

◆ getOnComponentCoreEvent()

daq::Event<daq::ComponentPtr, daq::CoreEventArgsPtr> getOnComponentCoreEvent ( ) const
inline

Gets the Core Event object that triggers whenever a change to this component happens within the openDAQ core structure.

Returns
The Core Event object. The event triggers with a Component reference and a CoreEventArgs object as arguments.

The Core Event is triggered on various changes to the openDAQ Components. This includes changes to property values, addition/removal of child components, connecting signals to input ports and others. The event type can be identified via the event ID available within the CoreEventArgs object. Each event type has a set of predetermined parameters available in the parameters field of the arguments. These can be used by any openDAQ server, or other listener to react to changes within the core structure.

◆ getParent()

daq::ComponentPtr getParent ( ) const
inline

Gets the parent of the component.

Returns
The parent of the component.

Every openDAQ component has a parent, except for instance. Parent should be passed as a parameter to the constructor/factory. Once the component is created, the parent cannot be changed.

◆ getStatusContainer()

daq::ComponentStatusContainerPtr getStatusContainer ( ) const
inline

Gets the container of Component statuses.

Returns
The container of Component statuses.

◆ getTags()

daq::TagsPtr getTags ( ) const
inline

Gets the tags of the component.

Returns
The tags of the component.

Tags are user definable labels that can be attached to the component.

◆ getVisible()

daq::Bool getVisible ( ) const
inline

Gets visible metadata state of the component.

Returns
True if the component is visible; False otherwise.

Visible determines whether search/getter methods return find the component by default.

◆ setActive()

void setActive ( daq::Bool  active) const
inline

Sets the component to be either active or inactive. Also recursively sets the active field of all child components if component is a folder.

Parameters
activeThe new active state of the component.
Returns
nullptr if "Active" is part of the component's list of locked attributes, * or if the new active value is equal to the previous.

An active component acquires data, performs calculations and send packets on the signal path.

◆ setDescription()

void setDescription ( const daq::StringPtr &  description) const
inline

Sets the description of the component.

Parameters
descriptionThe description of the component.
Returns
nullptr if "Description" is part of the component's list of locked attributes, * or if the new description value is equal to the previous.

The object that implements this interface defines how the description is specified.

◆ setName()

void setName ( const daq::StringPtr &  name) const
inline

Sets the name of the component.

Parameters
nameThe name of the component.
Returns
nullptr if "Name" is part of the component's list of locked attributes, * or if the new name value is equal to the previous.

The object that implements this interface defines how the name is specified.

◆ setVisible()

void setVisible ( daq::Bool  visible) const
inline

Sets visible attribute state of the component.

Parameters
visibleTrue if the component is visible; False otherwise.
Returns
nullptr if "Visible" is part of the component's list of locked attributes.

Visible determines whether search/getter methods return find the component by default.