NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
factory.h
Go to the documentation of this file.
1 /*
2  * Nominal Device Support v3 (NDS3)
3  *
4  * Copyright (c) 2015 Cosylab d.d.
5  *
6  * For more information about the license please refer to the license.txt
7  * file included in the distribution.
8  */
9 
10 #ifndef NDSFACTORY_H
11 #define NDSFACTORY_H
12 
24 #include <string>
25 #include <memory>
26 #include <thread>
27 #include "nds3/definitions.h"
28 
29 namespace nds
30 {
31 
32 class FactoryBaseImpl;
33 class Thread;
34 
43 class NDS3_API Factory
44 {
45  friend class Node;
46 public:
47 #ifndef SWIG
48  Factory(std::shared_ptr<FactoryBaseImpl> impl);
49 #endif
50 
56  Factory(const std::string& controlSystemName);
57 
82  static void registerDriver(const std::string& driverName, allocateDriver_t allocateFunction, deallocateDriver_t deallocateFunction);
83 
95  static void registerControlSystem(Factory& factory);
96 
105  void run(int argc,char *argv[]);
106 
116  void createDevice(const std::string& driverName, const std::string& deviceName, const namedParameters_t& parameters);
117 
123  void destroyDevice(const std::string& deviceName);
124 
139  void subscribe(const std::string& pushFrom, const std::string& pushTo);
140 
145  void unsubscribe(const std::string& pushTo);
146 
159  void replicate(const std::string& replicateSource, const std::string& replicateDestination);
160 
167  void stopReplicationTo(const std::string& destination);
168 
176  Thread runInThread(const std::string& name, threadFunction_t function);
177 
178  void loadNamingRules(std::istream& rules);
179  void setNamingRules(const std::string& rulesName);
180 
181 
182 #ifndef SWIG
183 private:
184  std::shared_ptr<FactoryBaseImpl> m_pFactory;
185 #endif
186 };
187 
188 }
189 #endif // NDSFACTORY_H
std::function< void(void *)> deallocateDriver_t
Definition for the function executed to deallocate a driver.
Definition: definitions.h:244
A node object that can contain other nodes or PVs as children.
Definition: node.h:38
std::function< void *(Factory &factory, const std::string &deviceName, const namedParameters_t &parameters)> allocateDriver_t
Definition for the function executed to allocate a driver.
Definition: definitions.h:224
Defines all the enumeration and common types used across the NDS library.
Represents a thread.
Definition: thread.h:44
std::map< std::string, std::string > namedParameters_t
Map containing named parameters passed to the device during the initialization.
Definition: definitions.h:222
Communicates with a static instance of the control system.
Definition: factory.h:43