SourceForge.jp

dkutilUserConfig.h

説明を見る。
00001 
00002 #ifndef _dkutil_user_config
00003 #define _dkutil_user_config
00004 
00005 
00006 
00007 #ifdef USE_DKINGYO_INCLUDE_SETTING_LIKE_BOOST
00008 #   include <dkutil/dkutilCriticalSection.h>
00009 #else
00010 #   if DKUTIL_COMPILE_OPTION_MSVC
00011 #       include "../dkutilCriticalSection.h"
00012 #   else
00013 #       include "dkutilCriticalSection.h"
00014 #   endif
00015 #endif
00016 
00017 
00018 
00019 namespace dkutil{
00020 
00021 //**********************************************************
00022 //ライブラリのリンク設定
00023 //**********************************************************
00024 
00026 #define DKUTIL_MYMT_PATH "mymt"
00027 
00029 #define DKUTIL_ZLIB_PATH "zlib_dk"
00030 
00031 #define DKUTIL_ZLIB_PATH_MT "zlib_dkMT"
00032 
00033 #define DKUTIL_LIBPNG_PATH "libpng_dk"
00034 
00035 #define DKUTIL_LIBPNG_PATH_MT "libpng_dkMT"
00036 
00038 #define DKUTIL_OGG_STATIC_PATH "ogg_static"
00039 
00040 #define DKUTIL_VORBIS_STATIC_PATH "vorbis_static"
00041 
00042 #define DKUTIL_VORBISFILE_STATIC_PATH "vorbisfile_static"
00043 
00044 #define DKUTIL_VORBISENC_STATIC_PATH "vorbisenc_static"
00045 
00047 #ifdef _DEBUG
00048 #   define DKUTIL_YANESDK3RD_PATH "yaneSDK_d"
00049 #else//release build
00050 #   define DKUTIL_YANESDK3RD_PATH "yaneSDK"
00051 #endif
00052 
00053 
00054 //**********************************************************
00055     //Config系のものを定義してください。(デフォルトではこのままでOKです。
00056 //**********************************************************
00057 
00059 struct DKConfigUtility{
00060 protected:
00061     //変数は申し訳ありませんが、このクラス内に宣言しないでください。
00062 public:
00063     DKConfigUtility(){}
00064     virtual ~DKConfigUtility(){}
00065 
00066     inline void LockThread(){
00067         private_::GetCriticalSection().Enter();
00068     }
00069     inline void UnlockThread(){
00070         private_::GetCriticalSection().Leave();
00071     }
00072     //inline void LockThreadSyndrome(){}
00073     //inline void UnlockThreadSyndrome(){}
00074 };
00075 
00076 //**********************************************************
00077 //マルチスレッドの設定
00078 //**********************************************************
00079 
00080 
00081 //マルチスレッドなら
00082 #ifdef _MT //マルチスレッドでビルドする
00083 
00084 #   define DKUTIL_LOCKTHREAD(u) try{ u.LockThread()
00085 #   define DKUTIL_UNLOCKTHREAD(u) }catch(...){u.UnlockThread();throw;}u.UnlockThread()
00086 #   define DKUTIL_MULTITHREAD_SYNDROME_LOCK(u)
00087 #   define DKUTIL_MULTITHREAD_SYNDROME_UNLOCK(u)
00088 
00089 #   ifdef USE_DKINGYO_MULTITHREAD_CHECKER //マルチスレッドチェッカーを使う
00090 
00091 //かなり安全なマルチスレッド処理を行うためにロックしなくてもいいかな?
00092 //って場所にもロックする。例えば、とあるオブジェクト(クラス)をグローバルにして
00093 //スレッド間でそれにアクセスできる場合などは以下のマクロを使えるようにしなければならない。
00094 //なのでdkutilConfig.hでUSE_DKINGYO_MULTITHREAD_CHECKERを有効にする必要がある。
00095 
00096 #       undef   DKUTIL_MULTITHREAD_SYNDROME_LOCK
00097 #       undef   DKUTIL_MULTITHREAD_SYNDROME_UNLOCK
00098 #       define DKUTIL_MULTITHREAD_SYNDROME_LOCK(u)  DKUTIL_LOCKTHREAD(u)
00099 #       define DKUTIL_MULTITHREAD_SYNDROME_UNLOCK(u) DKUTIL_UNLOCKTHREAD(u)
00100 #   endif
00101 
00102 #else // シングルスレッドなら
00103 
00104 #   define DKUTIL_LOCKTHREAD(u) ((void)0)
00105 #   define DKUTIL_UNLOCKTHREAD(u) ((void)0)
00106 #   define DKUTIL_MULTITHREAD_SYNDROME_LOCK(u) ((void)0)
00107 #   define DKUTIL_MULTITHREAD_SYNDROME_UNLOCK(u) ((void)0)
00108 
00109 #endif
00110 
00111 class scoped_criticalsection{
00112     DKConfigUtility mUtil;
00113     void lock(){
00114         //try{
00115             mUtil.LockThread();
00116         //}catch(...){//待てよ・・例外が返ってきたら別にLockされるわけではないな・・・
00117         //}
00118     }
00119     void unlock(){mUtil.UnlockThread();}
00120 public:
00121     
00122     scoped_criticalsection(){
00123         //lock();仕様変更・・・例外が起こるかもしれん!
00124         lock();//でもやっぱりこのままで行こう!(オイ・・・
00125     }
00126     
00127     ~scoped_criticalsection(){unlock();}
00128 };
00129 
00130 typedef scoped_criticalsection synchronized;
00131 
00132 
00133 
00134 
00135 }//end of dkutil namespace
00136 
00137 
00138 
00139 //**********************************************************
00140 //ライブラリのリンクを反映
00141 //**********************************************************
00142 #ifdef _MSC_VER
00143 #pragma comment(lib, DKUTIL_MYMT_PATH )
00144 #endif
00145 
00146 
00147 
00148 #endif //end of include once

dkutil 1.02リリース前 d金魚専用マニュアルバージョンに対してSun Dec 28 21:23:08 2003に生成されました。 doxygen 1.3.5