TwiceAsNice  2019-02-18
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
$NAMESPACE::$ServiceWorker Class Reference

#include <src-ServiceWorker.h>

Inheritance diagram for $NAMESPACE::$ServiceWorker:
Inheritance graph
Collaboration diagram for $NAMESPACE::$ServiceWorker:
Collaboration graph

Classes

struct  $DeviceType
 
struct  DeviceAsyncImpl
 

Public Member Functions

$APPNAME $ServiceWorker (const Nice::JointPtr &_config)
 
virtual ~ $APPNAME $ServiceWorker ()
 
virtual void init ()
 
virtual void reset ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual void work ()
 
virtual void coffeebreak ()
 virtual void idleOnline(); More...
 
virtual void terminate ()
 Only if you want to wakeup every "CFG.INTERVAL" void $NAMESPACE$::$APPNAME$ServiceWorker::idleOnline() { D_LOG ( m_name << " --online idle-> " << m_stateMachine.now() << "::" << m_config->leaf("STATE")); m_state->set<Basda::ServiceStateMachine>(m_state->get<Basda::ServiceStateMachine>().set("SLEEP", 0)); bool rc = m_stateMachine.timedWaitForNewState ( m_config->getAtNode<Nice::Time> ( "CFG.INTERVAL" ) ); if ( !rc ) m_stateMachine.setIfSettled ( Basda::WORKING ); };. More...
 
- Public Member Functions inherited from Basda::ServiceWorker
const Nice::JointPtrconfig ()
 
Nice::JointPtr cfg ()
 
Nice::JointPtr var ()
 
virtual const std::string & name ()
 
virtual WorkerThreadPtr worker ()
 
virtual Nice::Monitormonitor ()
 
virtual void lock ()
 
virtual void unlock ()
 
bool stateIsSettled ()
 
bool stateHasChanged ()
 
void changeState (Basda::ServiceState _state)
 change state to a new state If the state is the current state, or a negative state, do nothing. Otherwise change the "next" state in the state machine and notify all threads. More...
 
bool tryChangeState (Basda::ServiceState _state, const Nice::Time &_timeout=Nice::Time::seconds(0.0))
 change state to a new state More...
 
void waitForState (Basda::ServiceState _state)
 wait (indefinitely) until the worker has reached a spcifici state More...
 
bool timedWaitForState (Basda::ServiceState _state, const Nice::Time &_timeout)
 wait (indefinitely) until the worker has reached a specific state More...
 
bool changeStateOnlyFromTo (Basda::ServiceState _from, Basda::ServiceState _to)
 wait (indefinitely) until the worker has reached a spcifici state More...
 
Basda::ServiceState state ()
 
Basda::ServiceState stateNow ()
 
Basda::ServiceState stateNext ()
 
Basda::ServiceState stateLast ()
 
bool isTransit ()
 
bool isTerminated ()
 
const Nice::JointPtrconfig ()
 
Nice::JointPtr cfg ()
 
Nice::JointPtr var ()
 
virtual const std::string & name ()
 
virtual WorkerThreadPtr worker ()
 
virtual Nice::Monitormonitor ()
 
virtual void lock ()
 
virtual void unlock ()
 
bool stateIsSettled ()
 
bool stateHasChanged ()
 
void changeState (Basda::ServiceState _state)
 
bool tryChangeState (Basda::ServiceState _state, const Nice::Time &_timeout=Nice::Time::seconds(0.0))
 
void waitForState (Basda::ServiceState _state)
 
bool timedWaitForState (Basda::ServiceState _state, const Nice::Time &_timeout)
 
bool changeStateOnlyFromTo (Basda::ServiceState _from, Basda::ServiceState _to)
 
Basda::ServiceState state ()
 
Basda::ServiceState stateNow ()
 
Basda::ServiceState stateNext ()
 
Basda::ServiceState stateLast ()
 
bool isTransit ()
 
bool isTerminated ()
 

Private Types

typedef std::list< $APPNAME $DeviceType > $APPNAME $DeviceTypeList
 

Private Attributes

$APPNAME $DeviceTypeList m_list
 

Additional Inherited Members

- Protected Types inherited from Basda::ServiceWorker
typedef void(ServiceWorker::* ServiceWorkerMemFn) ()
 
typedef Branch BranchTable[6][6]
 
typedef IceUtil::Handle< WorkerThreadWorkerThreadPtr
 
typedef void(ServiceWorker::* ServiceWorkerMemFn) ()
 
typedef Branch BranchTable[6][6]
 
typedef IceUtil::Handle< WorkerThreadWorkerThreadPtr
 
- Protected Member Functions inherited from Basda::ServiceWorker
 ServiceWorker (const Nice::JointPtr &_jointPtr)
 ctor More...
 
virtual ~ServiceWorker ()
 dtor Does nothing (in this base class) More...
 
void triggerState (const Basda::ServiceStateMachine &_state)
 change state to a new state More...
 
void sendStateStatus (const std::string &_action, int _percent)
 
void setState (Basda::ServiceState _next)
 
virtual void waitForNewState ()
 
virtual bool timedWaitForNewState (const Nice::Time &_timeout)
 
virtual void preinit ()
 
virtual void deinit ()=0
 
virtual void abort ()
 does nothing. More...
 
virtual void stop ()
 does nothing. More...
 
virtual void packin ()
 schedule ONLINE as the next target state. More...
 
virtual void errorOffline ()
 set the target state to OFFLINE. More...
 
virtual void errorStandby ()
 set the target state to OFFLINE. More...
 
virtual void errorOnline ()
 set the target state to OFFLINE. More...
 
virtual void errorWorking ()
 set the target state to OFFLINE. More...
 
virtual void idleOffline ()
 wait for a state change. More...
 
virtual void idleStandby ()
 wait for a state change. More...
 
virtual void idleOnline ()
 wait for a state change. More...
 
 ServiceWorker (const Nice::JointPtr &_jointPtr)
 
virtual ~ServiceWorker ()
 
void triggerState (const Basda::ServiceStateMachine &_state)
 
void sendStateStatus (const std::string &_action, int _percent)
 
void setState (Basda::ServiceState _next)
 
virtual void waitForNewState ()
 
virtual bool timedWaitForNewState (const Nice::Time &_timeout)
 
virtual void preinit ()
 
virtual void deinit ()=0
 
virtual void abort ()
 
virtual void stop ()
 
virtual void packin ()
 
virtual void errorOffline ()
 
virtual void errorStandby ()
 
virtual void errorOnline ()
 
virtual void errorWorking ()
 
virtual void idleOffline ()
 
virtual void idleStandby ()
 
virtual void idleOnline ()
 
- Protected Attributes inherited from Basda::ServiceWorker
Nice::JointPtr m_config
 
Nice::PropertyPtr m_state
 
std::string m_name
 
- Static Protected Attributes inherited from Basda::ServiceWorker
static BranchTable s_stateTable
 A table which tells which state should go via which intermediate state to a target state. The 6 states are SHUTDOWN, OFFLINE, STANDBY, ONLINE, WORKING and ERROR. The principles are that. More...
 

Member Typedef Documentation

◆ $DeviceTypeList

typedef std::list<$APPNAME$DeviceType> $APPNAME $NAMESPACE::$ServiceWorker::$DeviceTypeList
private

Constructor & Destructor Documentation

◆ $ServiceWorker() [1/2]

$APPNAME $NAMESPACE::$ServiceWorker::$ServiceWorker ( const Nice::JointPtr _config)

◆ $ServiceWorker() [2/2]

virtual ~$APPNAME $NAMESPACE::$ServiceWorker::$ServiceWorker ( )
inlinevirtual

Member Function Documentation

◆ activate()

void $NAMESPACE $APPNAME $ServiceWorker::activate ( )
virtual

Implements Basda::ServiceWorker.

◆ coffeebreak()

void $NAMESPACE $APPNAME $ServiceWorker::coffeebreak ( )
virtual

virtual void idleOnline();

◆ deactivate()

void $NAMESPACE $APPNAME $ServiceWorker::deactivate ( )
virtual

Implements Basda::ServiceWorker.

◆ init()

void $NAMESPACE $APPNAME $ServiceWorker::init ( )
virtual

Implements Basda::ServiceWorker.

◆ reset()

void $NAMESPACE $APPNAME $ServiceWorker::reset ( )
virtual

◆ terminate()

void $NAMESPACE $APPNAME $ServiceWorker::terminate ( )
virtual

Only if you want to wakeup every "CFG.INTERVAL" void $NAMESPACE$::$APPNAME$ServiceWorker::idleOnline() { D_LOG ( m_name << " --online idle-> " << m_stateMachine.now() << "::" << m_config->leaf("STATE")); m_state->set<Basda::ServiceStateMachine>(m_state->get<Basda::ServiceStateMachine>().set("SLEEP", 0)); bool rc = m_stateMachine.timedWaitForNewState ( m_config->getAtNode<Nice::Time> ( "CFG.INTERVAL" ) ); if ( !rc ) m_stateMachine.setIfSettled ( Basda::WORKING ); };.

Reimplemented from Basda::ServiceWorker.

◆ work()

void $NAMESPACE $APPNAME $ServiceWorker::work ( )
virtual

....

set data: m_config->setAtNode ( "VAR.VALUES", values.m_data );
Only if you want to wakeup every "CFG.INTERVAL" m_stateMachine.timedWaitForNewState ( m_config->getAtNode<Nice::Time> ( "CFG.INTERVAL" ) );

Implements Basda::ServiceWorker.

Member Data Documentation

◆ m_list

$APPNAME $DeviceTypeList $NAMESPACE::$ServiceWorker::m_list
private

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