Blame view

src/daqian_test/sharelib/include/sharelib.h 2.38 KB
e30d6793   Zou XiKun   v0.0.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  // **********************************************************************
  // Copyright (C) 2008-2009, 国家多媒体软件工程技术研究中心(武汉大学)
  // 文件名: sharelib.h
  // 作者: chenqg    邮箱: chenqg@multimedia.whu.edu.cn
  // 版本: 1.0
  // 日期: 2010-8-11
  // 描述: 工具类集合
  // 修改历史记录: 
  //   日期,  作者,   变更内容
  // **********************************************************************
  // 20100811 chenqg Add smart_ptr.hpp    
  
  #ifndef _SHARELIB_H_
  #define _SHARELIB_H_
  
  #include "base/base.h"
  #include "configbox/ConfigBox.h"
  #include "locker/Locker.h"
  #include "logger/Logger.h"
  #include "modulemanager/ModuleManager.h"
  #include "network/NetInfo.h"
  #include "profile/ProfileHelper.h"
  #include "scopedobj/scoped_buffer.hpp"
  #include "scopedobj/scoped_ptr.hpp"
  #include "scopedobj/smart_ptr.hpp"
  #include "sharedstruct/SharedStruct.h"
  #include "singleton/Singleton.h"
  #include "string/StrUtil.h"
  #include "string/StringBuilder.hpp"
  #include "utility/Utility.h"
  
  #ifdef _DEBUG
      #ifndef ASSERT
          #define ASSERT(x) {if(!(x)) _asm{int 0x03}}
      #endif
      #ifndef VERIFY
          #define VERIFY(x) {if(!(x)) _asm{int 0x03}}
      #endif
  #else
      #ifndef ASSERT
          #define ASSERT(x)
      #endif
      #ifndef VERIFY
          #define VERIFY(x) x
      #endif
  #endif
  
  // A macro to disallow the copy constructor and operator= functions
  // This should be used in the private: declarations for a class
  #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
      TypeName(const TypeName&);             \
      void operator=(const TypeName&)
  
  // An older, deprecated, politically incorrect name for the above.
  #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName)
  
  // A macro to disallow all the implicit constructors, namely the
  // default constructor, copy constructor and operator= functions.
  //
  // This should be used in the private: declarations for a class
  // that wants to prevent anyone from instantiating it. This is
  // especially useful for classes containing only static methods.
  #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
      TypeName();                                  \
      DISALLOW_COPY_AND_ASSIGN(TypeName)
  
  //
  // double to int 神奇的 magic number (lua 5.1)
  // http://blog.codingnow.com/eo/ooeece/
  //
  union luai_Cast 
  { 
      double l_d; 
      long l_l; 
  };
  
  #define lua_number2int(i,d)  { volatile union luai_Cast u; \
      u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
  
  #endif // _SHARELIB_H_