EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Types | Public Member Functions | List of all members
ProcessVariable Class Reference

One process variable. More...

#include <ProcessVariable.h>

Inheritance diagram for ProcessVariable:
NamedBase Guardable Named

Public Types

enum  State { INIT, DISCONNECTED, GETTING_INFO, CONNECTED }
 Possible states of a ProcessVariable. More...
 

Public Member Functions

 ProcessVariable (ProcessVariableContext &ctx, const char *name)
 Create a ProcessVariable with given name. More...
 
virtual ~ProcessVariable ()
 Destructor. More...
 
OrderedMutexgetMutex ()
 
State getState (Guard &guard) const
 
bool isConnected (Guard &guard) const
 
const char * getStateStr (Guard &guard) const
 
const char * getCAStateStr (Guard &guard) const
 
DbrType getDbrType (Guard &guard) const
 Get the DBR_TIME_... More...
 
DbrCount getDbrCount (Guard &guard) const
 Get the array size of this PV. More...
 
const CtrlInfogetCtrlInfo (Guard &guard) const
 
void addStateListener (ProcessVariableStateListener *listener)
 Add a ProcessVariableStateListener. More...
 
void removeStateListener (ProcessVariableStateListener *listener)
 Remove a ProcessVariableStateListener. More...
 
void addValueListener (ProcessVariableValueListener *listener)
 Add a ProcessVariableValueListener. More...
 
void removeValueListener (ProcessVariableValueListener *listener)
 Remove a ProcessVariableValueListener. More...
 
void addListener (ProcessVariableListener *listener)
 Add a ProcessVariableListener. More...
 
void removeListener (ProcessVariableListener *listener)
 Remove a ProcessVariableListener. More...
 
void start (Guard &guard)
 Start the connection mechanism. More...
 
bool isRunning (Guard &guard)
 
void getValue (Guard &guard)
 Perform a single 'get'. More...
 
void subscribe (Guard &guard)
 Subscribe for value updates. More...
 
bool isSubscribed (Guard &guard) const
 
void unsubscribe (Guard &guard)
 Unsubscribe, no more updates. More...
 
void stop (Guard &guard)
 Disconnect. More...
 
- Public Member Functions inherited from NamedBase
 NamedBase (const char *name)
 Create a Named thing with given name. More...
 
const stdString & getName () const
 

Detailed Description

One process variable.

Handles the connect/disconnect, also requests the full information (DBR_CTRL_...) and from then on get/monitor will only get the DBR_TIME_...

Locking: The ProcessVariable and the ProcessVariableContext call into the ChannelAccess client library. The CA client library also invokes callbacks in the ProcessVariable. To avoid deadlocks between ProcessVariable and CA semaphores, the ProcessVariable unlocks itself before calling any CA library. This means, however, that one should not otherwise modify the ProcessVariable while it is dealing with the CA client library. To help enforce this, the add/removeListener calls are only allowed while the ProcessVariable is not running.

Member Enumeration Documentation

Possible states of a ProcessVariable.

Enumerator
INIT 

Not initialized.

DISCONNECTED 

Not connected, but trying to connect.

GETTING_INFO 

Received CA connection callback, getting control info.

CONNECTED 

Fully connected.

Constructor & Destructor Documentation

ProcessVariable::ProcessVariable ( ProcessVariableContext ctx,
const char *  name 
)

Create a ProcessVariable with given name.

virtual ProcessVariable::~ProcessVariable ( )
virtual

Destructor.

Member Function Documentation

void ProcessVariable::addListener ( ProcessVariableListener listener)
inline
void ProcessVariable::addStateListener ( ProcessVariableStateListener listener)
inline
void ProcessVariable::addValueListener ( ProcessVariableValueListener listener)
inline
const char* ProcessVariable::getCAStateStr ( Guard guard) const
Returns
Returns the ChannelAccess state.
const CtrlInfo & ProcessVariable::getCtrlInfo ( Guard guard) const
inline
Returns
Returns the control information.
DbrCount ProcessVariable::getDbrCount ( Guard guard) const
inline

Get the array size of this PV.

Only valid when getState() was CONNECTED

DbrType ProcessVariable::getDbrType ( Guard guard) const
inline

Get the DBR_TIME_...

type of this PV.

Only valid when getState() was CONNECTED

OrderedMutex& ProcessVariable::getMutex ( )
virtual
See Also
Guardable

Implements Guardable.

State ProcessVariable::getState ( Guard guard) const
Returns
Returns the current state.
const char* ProcessVariable::getStateStr ( Guard guard) const
Returns
Returns the current state.
void ProcessVariable::getValue ( Guard guard)

Perform a single 'get'.

Value gets delivered to listeners.

bool ProcessVariable::isConnected ( Guard guard) const
inline
Returns
Returns true if the current state is CONNECTED.
bool ProcessVariable::isRunning ( Guard guard)
Returns
Returns true if start() has been called but not stop().
See Also
start()
bool ProcessVariable::isSubscribed ( Guard guard) const
inline
Returns
Returns 'true' if we are subscribed.
void ProcessVariable::removeListener ( ProcessVariableListener listener)
inline
void ProcessVariable::removeStateListener ( ProcessVariableStateListener listener)
inline
void ProcessVariable::removeValueListener ( ProcessVariableValueListener listener)
inline
void ProcessVariable::start ( Guard guard)

Start the connection mechanism.

See Also
stop()
isRunning()
void ProcessVariable::stop ( Guard guard)

Disconnect.

See Also
start()
void ProcessVariable::subscribe ( Guard guard)

Subscribe for value updates.

Values get delivered to listeners.

void ProcessVariable::unsubscribe ( Guard guard)

Unsubscribe, no more updates.


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