commore  1.0.6-SNAPSHOT
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
GlobVar.h
1 //
2 // Copyright (c) 2006-2014 Raphael David / CANTOR
3 //
4 
5 #ifndef CMR_GLOBVAR_INCLUDED
6 #define CMR_GLOBVAR_INCLUDED
7 
8 
9 #include "Commore.h"
10 #include "Symbol.h"
11 
12 #ifndef CMR_MODULE_NAME
13 #define CMR_MODULE_NAME "CMR"
14 #endif
15 #ifndef CMR_UNIT_NAME
16 #define CMR_UNIT_NAME "CMR"
17 #endif
18 
19 #define CMR_MODULE_DECLARE(module_name)
20 #define CMR_FILE_DECLARE() static commore::GlobVarLog cmr_log_flag(CMR_MODULE_NAME, __FILE__)
21 
22 namespace commore
23 {
27  class CMREXD GlobVar
28  {
29  public:
33  const Symbol& get_module() const;
37  const Symbol& get_name() const;
41  static size_t get_modules(ListSymbol& modules);
42 
43  public:
44  class Impl;
45 
46  protected:
52  GlobVar(const Symbol& module, const Symbol& name, int type);
53  ~GlobVar();
54  protected:
55  Impl* impl_;
56 
57  private:
58  GlobVar(const GlobVar&);
59  GlobVar& operator=(const GlobVar&);
60 
61  };
62 
66  class CMREXD GlobVarBool : public GlobVar
67  {
68  public:
71  GlobVarBool(const Symbol& module, const Symbol& name);
72  GlobVarBool(const Symbol& module, const Symbol& name, Bool defaultValue);
76  operator Bool() const
77  {
78  return get();
79  }
80  public:
84  Bool get() const;
90  Bool set(Bool value);
91 
92  public:
98  static size_t get_names(const Symbol& module, ListSymbol& names);
104  static Bool get(const Symbol& module, const Symbol& name);
112  static Bool set(const Symbol& module, const Symbol& name, Bool value);
113  private:
114  GlobVarBool(const GlobVarBool&);
115  GlobVarBool& operator=(const GlobVarBool&);
116  };
117 
122  class CMREXD GlobVarLog : public GlobVar
123  {
124  public:
127  GlobVarLog(const Symbol& module, const AChar* source_file_name);
128  GlobVarLog(const Symbol& module, const AChar* source_file_name, Int defaultValue);
132  operator Int() const
133  {
134  return get();
135  }
136  public:
140  Int get() const;
146  Int set(Int value);
150  GlobVarLog& operator ++(int);
154  GlobVarLog& operator --(int);
155 
161  static size_t get_names(const Symbol& module, ListSymbol& names);
167  static Int get(const Symbol& module, const Symbol& name);
175  static Int set(const Symbol& module, const Symbol& name, Int value);
180  static Int get_default(const Symbol& module);
184  static Int get_default();
191  static Int set_default(const Symbol& module, Int value);
197  static Int set_default(Int value);
198  private:
199  GlobVarLog(const GlobVarLog&);
200  GlobVarLog& operator=(const GlobVarLog&);
201  };
202 
206  class CMREXD GlobVarInt : public GlobVar
207  {
208  public:
213  GlobVarInt(const Symbol& module, const Symbol& name);
219  GlobVarInt(const Symbol& module, const Symbol& name, Int default_value);
223  operator Int() const
224  {
225  return get();
226  }
227 
228  public:
232  Int get() const;
238  Int set(Int value);
242  GlobVarInt& operator ++(int);
246  GlobVarInt& operator --(int);
253  static size_t get_names(const Symbol& module, ListSymbol& names);
259  static Int get(const Symbol& module, const Symbol& name);
267  static Int set(const Symbol& module, const Symbol& name, Int value);
268  private:
269  GlobVarInt(const GlobVarInt&);
270  GlobVarInt& operator=(const GlobVarInt&);
271  };
272 }
273 
274 #endif
Definition: GlobVar.h:66
Definition: List.h:23
Definition: Symbol.h:18
Definition: GlobVar.h:122
Definition: GlobVar.h:206
Definition: GlobVar.h:27