NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
base.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 NDSBASE_H
11 #define NDSBASE_H
12 
22 #include <memory>
23 #include <string>
24 #include <ostream>
25 #include "nds3/definitions.h"
26 #include "nds3/thread.h"
27 
33 namespace nds
34 {
35 
36 class BaseImpl;
37 class Port;
38 class Node;
39 
45 class NDS3_API Base
46 {
47  friend class Node;
48 
49 public:
50 #ifndef SWIG
51  Base(std::shared_ptr<BaseImpl> impl);
52 #endif
53 
54 protected:
58  Base();
59 
60 public:
67  Base(const Base& right);
68 
76  Base& operator=(const Base& right);
77 
78  virtual ~Base();
79 
90  void setExternalName(const std::string& externalName);
91 
99  virtual Port getPort();
100 
107  const std::string& getComponentName() const;
108 
116  const std::string& getFullName() const;
117 
127  const std::string& getFullExternalName() const;
128 
140  const std::string& getFullNameFromPort() const;
141 
153  timespec getTimestamp() const;
154 
165  void setTimestampDelegate(getTimestampPlugin_t timestampDelegate);
166 
194  std::ostream& getLogger(const logLevel_t logLevel);
195 
203  bool isLogLevelEnabled(const logLevel_t logLevel) const;
204 
213  void setLogLevel(const logLevel_t logLevel);
214 
234  void defineCommand(const std::string& command, const std::string& usage, const size_t numParameters, const command_t function);
235 
246  Thread runInThread(const std::string& name, threadFunction_t function);
247 
258  Thread runInThread(threadFunction_t function);
259 
260 #ifndef SWIG
261 protected:
262  std::shared_ptr<BaseImpl> m_pImplementation;
263 #endif
264 
265 };
266 
267 }
268 #endif // NDSBASE_H
std::function< timespec()> getTimestampPlugin_t
Definition for a function called to retrieve a time.
Definition: definitions.h:279
A node object that can contain other nodes or PVs as children.
Definition: node.h:38
Represents a node with direct connection with the controlled device.
Definition: port.h:35
This is the base class for all the NDS3 public classes that declare a device part (node...
Definition: base.h:45
logLevel_t
Defines the severities of the log information.
Definition: definitions.h:80
Defines the nds::Thread class used to execute tasks on parallel threads.
std::function< parameters_t(const parameters_t &parameters)> 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 a thread.
Definition: thread.h:44