pvAccessCPP 7.1.8
Loading...
Searching...
No Matches
serverContext.h
1
7#ifndef SERVERCONTEXT_H_
8#define SERVERCONTEXT_H_
9
10#include <epicsTime.h>
11
12#include <pv/pvaDefs.h>
13#include <pv/beaconServerStatusProvider.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
21namespace epics {
22namespace pvAccess {
23
27class epicsShareClass ServerContext
28{
29public:
30 POINTER_DEFINITIONS(ServerContext);
31
35 virtual ~ServerContext() {};
36
41 virtual const ServerGUID& getGUID() = 0;
42
47 virtual const Version& getVersion() = 0;
48
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
78
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;
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.
134epicsShareFunc 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_ */
duration< int64_t > seconds
constexpr void push_back(const value_type &__x)
Options for a server insatnce.
Config & providers(const std::vector< ChannelProvider::shared_pointer > &p)
Attach many providers.
Config & config(const Configuration::const_shared_pointer &c)
Use specific configuration. Default is process environment.
Config & provider(const ChannelProvider::shared_pointer &p)
short hand for providers() with a length 1 vector.
The class representing a PVA Server context.
virtual void run(epics::pvData::uint32 seconds)=0
Run server (process events).
virtual epics::pvData::int32 getBroadcastPort()=0
Get broadcast port.
virtual const ServerGUID & getGUID()=0
Returns GUID (12-byte array).
virtual epics::pvData::int32 getServerPort()=0
Get server port.
virtual void printInfo(std::ostream &str, int lvl=0)=0
Prints detailed information about the context to the specified output stream.
virtual const Version & getVersion()=0
Get context implementation version.
virtual ~ServerContext()
Destructor.
static ServerContext::shared_pointer create(const Config &conf=Config())
Start a new PVA server.
virtual void setBeaconServerStatusProvider(BeaconServerStatusProvider::shared_pointer const &beaconServerStatusProvider)=0
Set beacon server status provider.
void printInfo(int lvl=0)
Prints detailed information about the context to the standard output stream.
virtual Configuration::shared_pointer getCurrentConfig()=0
Return a Configuration with the actual values being used, including defaults used,...
const std::string PVACCESS_ALL_PROVIDERS
"All-providers registered" PVA provider name.
uint32_t uint32
Copyright - See the COPYRIGHT that is included with this distribution.
Globally unique ID.
Definition pvaDefs.h:14