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

Detailed Description

This is the base class for objects that interact with specific control systems and has to be allocated only once (singletons).

In order to create support for a control system you need to overwrite this class and InterfaceBaseImpl.

The FactoryBaseImpl derived object will be created when NDS starts and will stay alive until NDS is shutdown.

The overwritten classes must implement the following methods:

Optionally, the method createThread() can also be overwritten.

#include <factoryBaseImpl.h>

Inherits enable_shared_from_this< FactoryBaseImpl >.

Public Member Functions

virtual void preDelete ()
 This function is called before the destructor is invoked. More...
 
void * createDevice (const std::string &driverName, const std::string &deviceName, const namedParameters_t &parameters)
 Allocate a device. The device driver must have been registered via registerDriver() or must have been loaded from the folder defined in the enviroment variables LD_LIBRARY_PATH or NDS_DEVICES. More...
 
void destroyDevice (void *pDevice)
 Deallocate an allocated device. More...
 
const std::string & getSeparator (const std::uint32_t nodeLevel) const
 Returns the separator to use between the node names. More...
 
virtual InterfaceBaseImplgetNewInterface (const std::string &fullName)=0
 This method is called by a PortNodeImpl object in order to create a named connection with the control system. More...
 
virtual void registerCommand (const BaseImpl &node, const std::string &command, const std::string &usage, const size_t numParameters, command_t commandFunction)=0
 Called to register a command tied to a specific node. More...
 
virtual void deregisterCommand (const BaseImpl &node)=0
 Called to deregister a node from all the NDS commands. More...
 

Member Function Documentation

void* nds::FactoryBaseImpl::createDevice ( const std::string &  driverName,
const std::string &  deviceName,
const namedParameters_t parameters 
)

Allocate a device. The device driver must have been registered via registerDriver() or must have been loaded from the folder defined in the enviroment variables LD_LIBRARY_PATH or NDS_DEVICES.

Parameters
driverName
deviceName
parameters
Returns
an opaque pointer that represents the allocated device. Pass it to destroyDevice() to remove the device
virtual void nds::FactoryBaseImpl::deregisterCommand ( const BaseImpl &  node)
pure virtual

Called to deregister a node from all the NDS commands.

The NDS framework guarantees that there are no multi-threading concurrency issues when calling this function.

Parameters
nodeto node from which the command has to be removed
void nds::FactoryBaseImpl::destroyDevice ( void *  pDevice)

Deallocate an allocated device.

Parameters
pDevice
virtual InterfaceBaseImpl* nds::FactoryBaseImpl::getNewInterface ( const std::string &  fullName)
pure virtual

This method is called by a PortNodeImpl object in order to create a named connection with the control system.

Parameters
fullNamethe full name of the PortNodeImpl
Returns
a pointer to an InterfaceBaseImpl object. The lifetime of the InterfaceBaseImpl object is controlled by the PortNodeImpl object.
const std::string& nds::FactoryBaseImpl::getSeparator ( const std::uint32_t  nodeLevel) const

Returns the separator to use between the node names.

Considers the naming rules set via setNamingRules(). If the naming rules don't define a separator then passes the request to getDefaultSeparator().

Parameters
nodeLevelthe node level for which the separator is required. The level 0 is the separator inserted righ before the root node name.
Returns
the separator for the specified level. Can be empty if no separator is required.
virtual void nds::FactoryBaseImpl::preDelete ( )
virtual

This function is called before the destructor is invoked.

It takes care of de-initializing all the PVs while the control system is still up and running.

virtual void nds::FactoryBaseImpl::registerCommand ( const BaseImpl &  node,
const std::string &  command,
const std::string &  usage,
const size_t  numParameters,
command_t  commandFunction 
)
pure virtual

Called to register a command tied to a specific node.

The NDS framework guarantees that there are no multi-threading concurrency issues when calling this function.

Parameters
nodethe node to which the command has to be tied
commandthe command
usagecommand's description
numParametersthe number of accepted parameters
commandFunctionthe delegate function to call to execute the command

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