This is Unofficial EPICS BASE Doxygen Site
serverContext.h
Go to the documentation of this file.
1 
7 #ifndef SERVERCONTEXT_H_
8 #define SERVERCONTEXT_H_
9 
10 #include <epicsTime.h>
11 
12 #include <pv/pvaDefs.h>
14 #include <pv/pvaConstants.h>
15 #include <pv/pvaVersion.h>
16 #include <pv/pvAccess.h>
17 #include <pv/configuration.h>
18 
19 #include <shareLib.h>
20 
21 namespace epics {
22 namespace pvAccess {
23 
28 {
29 public:
31 
35  virtual ~ServerContext() {};
36 
41  virtual const ServerGUID& getGUID() = 0;
42 
47  virtual const Version& getVersion() = 0;
48 
55  virtual void run(epics::pvData::uint32 seconds) = 0;
56 
57  virtual void shutdown() = 0;
58 
62  void printInfo(int lvl =0);
63 
69  virtual void printInfo(std::ostream& str, int lvl=0) = 0;
70 
71  virtual epicsTimeStamp& getStartTime() = 0;
72 
77  virtual epics::pvData::int32 getServerPort() = 0;
78 
83  virtual epics::pvData::int32 getBroadcastPort() = 0;
84 
88  virtual Configuration::shared_pointer getCurrentConfig() = 0;
89 
90  virtual const std::vector<ChannelProvider::shared_pointer>& getChannelProviders() =0;
91 
92  // ************************************************************************** //
93  // **************************** [ Plugins ] ********************************* //
94  // ************************************************************************** //
95 
100  virtual void setBeaconServerStatusProvider(BeaconServerStatusProvider::shared_pointer const & beaconServerStatusProvider) = 0;
101 
103  class Config {
104  friend class ServerContext;
105  Configuration::const_shared_pointer _conf;
106  std::vector<ChannelProvider::shared_pointer> _providers;
107  public:
108  Config() {}
110  Config& config(const Configuration::const_shared_pointer& c) { _conf = c; return *this; }
112  Config& providers(const std::vector<ChannelProvider::shared_pointer>& p) { _providers = p; return *this; }
114  Config& provider(const ChannelProvider::shared_pointer& p) { _providers.push_back(p); return *this; }
115  };
116 
130  static ServerContext::shared_pointer create(const Config& conf = Config());
131 };
132 
133 // Caller must store the returned pointer to keep the server alive.
134 epicsShareFunc ServerContext::shared_pointer startPVAServer(
135  std::string const & providerNames = PVACCESS_ALL_PROVIDERS,
136  int timeToRun = 0,
137  bool runInSeparateThread = false,
138  bool printInfo = false);
139 
140 }
141 }
142 
143 
144 #endif /* SERVERCONTEXT_H_ */
Config & config(const Configuration::const_shared_pointer &c)
Use specific configuration. Default is process environment.
#define epicsShareFunc
Definition: shareLib.h:209
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
Mark external symbols and entry points for shared libraries.
#define str(v)
Config & providers(const std::vector< ChannelProvider::shared_pointer > &p)
Attach many providers.
#define POINTER_DEFINITIONS(clazz)
Definition: sharedPtr.h:198
#define epicsShareClass
Definition: shareLib.h:206
epicsShareFunc ServerContext::shared_pointer startPVAServer(std::string const &providerNames=PVACCESS_ALL_PROVIDERS, int timeToRun=0, bool runInSeparateThread=false, bool printInfo=false)
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
void getVersion(epics::pvData::PVDataVersion *ptr)
Definition: pvdVersion.cpp:13
Options for a server insatnce.
std::tr1::shared_ptr< BeaconServerStatusProvider > shared_pointer
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
epicsShareExtern const std::string PVACCESS_ALL_PROVIDERS
Definition: pvaConstants.h:85
int32_t int32
Definition: pvType.h:83
Config & provider(const ChannelProvider::shared_pointer &p)
short hand for providers() with a length 1 vector.
uint32_t uint32
Definition: pvType.h:99