Skip to main content

Post-processing tools 2023 R2

dvs_server_interface.h

Last update: 17.04.2023
Go to the documentation of this file.
1 /* *************************************************************
2  * Copyright 2017-2020 ANSYS, Inc.
3  * All Rights Reserved.
4  *
5  * Restricted Rights Legend
6  *
7  * Use, duplication, or disclosure of this
8  * software and its documentation by the
9  * Government is subject to restrictions as
10  * set forth in subdivision [(b)(3)(ii)] of
11  * the Rights in Technical Data and Computer
12  * Software clause at 52.227-7013.
13  * *************************************************************
14  */
15 
16 #ifndef ___DVS_SERVER_INTERFACE___
17 #define ___DVS_SERVER_INTERFACE___
18 
36 #include <map>
37 #include <string>
38 
39 #include "transport_interface.h"
40 #include "include/dvs_import_export.h"
41 
42 namespace DVS
43 {
56  class IServer
57  {
58  public:
59 
60  IServer() = default;
61  virtual ~IServer() = default;
62  IServer(IServer&&) = default;
63  IServer& operator=(IServer&&) = default;
64  IServer(const IServer&) = default;
65  IServer& operator=(const IServer&) = default;
66 
73  virtual void set_options(const std::map<const char*,const char*>& options) = 0;
74 
85  virtual void set_option(const char* key, const char* value) = 0;
86 
91  virtual void clear_options() = 0;
92 
100  virtual bool running() const = 0;
101 
111  virtual dvs_ret get_timestep_count(uint32_t& num_pending, uint32_t& num_complete) const = 0;
112 
125  virtual dvs_ret startup(uint32_t server_number, uint32_t local_ranks) = 0;
126 
147  virtual dvs_ret startup_unthreaded(uint32_t server_number, uint32_t local_ranks) = 0;
148 
166  virtual dvs_ret update() = 0;
167 
180  virtual dvs_ret terminating() = 0;
181 
186  virtual void shutdown() = 0;
187 
194  virtual ITransport* create_transport(const std::string& shared_secret) = 0;
195 
201  virtual const char* get_uri() = 0;
202  };
203 
213  DVS_DLL_EXPORT IServer* CREATE_SERVER_INSTANCE(const char* uri);
214 
220  DVS_DLL_EXPORT void DESTROY_SERVER_INSTANCE(DVS::IServer* destroy);
221 }
222 
223 #endif //___DVS_SERVER_INTERFACE___
Interface class used to run a dynamic data server in a thread accepting incoming client connections.
virtual ITransport * create_transport(const std::string &shared_secret)=0
Create a transport object to communicate with server, must be destroyed.
IServer(IServer &&)=default
default
virtual void set_option(const char *key, const char *value)=0
Set a specific option on the server, these are used during startup See See Server Options.
IServer & operator=(IServer &&)=default
default
virtual const char * get_uri()=0
Get URI of this server.
IServer()=default
default
virtual bool running() const =0
Check to see if the server is running.
virtual dvs_ret startup(uint32_t server_number, uint32_t local_ranks)=0
Start the server.
virtual dvs_ret terminating()=0
Call to begin terminating the server.
IServer(const IServer &)=default
support copying
virtual void shutdown()=0
Shutdown the server, also called on server destruction by DVS::DESTROY_SERVER_INSTANCE()
virtual dvs_ret get_timestep_count(uint32_t &num_pending, uint32_t &num_complete) const =0
return the current number of pending and complete timesteps in the server
virtual void set_options(const std::map< const char *, const char * > &options)=0
Set a collection of options on the server. Overwrites previous options See. See Server Options.
IServer & operator=(const IServer &)=default
default
virtual dvs_ret startup_unthreaded(uint32_t server_number, uint32_t local_ranks)=0
Startup a server manually without threads.
virtual void clear_options()=0
Clear all options from the server.
virtual ~IServer()=default
default
virtual dvs_ret update()=0
Perform a server update.
DVS_DLL_EXPORT IServer * CREATE_SERVER_INSTANCE(const char *uri)
Create a DVS::IServer instance for clients to connect to.
DVS_DLL_EXPORT void DESTROY_SERVER_INSTANCE(DVS::IServer *destroy)
Destroy the server instance (also shutting it down if needed)
int32_t dvs_ret
Return value of methods, TODO.