10 #ifndef NDSFACTORYBASEIMPL_H
11 #define NDSFACTORYBASEIMPL_H
22 class InterfaceBaseImpl;
26 class LogStreamGetterImpl;
28 class IniFileParserImpl;
51 class NDS3_API
FactoryBaseImpl:
public std::enable_shared_from_this<FactoryBaseImpl>
65 virtual void preDelete();
67 virtual ThreadBaseImpl* runInThread(
const std::string& name, threadFunction_t
function);
69 static void loadDriver(
const std::string& libraryName);
82 void* createDevice(
const std::string& driverName,
const std::string& deviceName,
const namedParameters_t& parameters);
88 void destroyDevice(
void* pDevice);
90 void destroyDevice(
const std::string& deviceName);
92 void holdNode(
void* pDeviceObject, std::shared_ptr<NodeImpl> pHoldNode);
106 const std::string& getSeparator(
const std::uint32_t nodeLevel)
const;
108 void loadNamingRules(std::istream& rules);
109 void setNamingRules(
const std::string& rulesName);
111 std::string getRootNodeName(
const std::string& name)
const;
112 std::string getGenericChannelName(
const std::string& name)
const;
113 std::string getInputChannelName(
const std::string& name)
const;
114 std::string getOutputChannelName(
const std::string& name)
const;
115 std::string getSourceChannelName(
const std::string& name)
const;
116 std::string getSinkChannelName(
const std::string& name)
const;
117 std::string getInputPVName(
const std::string& name)
const;
118 std::string getOutputPVName(
const std::string& name)
const;
119 std::string getStateMachineNodeName(
const std::string& name)
const;
120 std::string getStateMachineSetStateName(
const std::string& name)
const;
121 std::string getStateMachineGetStateName(
const std::string& name)
const;
122 std::string getStateMachineGetGlobalStateName(
const std::string& name)
const;
123 std::string getDecimationPVName(
const std::string& name)
const;
125 std::string buildNameFromRule(
const std::string& name,
126 const std::string& rule0,
127 const std::string& rule1 =
"",
128 const std::string& rule2 =
"",
129 const std::string& rule3 =
"",
130 const std::string& rule4 =
""
133 virtual const std::string& getDefaultSeparator(
const std::uint32_t nodeLevel)
const = 0;
135 virtual const std::string getName()
const = 0;
148 virtual void run(
int argc,
char *argv[]) = 0;
150 virtual LogStreamGetterImpl* getLogStreamGetter() = 0;
164 virtual void registerCommand(
const BaseImpl& node,
165 const std::string& command,
166 const std::string& usage,
167 const size_t numParameters,
command_t commandFunction) = 0;
177 virtual void deregisterCommand(
const BaseImpl& node) = 0;
180 struct allocatedDevice_t
186 typedef std::map<std::string, allocatedDevice_t> allocatedDevices_t;
187 allocatedDevices_t m_allocatedDevices;
189 typedef std::list<std::shared_ptr<NodeImpl> > nodesList_t;
190 typedef std::map<void*, nodesList_t> heldNodes_t;
191 heldNodes_t m_heldNodes;
195 std::unique_ptr<IniFileParserImpl> m_namingRules;
196 std::string m_namingRulesName;
203 #endif // NDSFACTORYBASEIMPL_H
std::function< void(void *)> deallocateDriver_t
Definition for the function executed to deallocate a driver.
Definition: definitions.h:244
This is the base class for objects that interact with specific control systems and has to be allocate...
Definition: factoryBaseImpl.h:51
std::function< parameters_t(const parameters_t ¶meters)> command_t
Definition of a function called to execute a node's command.
Definition: definitions.h:216
Defines all the enumeration and common types used across the NDS library.
Represents the interface between NDS and the control system API.
Definition: interfaceBaseImpl.h:26
std::map< std::string, std::string > namedParameters_t
Map containing named parameters passed to the device during the initialization.
Definition: definitions.h:222