TwiceAsNice  2019-02-18
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
basda::PowerMeterServiceWorker Class Reference

A PowerMeterServiceWorker controls a PowerMeterDevice. More...

#include <PowerMeterServiceWorker.hpp>

Inheritance diagram for basda::PowerMeterServiceWorker:
Inheritance graph
Collaboration diagram for basda::PowerMeterServiceWorker:
Collaboration graph

Classes

struct  AsyncPowerMeterDevice
 
struct  DeviceAsyncImpl
 

Public Types

typedef std::set< Basda::PowerMeterDevicePtr, Basda::PowerMeterDevicePtrLessComparatorPowerMeterDeviceSet
 
typedef std::set< Basda::PowerMeterDevicePtr, Basda::PowerMeterDevicePtrLessComparatorPowerMeterDeviceSet
 

Public Member Functions

 PowerMeterServiceWorker (const Nice::JointPtr &_config, PowerMeterDeviceSet devices)
 
virtual ~PowerMeterServiceWorker ()
 
virtual void init ()
 
virtual void deinit ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual void work ()
 
virtual void idleOnline ()
 
virtual void terminate ()
 
 PowerMeterServiceWorker (const Nice::JointPtr &_config, PowerMeterDeviceSet devices)
 
virtual ~PowerMeterServiceWorker ()
 
virtual void init ()
 
virtual void deinit ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual void work ()
 
virtual void idleOnline ()
 
virtual void terminate ()
 
- 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 ()
 

Protected Member Functions

virtual void waitForNewStateForAtMost (const Nice::Time &workInterval)
 
Nice::Time getWorkInterval ()
 
virtual void waitForNewStateForAtMost (const Nice::Time &workInterval)
 
Nice::Time getWorkInterval ()
 
- 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 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...
 
 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 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 ()
 

Private Types

typedef std::list< AsyncPowerMeterDeviceAsyncPowerMeterDeviceList
 
typedef std::list< AsyncPowerMeterDeviceAsyncPowerMeterDeviceList
 

Private Member Functions

void insertWorkIntervalPropertyIntoTreeIfAny ()
 
std::string getWorkIntervalPropertyName () const
 
void insertWorkIntervalPropertyIntoTreeIfAny ()
 
std::string getWorkIntervalPropertyName () const
 

Private Attributes

AsyncPowerMeterDeviceList asyncDevices_
 

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 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...
 

Detailed Description

A PowerMeterServiceWorker controls a PowerMeterDevice.

Member Typedef Documentation

◆ AsyncPowerMeterDeviceList [1/2]

◆ AsyncPowerMeterDeviceList [2/2]

◆ PowerMeterDeviceSet [1/2]

◆ PowerMeterDeviceSet [2/2]

Constructor & Destructor Documentation

◆ PowerMeterServiceWorker() [1/2]

basda::PowerMeterServiceWorker::PowerMeterServiceWorker ( const Nice::JointPtr _config,
PowerMeterDeviceSet  devices 
)
Precondition
container of devices must not be empty

◆ ~PowerMeterServiceWorker() [1/2]

basda::PowerMeterServiceWorker::~PowerMeterServiceWorker ( )
virtual
Note
overridden

◆ PowerMeterServiceWorker() [2/2]

basda::PowerMeterServiceWorker::PowerMeterServiceWorker ( const Nice::JointPtr _config,
PowerMeterDeviceSet  devices 
)
Precondition
container of devices must not be empty

◆ ~PowerMeterServiceWorker() [2/2]

virtual basda::PowerMeterServiceWorker::~PowerMeterServiceWorker ( )
virtual
Note
overridden

Member Function Documentation

◆ activate() [1/2]

void basda::PowerMeterServiceWorker::activate ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ activate() [2/2]

virtual void basda::PowerMeterServiceWorker::activate ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ deactivate() [1/2]

void basda::PowerMeterServiceWorker::deactivate ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ deactivate() [2/2]

virtual void basda::PowerMeterServiceWorker::deactivate ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ deinit() [1/2]

virtual void basda::PowerMeterServiceWorker::deinit ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ deinit() [2/2]

void basda::PowerMeterServiceWorker::deinit ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ getWorkInterval() [1/2]

Nice::Time basda::PowerMeterServiceWorker::getWorkInterval ( )
protected

◆ getWorkInterval() [2/2]

Nice::Time basda::PowerMeterServiceWorker::getWorkInterval ( )
protected

◆ getWorkIntervalPropertyName() [1/2]

std::string basda::PowerMeterServiceWorker::getWorkIntervalPropertyName ( ) const
private

◆ getWorkIntervalPropertyName() [2/2]

std::string basda::PowerMeterServiceWorker::getWorkIntervalPropertyName ( ) const
private

◆ idleOnline() [1/2]

virtual void basda::PowerMeterServiceWorker::idleOnline ( )
virtual
Note
overridden

Reimplemented from Basda::ServiceWorker.

◆ idleOnline() [2/2]

void basda::PowerMeterServiceWorker::idleOnline ( )
virtual
Note
overridden

Reimplemented from Basda::ServiceWorker.

◆ init() [1/2]

void basda::PowerMeterServiceWorker::init ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ init() [2/2]

virtual void basda::PowerMeterServiceWorker::init ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ insertWorkIntervalPropertyIntoTreeIfAny() [1/2]

void basda::PowerMeterServiceWorker::insertWorkIntervalPropertyIntoTreeIfAny ( )
private

◆ insertWorkIntervalPropertyIntoTreeIfAny() [2/2]

void basda::PowerMeterServiceWorker::insertWorkIntervalPropertyIntoTreeIfAny ( )
private

◆ terminate() [1/2]

void basda::PowerMeterServiceWorker::terminate ( )
virtual
Note
overridden

Reimplemented from Basda::ServiceWorker.

◆ terminate() [2/2]

virtual void basda::PowerMeterServiceWorker::terminate ( )
virtual
Note
overridden

Reimplemented from Basda::ServiceWorker.

◆ waitForNewStateForAtMost() [1/2]

virtual void basda::PowerMeterServiceWorker::waitForNewStateForAtMost ( const Nice::Time workInterval)
protectedvirtual

◆ waitForNewStateForAtMost() [2/2]

void basda::PowerMeterServiceWorker::waitForNewStateForAtMost ( const Nice::Time workInterval)
protectedvirtual

◆ work() [1/2]

void basda::PowerMeterServiceWorker::work ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

◆ work() [2/2]

virtual void basda::PowerMeterServiceWorker::work ( )
virtual
Note
overridden

Implements Basda::ServiceWorker.

Member Data Documentation

◆ asyncDevices_

AsyncPowerMeterDeviceList basda::PowerMeterServiceWorker::asyncDevices_
private

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