source: XIOS3/branches/xios-3.0-beta/src/log_type.hpp @ 2530

Last change on this file since 2530 was 2469, checked in by jderouillat, 16 months ago

Fixes for new MAC environment

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#ifndef __XIOS_LOG_TYPE_HPP__
2#define __XIOS_LOG_TYPE_HPP__
3
4#include <string>
5#include <iostream>
6#include <cstdint>
7#include <unordered_map>
8#include <map>
9
10//#include "cxios.hpp"
11#include "string_tools.hpp"
12
13namespace xios
14{
15  class CSetLog ;
16
17  class CLogType
18  {
19    public: 
20
21    CLogType(void) {}
22    CLogType(const std::string& name) ;
23
24    static void bitSet(CLogType& log, int bitPos) { log.type_ |= (uint64_t)1 << bitPos ;}
25    static bool bitAnd(CLogType& log1, CLogType& log2) { return (log1.type_ & log2.type_) == log2.type_ ; }
26   
27    private:
28   
29    uint64_t type_=0 ;
30    int bitPos_=0 ;
31    static int globalBitPos_ ;
32   
33  } ;
34
35  class CSetLog
36  {
37    public:
38
39    CSetLog(void) ;
40    bool isSet(CLogType& log) { return CLogType::bitAnd(logType_, log) ; }
41
42    private:
43   
44    static int registerLog(const std::string& name, int bitPos) ;
45    static std::map<std::string, int>& getRegistredLog(void) ;
46   
47    CLogType logType_ ;
48    friend class CLogType ;
49  } ;
50
51
52
53}
54
55#endif
Note: See TracBrowser for help on using the repository browser.