source: XIOS1/trunk/src/server.hpp @ 2520

Last change on this file since 2520 was 548, checked in by rlacroix, 10 years ago

Backport r523 into the stable branch.

Improve the message error handling by mimicking the behavior of the info/report logs.

Output the error messages to the standart error message until the context is correctly initialized. Then, output the error messages to a file if the user has set "print_file" parameter to "true".

  • Fix: Errors that occured before MPI was initialized (e.g. during the config file parsing) caused a MPI error on top of the original error.
  • Fix: The error file could sometimes be misnamed if the error happened before the context was completely known.
  • 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: 1.9 KB
Line 
1#ifndef __SERVER_HPP__
2#define __SERVER_HPP__
3
4#include "xmlioserver_spl.hpp"
5#include "context.hpp"
6#include "mpi.hpp"
7#include "event_scheduler.hpp"
8
9namespace xios
10{
11    class CServer
12    {
13      public:
14        static void initialize(void);
15        static void finalize(void);
16        static void eventLoop(void);
17        static void contextEventLoop(void);
18        static void listenContext(void);
19        static void listenFinalize(void);
20        static void recvContextMessage(void* buff,int count);
21        static void listenRootContext(void);
22        static void listenRootFinalize(void);
23        static void registerContext(void* buff,int count, int leaderRank=0);
24
25        static MPI_Comm intraComm;
26        static list<MPI_Comm> interComm;
27        static CEventScheduler* eventScheduler;
28
29        struct contextMessage
30        {
31          int nbRecv;
32          int leaderRank;
33        };
34
35        static bool isRoot;
36
37        static map<string,CContext*> contextList;
38        static bool finished;
39        static bool is_MPI_Initialized;
40
41      public:
42        //! Get rank of the current process
43        static int getRank();
44
45        //! Open a file stream to write the info logs
46        static void openInfoStream(const StdString& fileName);
47        //! Write the info logs to standard output
48        static void openInfoStream();
49        //! Close the info logs file if it opens
50        static void closeInfoStream();
51
52        //! Open a file stream to write the error log
53        static void openErrorStream(const StdString& fileName);
54        //! Write the error log to standard error output
55        static void openErrorStream();
56        //! Close the error log file if it opens
57        static void closeErrorStream();
58
59      private:
60        static int rank;
61        static StdOFStream m_infoStream;
62        static StdOFStream m_errorStream;
63
64        static void openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb);
65    };
66}
67
68#endif
Note: See TracBrowser for help on using the repository browser.