source: XIOS3/trunk/src/manager/services_manager.hpp @ 2404

Last change on this file since 2404 was 2404, checked in by ymipsl, 21 months ago

Add the possibility to launch a service on same ressource than an other.
YM

  • Property svn:executable set to *
File size: 3.0 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 WRITER=2 ;
24    static const int READER=3 ;
25    static const int IO_SERVER=4 ;
26    static const int OUT_SERVER=5 ;
27    static const int ALL_SERVICES=6 ;
28
29    private:
30    const int NOTIFY_NOTHING=0 ;
31    const int NOTIFY_CREATE_SERVICE=1 ;
32    const int NOTIFY_CREATE_SERVICE_ONTO=2 ;
33   
34    public:
35   
36    CServicesManager(bool isXiosServer) ;
37    ~CServicesManager() ;
38   
39    bool createServices(const std::string& poolId, const std::string& serviceId, int type, int size, int nbPartition, bool wait=true) ;
40    bool createServicesOnto(const std::string& poolId, const std::string& serviceId, int type, const std::string& onServiceId, bool wait=true) ;
41   
42    void eventLoop(void) ;
43   
44    void registerService(const std::string& poolId, const std::string& serviceId, const int& partitionId, int type, int size, int nbPartitions, int leader) ;
45    bool getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, int& size, int& nbPartition, int& leader) ;
46    bool getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) ;
47    bool getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) ;
48    bool getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartition) ;
49    bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
50    void servicesDumpOut(CBufferOut& buffer) ;
51    void servicesDumpIn(CBufferIn& buffer) ;
52
53    private:
54
55    void createService(void) ;
56    void createServiceOnto(void) ;   
57    void createServicesNotify(int rank, const string& serviceId, int type, int size, int nbPartitions) ;
58    void createServicesOntoNotify(int rank, const string& serviceId, int type, const string& OnServiceId) ;
59    void sendNotification(int rank) ;
60    void checkNotifications(void) ;
61    void notificationsDumpOut(CBufferOut& buffer) ;
62    void notificationsDumpIn(CBufferIn& buffer) ;
63
64
65    private :
66   
67    CWindowManager* winServices_ ;
68    CWindowManager* winNotify_ ;
69    const size_t maxBufferSize_=1024*1024 ;
70
71    MPI_Comm xiosComm_ ;
72
73    int notifyType_ ;
74    tuple<std::string, int, int, int> notifyCreateService_ ;
75    tuple<std::string, int, std::string> notifyCreateServiceOnto_ ;
76   
77    std::map<tuple<std::string, std::string, int>, std::tuple<int, int, int, int> > services_ ;
78
79    int managerGlobalLeader_ ;
80
81    const double eventLoopLatency_=0; 
82    double lastEventLoop_=0. ;
83   
84    friend class CWindowManager ;
85  } ;
86
87
88}
89
90
91
92#endif
Note: See TracBrowser for help on using the repository browser.