NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nds::Base Class Reference

Detailed Description

This is the base class for all the NDS3 public classes that declare a device part (node, port, PV, etc).

#include <base.h>

Inheritance diagram for nds::Base:
nds::Node nds::PVBase nds::DataAcquisition< T > nds::Port nds::StateMachine nds::PVBaseIn nds::PVBaseOut nds::PVDelegateIn< T > nds::PVVariableIn< T > nds::PVAction nds::PVDelegateOut< T > nds::PVVariableOut< T >

Public Member Functions

 Base (const Base &right)
 Copy constructor. The copy will refer to the same implementation object referenced in the copied object. More...
 
Baseoperator= (const Base &right)
 Copy operator. The copy will refer to the same implementation object referenced in the copied object. More...
 
void setExternalName (const std::string &externalName)
 Set the string to pass to the naming rules in order to build the full node name as seen by the control system. More...
 
virtual Port getPort ()
 Get the Node that communicate with the device (ASYN port on EPICS, Device on Tango). Query the parent nodes if necessary. More...
 
const std::string & getComponentName () const
 Return the node's name. More...
 
const std::string & getFullName () const
 Return the full node's name, prepending the parents' names if necessary (e.g. "ROOT-CHANNEL1-THISNODE") More...
 
const std::string & getFullExternalName () const
 Return the full node's name as seen by the control system clients. More...
 
const std::string & getFullNameFromPort () const
 Return the node's name as seen by the parent Port node (the node that communicates with the device). More...
 
timespec getTimestamp () const
 Get the current time. More...
 
void setTimestampDelegate (getTimestampPlugin_t timestampDelegate)
 Specify the delegate function to call to get the timestamp. More...
 
std::ostream & getLogger (const logLevel_t logLevel)
 Retrieve a logging stream for the specified log level. More...
 
bool isLogLevelEnabled (const logLevel_t logLevel) const
 Returns true if the logging for a particular severity level has been enabled. More...
 
void setLogLevel (const logLevel_t logLevel)
 Enable the logging for a particular severity level. More...
 
void defineCommand (const std::string &command, const std::string &usage, const size_t numParameters, const command_t function)
 Define a command specific for the node. More...
 
Thread runInThread (const std::string &name, threadFunction_t function)
 Create and run a thread using the control system facilities. More...
 
Thread runInThread (threadFunction_t function)
 Create and run a thread using the control system facilities. The created thread will have the node's name. More...
 

Protected Member Functions

 Base ()
 Initializes an empty base class.
 

Constructor & Destructor Documentation

nds::Base::Base ( const Base right)

Copy constructor. The copy will refer to the same implementation object referenced in the copied object.

Parameters
rightthe object to copy

Member Function Documentation

void nds::Base::defineCommand ( const std::string &  command,
const std::string &  usage,
const size_t  numParameters,
const command_t  function 
)

Define a command specific for the node.

In EPICS the command will be available by typing:

nds commandName nodeName [parameters]

For instance, for a command "switchOn" on a node named "Oscilloscope-ch0" you will have to type:

nds switchOn Oscilloscope-ch0
Parameters
commandthe command name
usagethe command description
numParametersthe number of parameters (only strings)
functionthe delegate function to call to execute the command
virtual Port nds::Base::getPort ( )
virtual

Get the Node that communicate with the device (ASYN port on EPICS, Device on Tango). Query the parent nodes if necessary.

Returns
a reference to the parent Device node, which can be used to communicate directly with the device
timespec nds::Base::getTimestamp ( ) const

Get the current time.

  • if a custom time function has been declared with setTimestampDelegate() then the delegate function is called, or...
  • if this is not the root node then the parent node's getTimestamp() is called, or...
  • if this is the parent node then the local machine's UTC time is returned.
Returns
the current time
Base& nds::Base::operator= ( const Base right)

Copy operator. The copy will refer to the same implementation object referenced in the copied object.

Parameters
rightthe object to copy
Returns
Thread nds::Base::runInThread ( const std::string &  name,
threadFunction_t  function 
)

Create and run a thread using the control system facilities.

If the control system does not provide any thread facility then a std::thread is created and executed.

Parameters
namethe name given to the thread
functionthe function to execute in the thread
Returns
a Thread object referencing the new thread
Thread nds::Base::runInThread ( threadFunction_t  function)

Create and run a thread using the control system facilities. The created thread will have the node's name.

If the control system does not provide any thread facility then a std::thread is created and executed.

Parameters
functionthe function to execute in the thread
Returns
a Thread object referencing the new thread
void nds::Base::setTimestampDelegate ( getTimestampPlugin_t  timestampDelegate)

Specify the delegate function to call to get the timestamp.

If this method is not called then an internal function is called, which traverses all the parent nodes until the node with no parent returns the local time or call its own delegate function if specified.

Parameters
timestampDelegatethe delegate function to call to get the timestamp

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