source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services.hpp @ 1878

Last change on this file since 1878 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: 2.5 KB
Line 
1#ifndef __SERVICE_HPP__
2#define __SERVICE_HPP__
3
4#include "xios_spl.hpp"
5#include "mpi.hpp"
6#include "services_manager.hpp"
7#include "event_scheduler.hpp"
8
9namespace xios
10{
11
12  class CServerContext ;
13
14  class CService
15  {
16    public:
17   
18    const int NOTIFY_NOTHING=0 ;
19    const int NOTIFY_CREATE_CONTEXT=1 ;
20
21    CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, 
22             int type, int nbPartitions) ;
23    bool eventLoop(bool serviceOnly=false) ;
24    void createContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ;
25    void checkCreateContextNotification(void) ;
26    void createContextNotify(int rank, const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ;
27    void createContextDumpOut(CBufferOut& buffer) ;
28    void createContextDumpIn(CBufferIn& buffer) ;
29    void createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ;
30    CServerContext* getServerContext(const std::string& contextId) { return contexts_[contextId]; }
31    void finalizeSignal(void) ;
32    CEventScheduler* getEventScheduler(void) ;
33
34    std::string getPoolId(void) {return poolId_;}
35    std::string getServiceId(void) {return serviceId_;}
36    int getPartitionId(void) {return partitionId_;}
37    int getType(void) {return type_;}
38    int getNbPartitions(void) {return nbPartitions_;}
39
40    private:
41    void sendNotification(int rank) ;
42    void notificationsDumpOut(CBufferOut& buffer) ;
43    void notificationsDumpIn(CBufferIn& buffer) ;
44    void checkNotifications(void) ;
45    void createContext(void) ;
46
47    MPI_Comm serviceComm_ ;
48    MPI_Comm globalComm_ ;
49
50    const size_t maxBufferSize_=1024*1024 ;
51    const int localLeader_=0 ;
52    int globalLeader_ ;
53    CWindowManager* winNotify_ ;
54   
55    std::string name_ ;
56
57    std::list<std::tuple<std::string, std::string, int, std::string>> notifications_;
58   
59    bool hasNotification_ ;
60    int notifyInType_,notifyOutType_ ;
61    std::tuple<std::string, std::string, int, std::string> notifyInCreateContext_, notifyOutCreateContext_ ;
62
63    std::map<std::string, CServerContext*> contexts_ ;
64    bool finalizeSignal_ ;
65    CEventScheduler* eventScheduler_ ;
66
67    std::string poolId_ ;
68    std::string serviceId_ ;
69    int partitionId_ ;
70    int type_ ;
71    int nbPartitions_ ;
72
73  };
74
75}
76
77
78
79#endif
Note: See TracBrowser for help on using the repository browser.