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

Last change on this file since 1764 was 1764, checked in by ymipsl, 5 years ago

Some Update on XIOS services
Seems to work on Irène for :

  • first level of servers
  • fisrt + second level of servers
  • attached mode

YM

  • Property svn:executable set to *
File size: 3.4 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/*    bool createServerContextIntercomm(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId,
34                                      const MPI_Comm& intraComm, MPI_Comm& InterComm, bool wait=true) ;*/
35   
36    bool createServerContextIntercomm(const std::string& poolId, const std::string& serviceId, const int& partitionId, 
37                                      const std::string& contextId, const string& sourceContext, bool wait=true) ;
38
39    string getServerContextName(const std::string& poolId, const std::string& serviceId, const int& partitionId, 
40                                const int& type, const string& contextId) ;
41 
42 
43    void sendNotification(int rank); 
44    void checkNotifications(void) ;
45
46    void eventLoop(void) ;
47    void notificationsDumpOut(CBufferOut& buffer) ;
48    void notificationsDumpIn(CBufferIn& buffer) ;
49   
50    void registerContext(const std::string& fullContextId, const SRegisterContextInfo& contextInfo) ;
51   
52    bool getContextInfo(const std::string& fullContextId, SRegisterContextInfo& contextInfo, MPI_Comm comm=MPI_COMM_NULL) ;
53    bool getContextPoolId(const string& fullContextId, string& poolId, MPI_Comm comm=MPI_COMM_NULL) ;
54    bool getContextServiceId(const string& fullContextId, string& serviceId, MPI_Comm comm=MPI_COMM_NULL) ;
55    bool getContextPartitionId(const string& fullContextId, int& partitionId, MPI_Comm comm=MPI_COMM_NULL) ;
56    bool getContextId(const string& fullContextId, string& contextId, MPI_Comm comm=MPI_COMM_NULL) ;
57    bool getContextLeader(const string& fullContextId, int& leader, MPI_Comm comm=MPI_COMM_NULL) ;
58    bool getContextSize(const string& fullContextId, int& size, MPI_Comm comm=MPI_COMM_NULL) ;
59    bool getContextServiceType(const string& fullContextId, int& serviceType, MPI_Comm comm=MPI_COMM_NULL) ;
60   
61    bool hasContext(const std::string&  fullContextId, MPI_Comm comm=MPI_COMM_NULL) ;
62 
63    void contextsDumpOut(CBufferOut& buffer) ;
64    void contextsDumpIn(CBufferIn& buffer) ;   
65
66    void createServerContext(void) ; //private
67    void createServerContextIntercomm(void) ; //private
68
69    private :
70
71    CWindowManager* winContexts_ ;
72    CWindowManager* winNotify_ ;
73
74
75    const size_t maxBufferSize_=1024*1024 ;
76
77    MPI_Comm xiosComm_ ;
78
79    int notifyType_ ;
80    tuple<std::string, std::string, int, std::string> notifyCreateContext_ ;
81    tuple<std::string, std::string, int, std::string, int, std::string> notifyCreateIntercomm_ ;
82
83    std::map<std::string, SRegisterContextInfo> contexts_ ;
84
85    int managerGlobalLeader_ ;
86   
87    friend class CWindowManager ;
88 
89  } ;
90
91}
92
93
94
95#endif
Note: See TracBrowser for help on using the repository browser.