SmartSoft Component-Developer API
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Smart::IComponent Class Referenceabstract

Component management class. More...

#include <smartIComponent.h>

Inheritance diagram for Smart::IComponent:
Smart::ShutdownSubject

Public Member Functions

 IComponent (const std::string &componentName)
 Default constructor initializes the component with a given component-name. More...
 
virtual ~IComponent ()=default
 Destructor. More...
 
virtual StatusCode run (void)=0
 Runs the SmartSoft framework within a component which includes handling intercomponent communication etc. More...
 
virtual void signal_shutdown (void)=0
 
virtual StatusCode blocking (const bool b)=0
 Allow or abort and reject blocking calls in communication patterns of this component. More...
 
std::string getName () const
 Returns the component name. More...
 
virtual ITimerManagergetTimerManager ()=0
 get timer-manager for registering timer-handlers More...
 
- Public Member Functions inherited from Smart::ShutdownSubject
 ShutdownSubject ()
 Default constructor. More...
 
virtual ~ShutdownSubject ()
 Default destructor. More...
 

Protected Member Functions

 IComponent ()=delete
 
- Protected Member Functions inherited from Smart::ShutdownSubject
virtual void attach (IShutdownObserver *observer)
 Attach an IShutdownObserver instance. More...
 
virtual void detach (IShutdownObserver *observer)
 Detach an IShutdownObserver instance. More...
 
virtual void notify_sutdown ()
 Notifies all attached IShutdownObserver instances about an upcoming shutdown. More...
 

Protected Attributes

std::string componentName
 the internal component-name More...
 
bool is_blocking
 the internal blocking flag More...
 

Detailed Description

Component management class.

Every software-component must provide exactly one instance of an IComponent. This class provides the base infrastructure for a software-component. This base-infrastructure is shared among all component's subentities such as the component's client- and server-ports as well as the user-tasks.

The main thread of a component is used by this class to run() the SmartSoft framework. Therefore all user activities must be started before in separate threads. Further details can be found in the examples.

Constructor & Destructor Documentation

◆ IComponent() [1/2]

Smart::IComponent::IComponent ( )
protecteddelete

◆ IComponent() [2/2]

Smart::IComponent::IComponent ( const std::string &  componentName)
inline

Default constructor initializes the component with a given component-name.

Parameters
componentNameunique name of the whole component, which is used by the clients to address this server

◆ ~IComponent()

virtual Smart::IComponent::~IComponent ( )
virtualdefault

Destructor.

Member Function Documentation

◆ blocking()

virtual StatusCode Smart::IComponent::blocking ( const bool  b)
pure virtual

Allow or abort and reject blocking calls in communication patterns of this component.

If blocking is set to false all blocking calls of all communication patterns of this component return with SMART_CANCELLED. This can be used to abort blocking calls of ALL communication patterns inside a component.

Parameters
b(blocking) true/false
Returns
status code
  • SMART_OK : new mode set
  • SMART_ERROR : something went wrong

◆ getName()

std::string Smart::IComponent::getName ( ) const
inline

Returns the component name.

The component name is a read-only value that is set once at component startup. This name serves as a parent namespace for all component's communication ports.

Returns
the component name

◆ getTimerManager()

virtual ITimerManager* Smart::IComponent::getTimerManager ( )
pure virtual

get timer-manager for registering timer-handlers

An instance of an ITimerManager is instantiated by an IComponent. An ITimerManager allows activation of ITimerHandler instances that are triggered (once or repeatedly) after a given time period.

Returns
a pointer to the ITimerManager

◆ run()

virtual StatusCode Smart::IComponent::run ( void  )
pure virtual

Runs the SmartSoft framework within a component which includes handling intercomponent communication etc.

This method is called in the main()-routine of a component after all initializations including activation of user threads are finished. Thypically the last code-line of the man function looks like this: "return component.run();".

Returns
status code
  • SMART_ERROR_UNKNOWN: unknown error (probably a corba problem)
  • SMART_OK: gracefully terminated

◆ signal_shutdown()

virtual void Smart::IComponent::signal_shutdown ( void  )
pure virtual

Member Data Documentation

◆ componentName

std::string Smart::IComponent::componentName
protected

the internal component-name

◆ is_blocking

bool Smart::IComponent::is_blocking
protected

the internal blocking flag


The documentation for this class was generated from the following file: