source: XIOS/dev/dev_olga/src/server.hpp @ 983

Last change on this file since 983 was 983, checked in by oabramkina, 5 years ago

My branch

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.2 KB
Line 
1#ifndef __SERVER_HPP__
2#define __SERVER_HPP__
3
4#include "xios_spl.hpp"
5#include "context.hpp"
6#include "context_client.hpp"
7#include "mpi.hpp"
8#include "event_scheduler.hpp"
9
10namespace xios
11{
12    class CServer
13    {
14      public:
15        static void initialize(void);
16        static void finalize(void);
17        static void eventLoop(void);
18        static void contextEventLoop(void);
19        static void listenContext(void);
20        static void listenFinalize(void);
21        static void recvContextMessage(void* buff,int count);
22        static void listenRootContext(void);
23        static void listenRootFinalize(void);
24        static void registerContext(void* buff,int count, int leaderRank=0);        // context registered by the primary server
25
26        // Communicators for the primary group of servers
27        static MPI_Comm intraComm;
28        static list<MPI_Comm> interComm;
29        static std::list<MPI_Comm> contextInterComms;
30        static CEventScheduler* eventScheduler;
31
32        struct contextMessage
33        {
34          int nbRecv;
35          int leaderRank;
36        };
37
38        static bool isRoot;
39
40        static map<string,CContext*> contextList;       // contexts on the primary server
41        static bool finished;
42        static bool is_MPI_Initialized;
43
44      public:
45        //! Get rank of the current process
46        static int getRank();
47
48        //! Open a file stream to write the info logs
49        static void openInfoStream(const StdString& fileName);
50        //! Write the info logs to standard output
51        static void openInfoStream();
52        //! Close the info logs file if it opens
53        static void closeInfoStream();
54
55        //! Open a file stream to write the error log
56        static void openErrorStream(const StdString& fileName);
57        //! Write the error log to standard error output
58        static void openErrorStream();
59        //! Close the error log file if it opens
60        static void closeErrorStream();
61
62      private:
63        static int rank;
64        static StdOFStream m_infoStream;
65        static StdOFStream m_errorStream;
66
67        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
68    };
69}
70
71#endif
Note: See TracBrowser for help on using the repository browser.