source: XIOS/dev/dev_ym/XIOS_SERVICES/src/manager/ressources_manager.hpp @ 1761

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

implementing first guess for service functionnalities.

YM

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#ifndef __RESSOURCES_MANAGER_HPP__
2#define __RESSOURCES_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 "pool_ressource.hpp"
13
14
15
16namespace xios
17{
18
19
20  class CRessourcesManager
21  {
22
23    const int NOTIFY_NOTHING=0 ;
24    const int NOTIFY_CREATE_POOL=1 ;
25    const int NOTIFY_FINALIZE=2 ;
26
27    public:
28   
29    CRessourcesManager(bool isXiosServer) ;
30
31    void eventLoop(void) ;
32    void createPool(const std::string& id, int size) ;
33    void createPool(void) ;
34    void finalize(void) ;
35    void finalizeSignal(void) ;
36    void sendNotification(int rank); 
37    void checkNotifications(void) ;
38    void notificationsDumpOut(CBufferOut& buffer) ;
39    void notificationsDumpIn(CBufferIn& buffer) ;
40
41    void ressourcesDumpOut(CBufferOut& buffer) ;
42    void ressourcesDumpIn(CBufferIn& buffer) ;   
43
44    int  getRessourcesSize(void) ;
45    int  getFreeRessourcesSize(void) ;
46    bool getPoolInfo(const string& poolId, int& size, int& leader) ;
47    bool getPoolLeader(const string& poolId, int& leader) ;
48    bool getPoolSize(const string& poolId, int& size) ;
49    bool hasPool(const string& poolId) ;
50
51    void registerServerLeader(int leaderRank) ;
52    void registerRessourcesSize(int size) ;
53    void registerPool(const std::string& poolId,int size,int leader) ;
54
55    int managerGlobalLeader_ ;
56
57    CWindowManager* winRessources_ ;
58
59    CWindowManager* winNotify_ ;
60
61    const size_t maxBufferSize_=1024*1024 ;
62
63    MPI_Comm xiosComm_ ;
64
65    int notifyType_ ;
66    tuple<std::string, int> notifyCreatePool_ ;
67
68    std::map<std::string, std::tuple<int,int>> pools_ ;
69    int serverLeader_ ;
70    int ressourcesSize_ ;
71    int freeRessourcesSize_ ;
72
73    friend class CWindowManager ;
74  } ;
75
76}
77#endif
Note: See TracBrowser for help on using the repository browser.