sharelib.h 2.38 KB
// **********************************************************************
// 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_