source: XIOS/dev/dev_ym/XIOS_SERVICES/src/manager/contexts_manager.hpp @ 1765

Last change on this file since 1765 was 1765, checked in by ymipsl, 4 years ago

Some cleaning On XIOS services branch

YM

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#ifndef __CONTEXTS_MANAGER_HPP__
2#define __CONTEXTS_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#include "register_context_info.hpp"
13
14
15namespace xios
16{
17
18 class CContextsManager
19 { 
20    private:
21
22    const int NOTIFY_NOTHING=0 ;
23    const int NOTIFY_CREATE_CONTEXT=1 ;
24    const int NOTIFY_CREATE_INTERCOMM=2 ;
25
26   
27    public:
28 
29    CContextsManager(bool isXiosServer) ;
30    ~CContextsManager() ;
31   
32    bool createServerContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const string& contextId, bool wait=true) ;
33   
34    bool createServerContextIntercomm(const std::string& poolId, const std::string& serviceId, const int& partitionId, 
35                                      const std::string& contextId, const string& sourceContext, bool wait=true) ;
36
37    string getServerContextName(const std::string& poolId, const std::string& serviceId, const int& partitionId, 
38                                const int& type, const string& contextId) ;
39 
40 
41    void sendNotification(int rank); 
42    void checkNotifications(void) ;
43
44    void eventLoop(void) ;
45    void notificationsDumpOut(CBufferOut& buffer) ;
46    void notificationsDumpIn(CBufferIn& buffer) ;
47   
48    void registerContext(const std::string& fullContextId, const SRegisterContextInfo& contextInfo) ;
49   
50    bool getContextInfo(const std::string& fullContextId, SRegisterContextInfo& contextInfo, MPI_Comm comm=MPI_COMM_NULL) ;
51    bool getContextPoolId(const string& fullContextId, string& poolId, MPI_Comm comm=MPI_COMM_NULL) ;
52    bool getContextServiceId(const string& fullContextId, string& serviceId, MPI_Comm comm=MPI_COMM_NULL) ;
53    bool getContextPartitionId(const string& fullContextId, int& partitionId, MPI_Comm comm=MPI_COMM_NULL) ;
54    bool getContextId(const string& fullContextId, string& contextId, MPI_Comm comm=MPI_COMM_NULL) ;
55    bool getContextLeader(const string& fullContextId, int& leader, MPI_Comm comm=MPI_COMM_NULL) ;
56    bool getContextSize(const string& fullContextId, int& size, MPI_Comm comm=MPI_COMM_NULL) ;
57    bool getContextServiceType(const string& fullContextId, int& serviceType, MPI_Comm comm=MPI_COMM_NULL) ;
58   
59    bool hasContext(const std::string&  fullContextId, MPI_Comm comm=MPI_COMM_NULL) ;
60 
61    void contextsDumpOut(CBufferOut& buffer) ;
62    void contextsDumpIn(CBufferIn& buffer) ;   
63
64    void createServerContext(void) ; //private
65    void createServerContextIntercomm(void) ; //private
66
67    private :
68
69    CWindowManager* winContexts_ ;
70    CWindowManager* winNotify_ ;
71
72
73    const size_t maxBufferSize_=1024*1024 ;
74
75    MPI_Comm xiosComm_ ;
76
77    int notifyType_ ;
78    tuple<std::string, std::string, int, std::string> notifyCreateContext_ ;
79    tuple<std::string, std::string, int, std::string, int, std::string> notifyCreateIntercomm_ ;
80
81    std::map<std::string, SRegisterContextInfo> contexts_ ;
82
83    int managerGlobalLeader_ ;
84   
85    friend class CWindowManager ;
86 
87  } ;
88
89}
90
91
92
93#endif
Note: See TracBrowser for help on using the repository browser.