source: XIOS/dev/dev_olga/src/server.cpp @ 1133

Last change on this file since 1133 was 1133, checked in by oabramkina, 7 years ago

Fixing a bug appearing during client/server initialization.

  • 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
  • Property svn:eol-style set to native
File size: 21.8 KB
Line 
1#include "globalScopeData.hpp"
2#include "xios_spl.hpp"
3#include "cxios.hpp"
4#include "server.hpp"
5#include "client.hpp"
6#include "type.hpp"
7#include "context.hpp"
8#include "object_template.hpp"
9#include "oasis_cinterface.hpp"
10#include <boost/functional/hash.hpp>
11#include <boost/algorithm/string.hpp>
12#include "mpi.hpp"
13#include "tracer.hpp"
14#include "timer.hpp"
15#include "event_scheduler.hpp"
16
17namespace xios
18{
19    MPI_Comm CServer::intraComm ;
20    list<MPI_Comm> CServer::interCommLeft ;
21    list<MPI_Comm> CServer::interCommRight ;
22//    list<MPI_Comm> CServer::interComm ;
23    std::list<MPI_Comm> CServer::contextInterComms;
24    std::list<MPI_Comm> CServer::contextIntraComms;
25    int CServer::serverLevel = 0 ;
26    int CServer::serverLeader_ = 0;
27    int CServer::serverSize_ = 0;
28    int CServer::nbPools = 0;
29    int CServer::poolId = 0;
30    int CServer::nbContexts_ = 0;
31    bool CServer::isRoot = false ;
32    int CServer::rank_ = INVALID_RANK;
33    StdOFStream CServer::m_infoStream;
34    StdOFStream CServer::m_errorStream;
35    map<string,CContext*> CServer::contextList ;
36    bool CServer::finished=false ;
37    bool CServer::is_MPI_Initialized ;
38    CEventScheduler* CServer::eventScheduler = 0;
39
40//---------------------------------------------------------------
41/*!
42 * \fn void CServer::initialize(void)
43 * Creates intraComm for each possible type of servers (classical, primary or secondary).
44 * In case of secondary servers intraComm is created for each secondary server pool.
45 * (For now the assumption is that there is one proc per pool.)
46 * Creates the following lists of interComms:
47 *   classical server -- interCommLeft
48 *   primary server -- interCommLeft and interCommRight
49 *   secondary server -- interComm for each pool.
50 */
51    void CServer::initialize(void)
52    {
53      int initialized ;
54      MPI_Initialized(&initialized) ;
55      if (initialized) is_MPI_Initialized=true ;
56      else is_MPI_Initialized=false ;
57
58      // Not using OASIS
59      if (!CXios::usingOasis)
60      {
61
62        if (!is_MPI_Initialized)
63        {
64          MPI_Init(NULL, NULL);
65        }
66        CTimer::get("XIOS").resume() ;
67
68        boost::hash<string> hashString ;
69        unsigned long hashServer = hashString(CXios::xiosCodeId);
70
71        unsigned long* hashAll ;
72
73//        int rank ;
74        int size ;
75        int myColor ;
76        int i,c ;
77        MPI_Comm newComm, serversComm;
78
79        MPI_Comm_size(CXios::globalComm, &size) ;
80        MPI_Comm_rank(CXios::globalComm, &rank_);
81
82        hashAll=new unsigned long[size] ;
83        MPI_Allgather(&hashServer, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ;
84
85        map<unsigned long, int> colors ;
86        map<unsigned long, int> leaders ;
87        map<unsigned long, int> lastProcesses ;  // needed in case of two server levels
88        map<unsigned long, int>::iterator it ;
89
90        for(i=0,c=0;i<size;i++)
91        {
92          if (colors.find(hashAll[i])==colors.end())
93          {
94            colors[hashAll[i]]=c ;
95            leaders[hashAll[i]]=i ;
96            c++ ;
97          }
98          if (hashAll[i+1] != hashAll[i])
99            lastProcesses[hashAll[i]]=i ;
100        }
101
102        // Setting the number of secondary pools
103        myColor = colors[hashServer];
104        if (CXios::usingServer2)
105        {
106          int serverRank = rank_ - leaders[hashServer]; // server proc rank starting 0
107          serverSize_ = lastProcesses[hashServer] - leaders[hashServer] + 1;
108//          serverSize_ = lastProcesses - leaders[hashServer];
109          nbPools = serverSize_ * CXios::ratioServer2 / 100;
110          if ( serverRank < (serverSize_ - nbPools) )
111          {
112            serverLevel = 1;
113          }
114          else
115          {
116            serverLevel = 2;
117            poolId = serverRank - serverSize_ + nbPools;
118            myColor = rank_;
119          }
120        }
121
122        MPI_Comm_split(CXios::globalComm, myColor, rank_, &intraComm) ;
123
124        if (serverLevel == 0)
125        {
126          int clientLeader;
127          for(it=leaders.begin();it!=leaders.end();it++)
128          {
129            if (it->first!=hashServer)
130            {
131              clientLeader=it->second ;
132              int intraCommSize, intraCommRank ;
133              MPI_Comm_size(intraComm,&intraCommSize) ;
134              MPI_Comm_rank(intraComm,&intraCommRank) ;
135              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<intraCommSize
136                       <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ;
137
138              MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ;
139               interCommLeft.push_back(newComm) ;
140            }
141          }
142        }
143        else if (serverLevel == 1)
144        {
145          int clientLeader, srvSndLeader;
146          int srvPrmLeader ;
147          for (it=leaders.begin();it!=leaders.end();it++)
148          {
149            if (it->first != hashServer)
150            {
151              clientLeader=it->second ;
152              int intraCommSize, intraCommRank ;
153              MPI_Comm_size(intraComm, &intraCommSize) ;
154              MPI_Comm_rank(intraComm, &intraCommRank) ;
155              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<intraCommSize
156                       <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ;
157              MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ;
158              interCommLeft.push_back(newComm) ;
159            }
160            else
161              serverLeader_ = it->second;
162          }
163
164          for (int i = 0; i < nbPools; ++i)
165          {
166            srvSndLeader = serverLeader_ + serverSize_ - nbPools + i;
167            int intraCommSize, intraCommRank ;
168            MPI_Comm_size(intraComm, &intraCommSize) ;
169            MPI_Comm_rank(intraComm, &intraCommRank) ;
170            info(50)<<"intercommCreate::client "<<rank_<<" intraCommSize : "<<intraCommSize
171                <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< srvSndLeader<<endl ;
172            MPI_Intercomm_create(intraComm, 0, CXios::globalComm, srvSndLeader, 0, &newComm) ;
173            interCommRight.push_back(newComm) ;
174          }
175        } // primary server
176        else
177        {
178          int clientLeader;
179          clientLeader = leaders[hashString(CXios::xiosCodeId)];
180          int intraCommSize, intraCommRank ;
181          MPI_Comm_size(intraComm, &intraCommSize) ;
182          MPI_Comm_rank(intraComm, &intraCommRank) ;
183          info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<intraCommSize
184                   <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ;
185
186          MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ;
187          interCommLeft.push_back(newComm) ;
188        } // secondary server
189
190        delete [] hashAll ;
191
192      }
193      // using OASIS
194      else
195      {
196        int size, rank;
197        int myColor;
198        if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId);
199
200        CTimer::get("XIOS").resume() ;
201        MPI_Comm localComm;
202        oasis_get_localcomm(localComm);
203
204        // Create server intraComm
205        if (!CXios::usingServer2)
206          MPI_Comm_dup(localComm, &intraComm);
207        else
208        {
209          MPI_Comm_rank(localComm,&rank) ;
210          MPI_Comm_size(localComm,&serverSize_) ;
211          nbPools = serverSize_ * CXios::ratioServer2 / 100;
212          if ( rank < (serverSize_ - nbPools) )
213          {
214            serverLevel = 1;
215            myColor = 0;
216          }
217          else
218          {
219            serverLevel = 2;
220            poolId = rank - serverSize_ + nbPools;
221            myColor = rank;
222          }
223          MPI_Comm_split(localComm, myColor, rank, &intraComm) ;
224
225        }
226        MPI_Comm_rank(intraComm,&rank_) ;
227        MPI_Comm_size(intraComm,&size) ;
228
229        string codesId=CXios::getin<string>("oasis_codes_id") ;
230
231        vector<string> splitted ;
232        boost::split( splitted, codesId, boost::is_any_of(","), boost::token_compress_on ) ;
233        vector<string>::iterator it ;
234
235        MPI_Comm newComm ;
236        int globalRank ;
237        MPI_Comm_rank(CXios::globalComm,&globalRank);
238
239        for(it=splitted.begin();it!=splitted.end();it++)
240        {
241          oasis_get_intercomm(newComm,*it) ;
242//        interComm.push_back(newComm) ;
243          if ( !CXios::usingServer2)
244            interCommLeft.push_back(newComm) ;
245          else
246          {
247            if (serverLevel == 1)
248            {
249              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size
250                       <<" intraCommRank :"<<rank_<<"  clientLeader "<< rank<<endl ;
251              MPI_Intercomm_create(intraComm, 0, localComm, rank, 0, &newComm) ;
252              interCommRight.push_back(newComm) ;
253
254            }
255            else if (serverLevel == 2)
256            {
257              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size
258                       <<" intraCommRank :"<<rank_<<"  clientLeader "<< 0<<endl ;
259              MPI_Intercomm_create(intraComm, 0, localComm, 0, 0, &newComm) ;
260              interCommLeft.push_back(newComm) ;
261
262            }
263
264          }
265//          if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ;
266//          MPI_Comm_remote_size(newComm,&size);
267          // Send serverLeader to client
268          if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,interCommLeft.back()) ;
269        }
270              oasis_enddef() ;
271      }
272
273      MPI_Comm_rank(intraComm, &rank_) ;
274      if (rank_==0) isRoot=true;
275      else isRoot=false;
276     
277      eventScheduler = new CEventScheduler(intraComm) ;
278    }
279
280    void CServer::finalize(void)
281    {
282
283      CTimer::get("XIOS").suspend() ;
284     
285      delete eventScheduler ;
286
287      for (std::list<MPI_Comm>::iterator it = contextInterComms.begin(); it != contextInterComms.end(); it++)
288        MPI_Comm_free(&(*it));
289
290      for (std::list<MPI_Comm>::iterator it = contextIntraComms.begin(); it != contextIntraComms.end(); it++)
291        MPI_Comm_free(&(*it));
292
293//      for (std::list<MPI_Comm>::iterator it = interComm.begin(); it != interComm.end(); it++)
294//        MPI_Comm_free(&(*it));
295
296//        for (std::list<MPI_Comm>::iterator it = interCommLeft.begin(); it != interCommLeft.end(); it++)
297//          MPI_Comm_free(&(*it));
298
299        for (std::list<MPI_Comm>::iterator it = interCommRight.begin(); it != interCommRight.end(); it++)
300          MPI_Comm_free(&(*it));
301
302      MPI_Comm_free(&intraComm);
303
304      if (!is_MPI_Initialized)
305      {
306        if (CXios::usingOasis) oasis_finalize();
307        else MPI_Finalize() ;
308      }
309      report(0)<<"Performance report : Time spent for XIOS : "<<CTimer::get("XIOS server").getCumulatedTime()<<endl  ;
310      report(0)<<"Performance report : Time spent in processing events : "<<CTimer::get("Process events").getCumulatedTime()<<endl  ;
311      report(0)<<"Performance report : Ratio : "<<CTimer::get("Process events").getCumulatedTime()/CTimer::get("XIOS server").getCumulatedTime()*100.<<"%"<<endl  ;
312    }
313
314     void CServer::eventLoop(void)
315     {
316       bool stop=false ;
317
318       CTimer::get("XIOS server").resume() ;
319       while(!stop)
320       {
321
322         if (isRoot)
323         {
324           listenContext();
325           if (!finished) listenFinalize() ;
326         }
327         else
328         {
329           listenRootContext();
330           if (!finished) listenRootFinalize() ;
331         }
332
333         contextEventLoop() ;
334         if (finished && contextList.empty()) stop=true ;
335         eventScheduler->checkEvent() ;
336
337       }
338       CTimer::get("XIOS server").suspend() ;
339     }
340
341     void CServer::listenFinalize(void)
342     {
343        list<MPI_Comm>::iterator it, itr;
344        int msg ;
345        int flag ;
346
347        for(it=interCommLeft.begin();it!=interCommLeft.end();it++)
348        {
349           MPI_Status status ;
350           traceOff() ;
351           MPI_Iprobe(0,0,*it,&flag,&status) ;
352           traceOn() ;
353           if (flag==true)
354           {
355              MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ;
356              info(20)<<" CServer : Receive client finalize"<<endl ;
357              // Sending server finalize message to secondary servers (if any)
358              for(itr=interCommRight.begin();itr!=interCommRight.end();itr++)
359              {
360                MPI_Send(&msg,1,MPI_INT,0,0,*itr) ;
361              }
362              MPI_Comm_free(&(*it));
363              interCommLeft.erase(it) ;
364              break ;
365            }
366         }
367
368         if (interCommLeft.empty())
369         {
370           int i,size ;
371           MPI_Comm_size(intraComm,&size) ;
372           MPI_Request* requests= new MPI_Request[size-1] ;
373           MPI_Status* status= new MPI_Status[size-1] ;
374
375           for(int i=1;i<size;i++) MPI_Isend(&msg,1,MPI_INT,i,4,intraComm,&requests[i-1]) ;
376           MPI_Waitall(size-1,requests,status) ;
377
378           finished=true ;
379           delete [] requests ;
380           delete [] status ;
381         }
382     }
383
384
385     void CServer::listenRootFinalize()
386     {
387        int flag ;
388        MPI_Status status ;
389        int msg ;
390
391        traceOff() ;
392        MPI_Iprobe(0,4,intraComm, &flag, &status) ;
393        traceOn() ;
394        if (flag==true)
395        {
396           MPI_Recv(&msg,1,MPI_INT,0,4,intraComm,&status) ;
397           finished=true ;
398        }
399      }
400
401     void CServer::listenContext(void)
402     {
403
404       MPI_Status status ;
405       int flag ;
406       static void* buffer ;
407       static MPI_Request request ;
408       static bool recept=false ;
409       int rank ;
410       int count ;
411
412       if (recept==false)
413       {
414         traceOff() ;
415         MPI_Iprobe(MPI_ANY_SOURCE,1,CXios::globalComm, &flag, &status) ;
416         traceOn() ;
417         if (flag==true)
418         {
419           rank=status.MPI_SOURCE ;
420           MPI_Get_count(&status,MPI_CHAR,&count) ;
421           buffer=new char[count] ;
422           MPI_Irecv(buffer,count,MPI_CHAR,rank,1,CXios::globalComm,&request) ;
423           recept=true ;
424         }
425       }
426       else
427       {
428         traceOff() ;
429         MPI_Test(&request,&flag,&status) ;
430         traceOn() ;
431         if (flag==true)
432         {
433           rank=status.MPI_SOURCE ;
434           MPI_Get_count(&status,MPI_CHAR,&count) ;
435           recvContextMessage(buffer,count) ;
436           delete [] buffer;
437           recept=false ;
438         }
439       }
440     }
441
442     void CServer::recvContextMessage(void* buff,int count)
443     {
444       static map<string,contextMessage> recvContextId;
445       map<string,contextMessage>::iterator it ;
446       CBufferIn buffer(buff,count) ;
447       string id ;
448       int clientLeader ;
449       int nbMessage ;
450
451       buffer>>id>>nbMessage>>clientLeader ;
452
453       it=recvContextId.find(id) ;
454       if (it==recvContextId.end())
455       {
456         contextMessage msg={0,0} ;
457         pair<map<string,contextMessage>::iterator,bool> ret ;
458         ret=recvContextId.insert(pair<string,contextMessage>(id,msg)) ;
459         it=ret.first ;
460       }
461       it->second.nbRecv+=1 ;
462       it->second.leaderRank+=clientLeader ;
463
464       if (it->second.nbRecv==nbMessage)
465       {
466         int size ;
467         MPI_Comm_size(intraComm,&size) ;
468         MPI_Request* requests= new MPI_Request[size-1] ;
469         MPI_Status* status= new MPI_Status[size-1] ;
470
471         for(int i=1;i<size;i++)
472         {
473            MPI_Isend(buff,count,MPI_CHAR,i,2,intraComm,&requests[i-1]) ;
474         }
475         MPI_Waitall(size-1,requests,status) ;
476         registerContext(buff,count,it->second.leaderRank) ;
477
478         recvContextId.erase(it) ;
479         delete [] requests ;
480         delete [] status ;
481
482       }
483     }
484
485     void CServer::listenRootContext(void)
486     {
487       MPI_Status status ;
488       int flag ;
489       static void* buffer ;
490       static MPI_Request request ;
491       static bool recept=false ;
492       int rank ;
493       int count ;
494       const int root=0 ;
495
496       if (recept==false)
497       {
498         traceOff() ;
499         MPI_Iprobe(root,2,intraComm, &flag, &status) ;
500         traceOn() ;
501         if (flag==true)
502         {
503           MPI_Get_count(&status,MPI_CHAR,&count) ;
504           buffer=new char[count] ;
505           MPI_Irecv(buffer,count,MPI_CHAR,root,2,intraComm,&request) ;
506           recept=true ;
507         }
508       }
509       else
510       {
511         MPI_Test(&request,&flag,&status) ;
512         if (flag==true)
513         {
514           MPI_Get_count(&status,MPI_CHAR,&count) ;
515           registerContext(buffer,count) ;
516           delete [] buffer ;
517           recept=false ;
518         }
519       }
520     }
521
522     void CServer::registerContext(void* buff, int count, int leaderRank)
523     {
524       string contextId;
525       CBufferIn buffer(buff, count);
526       buffer >> contextId;
527       CContext* context;
528
529       info(20) << "CServer : Register new Context : " << contextId << endl;
530
531       if (contextList.find(contextId) != contextList.end())
532         ERROR("void CServer::registerContext(void* buff, int count, int leaderRank)",
533               << "Context '" << contextId << "' has already been registred");
534
535       context=CContext::create(contextId);
536       contextList[contextId]=context;
537
538       // Primary or classical server: initialize its own server (CContextServer)
539       MPI_Comm inter;
540       if (serverLevel < 2)
541       {
542         MPI_Comm contextInterComm;
543         MPI_Intercomm_create(intraComm, 0, CXios::globalComm, leaderRank, 10+leaderRank, &contextInterComm);
544         MPI_Intercomm_merge(contextInterComm,1,&inter);
545         MPI_Barrier(inter);
546         MPI_Comm_free(&inter);
547         context->initServer(intraComm,contextInterComm);
548         contextInterComms.push_back(contextInterComm);
549
550       }
551       // Secondary server: initialize its own server (CContextServer)
552       else if (serverLevel == 2)
553       {
554         MPI_Comm_dup(interCommLeft.front(), &inter);
555         contextInterComms.push_back(inter);
556         context->initServer(intraComm, contextInterComms.back());
557       }
558
559       // Primary server: send create context message to secondary servers and initialize its own client (CContextClient)
560       if (serverLevel == 1)
561       {
562         int i = 0, size;
563         CMessage msg;
564         int messageSize;
565         MPI_Comm_size(intraComm, &size) ;
566         for (std::list<MPI_Comm>::iterator it = interCommRight.begin(); it != interCommRight.end(); it++, ++i)
567         {
568           StdString str = contextId +"_server_" + boost::lexical_cast<string>(i);
569           msg<<str<<size<<rank_ ;
570           messageSize = msg.size() ;
571           buff = new char[messageSize] ;
572           CBufferOut buffer(buff,messageSize) ;
573           buffer<<msg ;
574           int sndServerGloRanks = serverSize_-nbPools+serverLeader_ +i;  // the assumption is that there is only one proc per secondary server pool
575           MPI_Send(buff, buffer.count(), MPI_CHAR, sndServerGloRanks, 1, CXios::globalComm) ;
576           MPI_Comm_dup(*it, &inter);
577           contextInterComms.push_back(inter);
578           MPI_Comm_dup(intraComm, &inter);
579           contextIntraComms.push_back(inter);
580           context->initClient(contextIntraComms.back(), contextInterComms.back()) ;
581           delete [] buff ;
582         }
583         ++nbContexts_;
584       }
585     }
586
587     void CServer::contextEventLoop(void)
588     {
589       bool isFinalized ;
590
591       map<string,CContext*>::iterator it ;
592
593       for(it=contextList.begin();it!=contextList.end();it++)
594       {
595         isFinalized=it->second->isFinalized();
596         if (isFinalized)
597         {
598           it->second->postFinalize();
599           contextList.erase(it) ;
600           break ;
601         }
602         else
603         {
604           isFinalized=it->second->checkBuffersAndListen();
605         }
606       }
607     }
608
609     //! Get rank of the current process
610     int CServer::getRank()
611     {
612       return rank_;
613     }
614
615    /*!
616    * Open a file specified by a suffix and an extension and use it for the given file buffer.
617    * The file name will be suffix+rank+extension.
618    *
619    * \param fileName[in] protype file name
620    * \param ext [in] extension of the file
621    * \param fb [in/out] the file buffer
622    */
623    void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)
624    {
625      StdStringStream fileNameClient;
626      int numDigit = 0;
627      int size = 0;
628      int id;
629      MPI_Comm_size(CXios::globalComm, &size);
630      while (size)
631      {
632        size /= 10;
633        ++numDigit;
634      }
635
636      if (!CXios::usingServer2)
637        id = getRank();
638      else
639      {
640        if (serverLevel == 1)
641          id = rank_;
642        else
643          id = poolId;
644      }
645      fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << id << ext;
646      fb->open(fileNameClient.str().c_str(), std::ios::out);
647      if (!fb->is_open())
648        ERROR("void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)",
649              << std::endl << "Can not open <" << fileNameClient << "> file to write the server log(s).");
650    }
651
652    /*!
653    * \brief Open a file stream to write the info logs
654    * Open a file stream with a specific file name suffix+rank
655    * to write the info logs.
656    * \param fileName [in] protype file name
657    */
658    void CServer::openInfoStream(const StdString& fileName)
659    {
660      std::filebuf* fb = m_infoStream.rdbuf();
661      openStream(fileName, ".out", fb);
662
663      info.write2File(fb);
664      report.write2File(fb);
665    }
666
667    //! Write the info logs to standard output
668    void CServer::openInfoStream()
669    {
670      info.write2StdOut();
671      report.write2StdOut();
672    }
673
674    //! Close the info logs file if it opens
675    void CServer::closeInfoStream()
676    {
677      if (m_infoStream.is_open()) m_infoStream.close();
678    }
679
680    /*!
681    * \brief Open a file stream to write the error log
682    * Open a file stream with a specific file name suffix+rank
683    * to write the error log.
684    * \param fileName [in] protype file name
685    */
686    void CServer::openErrorStream(const StdString& fileName)
687    {
688      std::filebuf* fb = m_errorStream.rdbuf();
689      openStream(fileName, ".err", fb);
690
691      error.write2File(fb);
692    }
693
694    //! Write the error log to standard error output
695    void CServer::openErrorStream()
696    {
697      error.write2StdErr();
698    }
699
700    //! Close the error log file if it opens
701    void CServer::closeErrorStream()
702    {
703      if (m_errorStream.is_open()) m_errorStream.close();
704    }
705}
Note: See TracBrowser for help on using the repository browser.