source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services_manager.hpp @ 2335

Last change on this file since 2335 was 2335, checked in by jderouillat, 2 years ago

Introduced a new service (named defaultServicesId which contains all gatherers and all IO servers) to manage oasis_enddef through the different levels of servers. OASIS integration is moved in a dedicated virtual class CThirdPartyDriver whose an instance is owned by CServer.

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#ifndef __SERVICES_MANAGER_HPP__
2#define __SERVICES_MANAGER_HPP__
3
4#include "xios_spl.hpp"
5#include "mpi.hpp"
6#include "buffer_in.hpp"
7#include "buffer_out.hpp"
8
9#include <string>
10#include <map>
11#include "window_manager.hpp"
12
13
14
15namespace xios
16{
17  class CServicesManager
18  {
19
20    public: 
21    static const int CLIENT=0 ;
22    static const int GATHERER=1 ;
23    static const int IO_SERVER=2 ;
24    static const int OUT_SERVER=3 ;
25    static const int ALL_SERVICES=4 ;
26
27    public:
28   
29    CServicesManager(bool isXiosServer) ;
30    ~CServicesManager() ;
31   
32    bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ;
33    void createServicesNotify(int rank, const string& serviceId, int type, int size, int nbPartitions) ;
34    void checkCreateServicesNotification(void) ;
35    void eventLoop(void) ;
36    void notificationsDumpOut(CBufferOut& buffer) ;
37    void notificationsDumpIn(CBufferIn& buffer) ;
38   
39    void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ;
40    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader) ;
41    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) ;
42    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) ;
43    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition) ;
44    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
45    void servicesDumpOut(CBufferOut& buffer) ;
46    void servicesDumpIn(CBufferIn& buffer) ;
47   
48
49    private :
50   
51    CWindowManager* winServices_ ;
52    CWindowManager* winNotify_ ;
53    const size_t maxBufferSize_=1024*1024 ;
54
55    MPI_Comm xiosComm_ ;
56
57    std::list<std::tuple<std::string, int, int, int> > notifications_;
58   
59    std::map<tuple<std::string, std::string, int>, std::tuple<int, int, int, int> > services_ ;
60
61    int managerGlobalLeader_ ;
62
63    const double eventLoopLatency_=0; 
64    double lastEventLoop_=0. ;
65   
66    friend class CWindowManager ;
67  } ;
68
69
70}
71
72
73
74#endif
Note: See TracBrowser for help on using the repository browser.