OSDN Git Service

src/commonに移動したため削除。
authorderui <derutakayu@user.sourceforge.jp>
Thu, 26 Nov 2009 14:04:12 +0000 (23:04 +0900)
committerderui <derutakayu@user.sourceforge.jp>
Thu, 26 Nov 2009 14:04:12 +0000 (23:04 +0900)
common/counter.h [deleted file]
common/factory.h [deleted file]
common/file.cpp [deleted file]
common/file.h [deleted file]
common/function_callback.h [deleted file]
common/proxy_ptr.h [deleted file]
common/ref_delete.h [deleted file]
common/singleton.h [deleted file]
common/smart_ptr.h [deleted file]

diff --git a/common/counter.h b/common/counter.h
deleted file mode 100755 (executable)
index 5367a43..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-#ifndef ___HGL___counter___
-#define ___HGL___counter___
-
-/*
- CCounter
- 基本カウンタークラス。
- 基本的なcounterであり、使用方法は
- CCounter hoge(1,0,100);
- とすると、初期値が0、最大値が100、一回のインクリメントにつき
- 1ずつ増加する、というカウンターになる。
- この時、カウントが最大値を超えたら、初期値に戻る
- CCounter hoge(2,0,100,true)
- とすると、超えた分の値を持ち越す
-*/
-class CCounter {
-public:
-
-       CCounter(int nMargin,int nInit,int nMax,int nMin, bool b = false) {
-               m_nMax = nMax;
-               m_nInit = nInit;
-               m_nMargin = nMargin;
-               m_nNowCount = nInit;
-               m_nMin = nMin;
-               m_bCarry = b;
-       }
-
-       CCounter() {
-               m_nMax = 0;
-               m_nInit = 0;
-               m_nMargin = 0;
-               m_nNowCount = 0;
-               m_nMin = 0;
-               m_bCarry = false;
-       }
-
-       //オペレーターオーバーロード
-       //インクリメント、デクリメント、-=、+=、==、<><=>=
-       //などを全て判定できるようにする。
-       CCounter& operator++() {inc();return *this;}
-       CCounter& operator++(int n) {inc();return *this;}
-       CCounter& operator--() {dec();return *this;}
-       CCounter& operator--(int n) {dec();return *this;}
-
-       CCounter& operator+=(int n) {inc(n);return *this;}
-       CCounter& operator-=(int n) {dec(n);return *this;}
-
-       bool operator!=(int n) {return get() != n?true:false;}
-       bool operator==(int n) {return get() == n?true:false;}
-       bool operator>=(int n) {return get() >= n?true:false;}
-       bool operator<=(int n) {return get() <= n?true:false;}
-       bool operator>(int n) {return get() > n?true:false;}
-       bool operator<(int n) {return get() < n?true:false;}
-       bool operator==(const CCounter& n) {return get() == n.get()?true:false;}
-       bool operator>=(const CCounter& n) {return get() >= n.get()?true:false;}
-       bool operator<=(const CCounter& n) {return get() <= n.get()?true:false;}
-       bool operator>(const CCounter& n) {return get() > n.get()?true:false;}
-       bool operator<(const CCounter& n) {return get() < n.get()?true:false;}
-
-       /**
-        * 現在の値を取得する
-        * @access public
-        * @return int
-        */
-       int get() const {return m_nNowCount;}
-
-       /**
-        * 状態を初期化する。初期化される値は、初期値として設定した値である。
-        * @access public
-        * @return void
-        */
-       void reset() {m_nNowCount = m_nInit;}
-
-       /**
-        * マージンを設定する
-        * @param int nMargin マージン
-        * @access public
-        * @return void
-        */
-       void setMargin(int nMargin) {m_nMargin = nMargin;}
-       
-       /**
-        * マージンを取得する
-        * @access public
-        * @return int
-        */
-       int getMargin() const {return m_nMargin;}
-
-       /**
-        * 初期値を設定する
-        * @param int nInit 初期値
-        * @access public
-        * @return void
-        */
-       void setInit(int nInit) {m_nInit = nInit;}
-       
-       /**
-        * 初期値を取得する
-        * @access public
-        * @return int
-        */
-       int getInit() const {return m_nInit;}
-
-       /**
-        * 最大値を設定する
-        * @param int nMax 最大値
-        * @access public
-        * @return void
-        */
-       void setMax(int nMax) {m_nMax = nMax;}
-       
-       /**
-        * 最大値を取得する
-        * @access public
-        * @return int
-        */
-       int getMax() const {return m_nMax;}
-
-       int getMin() const {return m_nMin;}
-       void setMin(int min) {m_nMin = min;}
-
-private:
-
-       /**
-        * @brief カウンタのインクリメントを行う。このカウンタでは、
-        * 単純なインクリメントによる、内部マージンの加算を行う。
-        */
-       void inc() {
-               //内部マージンの加算
-               m_nNowCount += m_nMargin;
-
-               if (!m_bCarry) {
-                       //加算するマージンによって、どちらと判定するかを決定する。
-                       if (m_nMargin > 0) {
-                               if (m_nNowCount > m_nMax) {
-                                       m_nNowCount = m_nMax;
-                               }
-                       } else {
-                               if (m_nNowCount < m_nMin) {
-                                       m_nNowCount = m_nMin;
-                               }
-                       }
-               } else {
-                       //キャリーオーバーするのは、あくまで最大値のみ。
-                       if (m_nNowCount > m_nMax) {
-                               //キャリーオーバーは、最大値と最小値それぞれの絶対値の差分を引く。
-                               m_nNowCount -= (abs(m_nMax) - abs(m_nMin));
-                       } else if (m_nNowCount < m_nMin) {
-                               m_nNowCount += (abs(m_nMax) - abs(m_nMin));
-                       }
-               }
-       }
-
-       /**
-        * カウンタのインクリメントを行う
-        * @param int nInc 指定された数だけインクリメントする。
-        * @access protected
-        * @return void
-        */
-       void inc(int nInc) {
-               
-               m_nNowCount += nInc;
-
-               if (!m_bCarry) {
-                       if (nInc > 0) {
-                               if (m_nNowCount > m_nMax) {
-                                       m_nNowCount = m_nMax;
-                               }
-                       } else {
-                               if (m_nNowCount < m_nMin) {
-                                       m_nNowCount = m_nMin;
-                               }
-                       }
-               } else {
-                       //キャリーオーバーするのは、あくまで最大値のみ。
-                       if (m_nNowCount > m_nMax) {
-                               //キャリーオーバーは、最大値と最小値それぞれの絶対値の差分を引く。
-                               m_nNowCount -= (abs(m_nMax) - abs(m_nMin));
-                       } else if (m_nNowCount < m_nMin) {
-                               m_nNowCount += (abs(m_nMax) - abs(m_nMin));
-                       }
-               }
-       }
-
-       /**
-        * @brief 単純なインクリメントによる、内部マージンの減算。
-        */
-       void dec() {
-               m_nNowCount -= m_nMargin;
-
-               if (!m_bCarry) {
-                       //減算するマージンによって、どちらと判定するかを決定する。
-                       if (m_nMargin < 0) {
-                               if (m_nNowCount > m_nMax) {
-                                       m_nNowCount = m_nMax;
-                               }
-                       } else {
-                               if (m_nNowCount < m_nMin) {
-                                       m_nNowCount = m_nMin;
-                               }
-                       }
-               } else {
-                       //キャリーオーバーするのは、あくまで最大値のみ。
-                       if (m_nNowCount > m_nMax) {
-                               //キャリーオーバーは、最大値と最小値それぞれの絶対値の差分を引く。
-                               m_nNowCount -= (abs(m_nMax) - abs(m_nMin));
-                       } else if (m_nNowCount < m_nMin) {
-                               m_nNowCount += (abs(m_nMax) - abs(m_nMin));
-                       }
-               }
-       }
-
-       /**
-        * カウンタのデクリメントを行う
-        * @param int nDec デフォルトは-1であり、-1である場合は設定値が使われる
-        * @access protected
-        * @return void
-        */
-       void dec(int nDec) {
-               m_nNowCount -= nDec;
-
-               if (!m_bCarry) {
-                       if (nDec < 0) {
-                               if (m_nNowCount > m_nMax) {
-                                       m_nNowCount = m_nMax;
-                               }
-                       } else {
-                               if (m_nNowCount < m_nMin) {
-                                       m_nNowCount = m_nMin;
-                               }
-                       }
-               } else {
-                       //キャリーオーバーするのは、あくまで最大値のみ。
-                       if (m_nNowCount > m_nMax) {
-                               //キャリーオーバーは、最大値と最小値それぞれの絶対値の差分を引く。
-                               m_nNowCount -= (abs(m_nMax) - abs(m_nMin));
-                       } else if (m_nNowCount < m_nMin) {
-                               m_nNowCount += (abs(m_nMax) - abs(m_nMin));
-                       }
-               }
-       }
-
-private:
-
-       int m_nNowCount;        //現在カウント
-       int m_nInit;            //初期値
-       int m_nMargin;          //一回の増減値
-       int m_nMax;                     //最大値
-       int m_nMin;                     //最低値
-       bool m_bCarry;          //持ち越しを行うかどうか
-};
-
-/**
- CFractionalCounter
- 分数関数を用いたカウンター。
- 具体的な使用方法は、次のような用途に。
-
- //0から22までを、三回のインクリメントで。
- //最高値に達したら、0にもどらない
- CFractionalCounter counter(0,22,3);
- counter++;
-
- //0から22まで、三回のインクリメントで。
- //最高値に達した場合、0に戻ってもう一度行う。
- CFractionalCounter counter(0,22,3,true);
-
- //最大値よりも最小値が小さい場合でも、意味は同じ
- CFractionalCounter counter(23,0,3);
- counter++;                    
-*/
-class CFractionalCounter {
-public:
-
-       CFractionalCounter(int nInit,int nThreshold,int nCount,bool bLoop = false) {
-               set(nInit,nThreshold,nCount,bLoop);
-       }
-       CFractionalCounter() {
-               set(0,0,0,false);
-       }
-       
-       //基本的にインクリメントのみ。
-       //比較などしようがないかもしれないが、intとの比較くらいは出来るように。
-       CFractionalCounter& operator++() {inc();return *this;}
-       CFractionalCounter& operator++(int n) {inc();return *this;}
-       
-       //他のカウンターと使用方法が違うので、intとの比較だけで十分だろう。
-       bool operator==(int n) {return (m_dwNowCount >> 16) == n?true:false;}
-       bool operator>=(int n) {return (m_dwNowCount >> 16) >= n?true:false;}
-       bool operator<=(int n) {return (m_dwNowCount >> 16) <= n?true:false;}
-       bool operator>(int n) {return (m_dwNowCount >> 16) > n?true:false;}
-       bool operator<(int n) {return (m_dwNowCount >> 16) < n?true:false;}
-
-       /**
-        * 現在の値を取得する
-        * @access public
-        * @return int
-        */
-       int get() const {return (m_dwNowCount >> 16);}
-
-       /**
-        * 初期状態に戻す
-        * @access public
-        * @return void
-        */
-       void reset() {
-               m_dwNowCount = m_nInit << 16;
-               m_nNowNum = 0;
-       }
-
-       /**
-        * 変数の設定、コピーで使用する。
-        * @param int nInit 初期値
-        * @param int nMax 最大値
-        * @param int nCount 初期値から最大値までの回数
-        * @param bool bLoop ループするかどうか
-        * @access public
-        * @return void
-        */
-       void set(int nInit,int nThreshold,int nCount,bool bLoop = false) {
-               m_nInit = nInit;
-               m_nThreshold = nThreshold;
-               m_dwNowCount = nInit << 16;
-               m_nNum = nCount;
-               m_bLoop = bLoop;
-               m_nNowNum = 0;
-               calc();
-       }
-
-private:
-
-       /**
-        * 計算を行う
-        * @access protected
-        * @return void
-        */
-       void calc() {
-               //計算を行う。ここで行う計算とは、与えられた値を元に、
-               //一回ずつの増分、減分を取得することである。
-               unsigned long tmp = abs(m_nThreshold - m_nInit) << 16;
-               (m_nThreshold - m_nInit) <= 0?m_bReduce = true:m_bReduce = false;
-
-               //16ビットまでしか計算できない。が、十分だろ。
-               m_dwMargin = tmp / m_nNum;
-       }
-
-       /**
-        * 一回分の増減を行う。
-        * @access protected
-        * @return void
-        */
-       void inc() {
-               //一回分の加算・減算を行う。
-               //誤差が出たりするのは仕方ないと思う。
-               
-               if (m_nNowNum >= m_nNum) {
-                       if (m_bLoop) {
-                               m_dwNowCount = m_nInit << 16;
-                               m_nNowNum = 0;
-                       } else {
-                               m_dwNowCount = m_nThreshold << 16;
-                               m_nNowNum = m_nNum;
-                       }
-               } else {
-                       m_nNowNum++;
-                       if (m_bReduce) {
-                               m_dwNowCount -= m_dwMargin;
-                       } else {
-                               m_dwNowCount += m_dwMargin;
-                       }
-               }
-       }       
-
-private:
-
-       int m_nInit;
-       int m_nThreshold;
-       unsigned long m_dwNowCount;
-       int m_nNum;
-       int m_nNowNum;
-       bool m_bLoop;
-
-       bool m_bReduce;         //マイナスかどうか
-
-       unsigned long m_dwMargin;               //一回のマージン
-
-};
-#endif
\ No newline at end of file
diff --git a/common/factory.h b/common/factory.h
deleted file mode 100755 (executable)
index 73e12cf..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef ___HGL___FACTORY___
-#define ___HGL___FACTORY___
-
-#include "smart_ptr.h"
-
-/**
- * @brief パラメータとして渡されたクラスをnewして返すだけのfactory
- */
-template<class T>
-class factory {
-public:
-       virtual ~factory(){}
-       virtual T* createInstance() {
-               return new T;
-       }
-};
-
-/**
- * @brief Tの派生クラスSをfactoryする。
- * このようにfactory<T>から派生してあるのは、このfactoryを
- * factory2<T, S>からfactory<T>へとアップキャストするためである。
- * このようにすることで、クラスのfactory置換を実装できる。
- */
-template<class T, class S>
-class factory2 : public factory<T> {
-public:
-       virtual T* createInstance() {
-               return new S;
-       }
-};
-
-/**
- * @brief クラス置換を擬似的に実現するためのテンプレート
- * このクラスでは、SはTの派生クラスとして、Sを切り替えてnewすることが
- * 可能であるような動作をする。
- */
-template<class T, class S>
-class factory_permutation {
-public:
-
-       factory_permutation() : m_pFactory(new factory2(T, S))
-       {}
-
-       /**
-        * @brief 基底の型へのポインタを返す。
-        */
-       T* createInstalce() {return m_pFactory->createInstance();}
-
-       /**
-        * @brief 基本型のfactoryを返すが、これは実際には派生型を返すものである。
-        */
-       smart_ptr<factory<T> > getFactory() const {
-               return m_pFactory;
-       }
-
-       /**
-        * @brief factoryの置換を行う。
-        * 置換を行うことが出来るのは、UがTの派生型であるときだけである。
-        */
-       template<class U>
-       void setFactory(U* p) {m_pFactory.add(new factory2(T, U));}
-
-private:
-
-       smart_ptr<factory<T> > m_pFactory;
-};
-
-#endif
\ No newline at end of file
diff --git a/common/file.cpp b/common/file.cpp
deleted file mode 100755 (executable)
index 13a6555..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-#include "stdafx.h"
-#include "file.h"
-
-CFile::CFile()
-{
-       m_lpFile = NULL;
-       m_bOpenFlg = false;
-}
-
-CFile::CFile(const std::string& fname,FOPEN_MODE mode)
-{
-       m_lpFile = NULL;
-       m_bOpenFlg = false;
-       open(fname,mode);
-}
-
-CFile::~CFile()
-{
-       close();
-}
-
-int CFile::open(const std::string& fname,FOPEN_MODE mode)
-{
-       if (m_lpFile != NULL) {
-               close();
-       }
-
-       int result = 0;
-       switch (mode) {
-               case READ:
-                       result = innerOpen(fname,"r");
-                       break;
-               case WRITE:
-                       result = innerOpen(fname,"w");
-                       break;
-               case ADD:
-                       result = innerOpen(fname,"a");
-                       break;
-               case READ_B:
-                       result = innerOpen(fname,"rb");
-                       break;
-               case WRITE_B:
-                       result = innerOpen(fname,"wb");
-                       break;
-               case ADD_B:
-                       result = innerOpen(fname,"ab");
-                       break;
-               case RW:
-                       result = innerOpen(fname,"r+");
-                       break;
-               case RW_B:
-                       result = innerOpen(fname,"rb+");
-                       break;
-       }
-
-       return result;
-}
-
-int CFile::innerOpen(const std::string& fname,const std::string& mode)
-{
-       m_lpFile = fopen(fname.c_str(),mode.c_str());
-       if (m_lpFile == NULL) {
-               return 2;
-       }
-
-       m_bOpenFlg = true;
-       
-       //ファイルサイズの取得
-       if (mode.compare("r") == 0 || mode.compare("rb") == 0) {
-               end();
-               m_lFileSize = ftell(m_lpFile);
-               begin();
-       }
-
-       return 0;
-}
-
-int CFile::close()
-{
-       if (m_lpFile != NULL) {
-               fclose(m_lpFile);
-       }
-       m_lpFile = NULL;
-       return 0;
-}
-
-int CFile::begin()
-{
-       if (!isOpen()) {
-               return 1;
-       }
-
-       return fseek(m_lpFile,0,0);
-}
-
-int CFile::end()
-{
-       if (!isOpen()) {
-               return 1;
-       }
-       
-       return fseek(m_lpFile,0,2);
-}
-
-int CFile::read(unsigned char* buf,unsigned long readsize)
-{
-       if (!isOpen()) {
-               return -1;
-       }
-
-       if (readsize == 0) {
-               return -2;
-       }
-
-       long result = fread(buf,1,readsize,m_lpFile);
-       if (result < readsize) {
-               return readsize - result;
-       }
-       return result;
-}
-
-int CFile::read(std::vector<unsigned char>& buf,unsigned long readsize)
-{
-       if (!isOpen()) {
-               return 1;
-       }
-
-       if (readsize == 0) {
-               return 2;
-       }
-
-       if (buf.size() < readsize) {
-               buf.resize(readsize);
-       }
-
-       long result = fread(&(buf[0]),1,readsize,m_lpFile);
-       if (result < readsize) {
-               buf.resize(result);
-               return result;
-       }
-       return result;
-}
-
-int CFile::readLine(std::string& buf)
-{
-       //一行を読み出す
-       if (!isOpen()) {
-               return 1;
-       }
-
-       if (!buf.empty()) {
-               buf.assign("");
-       }
-
-       //改行まで読み出す
-       while (!isEOF()) {
-               unsigned char c;
-               if (read(&c,1) != 1) {
-                       return 2;
-               }
-
-               //めんどくさいので、Windows標準の改行だけチェック
-               if (c == '\r') {
-                       unsigned char tmp;
-                       if (read(&tmp,1) != 1) {
-                               return 3;
-                       }
-                       if (tmp == '\n') {
-                               //これが出たら終了
-                               break;
-                       } else {
-                               //おかしいので削除してやる
-                               break;
-                       }
-               } else if (c == '\n') {
-                       return 0;
-               } else {
-                       buf += c;
-               }
-       }
-
-       return 0;
-}
-
-int CFile::write(const std::string& fname)
-{
-       if (!isOpen()) {
-               return 1;
-       }
-
-       int result = fwrite((void*)fname.c_str(),1,fname.size(),m_lpFile);
-
-       if (result < fname.size()) {
-               return 2;
-       }
-
-       return 0;
-}
-
-int CFile::write(void *lpmem,unsigned long size)
-{
-       if (!isOpen()) {
-               return 1;
-       }
-
-       long result = fwrite(lpmem,1,size,m_lpFile);
-
-       if (result < size) {
-               
-               return 2;
-       }
-
-       return 0;
-}
-
-int CFile::load(const std::string& fname,unsigned char* buf,unsigned long readsize,
-                               FOPEN_MODE mode)
-{
-       if (open(fname,mode)) {
-               return 1;
-       }
-
-       if (read(buf,readsize)) {
-               return 2;
-       }
-
-       return 0;
-}
-
-int CFile::seek(unsigned long seeksize)
-{
-       if (!isOpen()) {
-               return 1;
-       }
-
-       int res = fseek(m_lpFile,seeksize,1);
-       if (res != 0) {
-               return 2;
-       }
-
-       return 0;
-}
-
-bool CFile::isEOF()
-{
-       if (!isOpen()) {
-               return true;
-       }
-
-       if (feof(m_lpFile)) {
-               return true;
-       }
-       return false;
-}
diff --git a/common/file.h b/common/file.h
deleted file mode 100755 (executable)
index d91fd9c..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#pragma once
-
-/**
- CFile
- HGLにおける、基本的なファイルクラス。
- WindowsAPIは使用せず、C標準関数のみで構成する。
- あくまで標準的な機能のみをラッパーしただけである。
-*/
-enum FOPEN_MODE {
-       READ,
-       WRITE,
-       ADD,
-       READ_B,
-       WRITE_B,
-       ADD_B,
-       RW,                     //r+
-       RW_B,           //rb+
-};
-
-class CFile {
-public:
-
-       CFile();
-       CFile(const std::string& fname,FOPEN_MODE mode = READ);
-       ~CFile();
-
-       /**
-        * 指定されたファイルを開く
-        * @param const std::string& fname 開くファイル名
-        * @param FOPEN_MODE mode ファイルオープンモード
-        * @access public
-        * @return int 失敗時は非ゼロ
-        */
-       virtual int open(const std::string& fname,FOPEN_MODE mode = READ);
-
-       /**
-        * 指定されたサイズ、開かれたファイルから読み出す。
-        * これは、すでにopenしていないと意味がない
-        * @param unsigned char* buf データを入れるバッファ
-        * @param unsigned long readsize 読み出すサイズ(バイト)
-        * @access public
-        * @return long 失敗時は非0
-        */
-       virtual int read(unsigned char* buf,unsigned long readsize);
-
-       /**
-        * 指定されたサイズ、開かれたファイルから読み出す。
-        * これは、すでにopenしていないと意味がない
-        * @param unsigned char* buf データを入れるバッファ
-        * @param unsigned long readsize 読み出すサイズ(バイト)
-        * @access public
-        * @return long 失敗時は非0
-        */
-       virtual int read(std::vector<unsigned char>& buf,unsigned long readsize);
-
-       /**
-        * 一行を読み出す
-        * @param std::string& buf バッファ
-        * @access public
-        * @return long
-        */
-       virtual int readLine(std::string& buf);
-
-       /**
-        * 指定したファイルを開いて、読み出す。
-        * 以前開かれていたファイルは閉じられる。
-        * @param const std::string& fname 開くファイル名
-        * @param unsigned char* buf データを入れるバッファ
-        * @param unsigned long readsize 読み出すバイトサイズ
-        * @param FOPEN_MODE mode
-        * @access public
-        * @return long 読み出したサイズ、失敗時は非0
-        */
-       virtual int load(const std::string& fname,unsigned char* buf,
-                               unsigned long readsize,FOPEN_MODE mode = READ);
-
-       /**
-        * 指定されたサイズを書き出す
-        * @param void* lpmem
-        * @param unsigned long size
-        * @access public
-        * @return ing
-        */
-       virtual int write(void *lpmem,unsigned long size);
-
-       /**
-        * 文字列を書き出す
-        * @param const std::string& fname
-        * @access public
-        * @return int
-        */
-       virtual int write(const std::string& fname);
-
-       /**
-        * 現在開かれているファイルを閉じる。
-        * 基本的にこれを実行する必要はない
-        * @access public
-        * @return int
-        */
-       virtual int close();
-
-       /**
-        * ファイルシークを行う。
-        * これは、原則として現在のファイルポインタの位置からである
-        * @param unsigned long seeksize シークするサイズ
-        * @access public
-        * @return int
-        */
-       virtual int seek(unsigned long seeksize);
-
-       /**
-        * ファイルポインタを先頭に戻す
-        * @access public
-        * @return int
-        */
-       virtual int begin();
-
-       /**
-        * ファイルポインタを末尾にやる
-        * @access public
-        * @return int
-        */
-       virtual int end();
-
-       /**
-        * ファイルの末尾かどうか
-        * @access public
-        * @return bool
-        */
-       bool isEOF();
-
-       /**
-        * ファイルが開かれているかどうか
-        * @access public
-        * @return bool
-        */
-       bool isOpen() const {return m_bOpenFlg;}
-       
-       //ファイルサイズを取得する。これはopen時点で取得される、
-       long size() const {return m_lFileSize;}
-
-private:
-
-       /**
-        innerOpen
-        内部使用関数
-        @param const std::stirng& fname ファイル名
-        @param const std::string& mode モード名
-        @access public
-        @return int
-       */
-       int innerOpen(const std::string& fname,const std::string& mode);
-
-       FILE* m_lpFile;
-       std::string m_szFileName;
-       long m_lFileSize;
-
-       bool m_bOpenFlg;
-
-};
diff --git a/common/function_callback.h b/common/function_callback.h
deleted file mode 100755 (executable)
index bc968a4..0000000
+++ /dev/null
@@ -1,755 +0,0 @@
-#ifndef ___HGL___FUNCTION_CALLBACK___
-#define ___HGL___FUNCTION_CALLBACK___
-
-/**
- function_callback
- 関数コールバック基底クラス
- 全てのコールバック関数クラスは、このクラスから派生する。
- smart_ptrの使用が前提である。
-*/
-class function_callback {
-public:
-
-    virtual ~function_callback() {}
-
-    //これを必ずオーバーロードすること。
-    virtual void run() = 0;
-};
-
-/*
- 準備するコールバック関数クラスの種類は、
- 返り値あり、返り値無し --- 2種
- メンバ関数、非メンバ関数 --- 2種
- 引数0〜5個               --- 6種
- の24個定義する
-*/
-
-/**
- function_callback_v
- 返り値無しのコールバック関数クラス。
- staticなcreate関数によって、それぞれを作成する。
- また、これから作成されるクラスも、全てfunction_callback派生クラスである。
-*/
-class function_callback_v : public function_callback {
-public:
-
-    virtual ~function_callback_v() {}
-
-    virtual void run() {}
-
-    //引数無し、返り値無しの静的関数のみのコールバック関数クラス作成
-    static function_callback_v* create(void (*f)(void));
-
-    template<class T>
-    static function_callback_v* create(void (T::*f)()) {
-        return new function_callback_vg0<T>(f);
-    }
-
-    //引数あり、静的関数のみ
-    template<class Arg1>
-    static function_callback_v*
-    create(void (*f)(Arg1),Arg1 a1) {
-        return new function_callback_v1<Arg1>(f,a1);
-    }
-
-    template<class Arg1,class Arg2>
-    static function_callback_v*
-    create(void (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
-        return new function_callback_v2<Arg1,Arg2>(f,a1,a2);
-    }
-
-    template<class Arg1,class Arg2,class Arg3>
-    static function_callback_v*
-    create(void (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_v3<Arg1,Arg2,Arg3>(f,a1,a2,a3);
-    }
-
-    template<class Arg1,class Arg2,class Arg3,class Arg4>
-    static function_callback_v*
-    create(void (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_v4<Arg1,Arg2,Arg3,Arg4>(f,a1,a2,a3,a4);
-    }
-
-    template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    static function_callback_v* create(void (*f)(Arg1,Arg2,Arg3,Arg4,Arg5),
-    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_v5<Arg1,Arg2,Arg3,Arg4,Arg5>(f,a1,a2,a3,a4a5);
-    }
-
-    //引数無し、メンバ関数
-    template<class obj>
-    static function_callback_v*
-        create(void (obj::*f)(),obj* p) {
-            return new function_callback_vm0<obj>(f,p);
-        }
-
-    template<class obj,class Arg1>
-    static function_callback_v*
-        create(void (obj::*f)(Arg1),obj* p,Arg1 a1) {
-            return new function_callback_vm1<obj,Arg1>(f,p,a1);
-        }
-
-    template<class obj,class Arg1,class Arg2>
-    static function_callback_v*
-    create(void (obj::*f)(Arg1,Arg2),obj* p,Arg1 a1,Arg2 a2) {
-        return new function_callback_vm2<obj,Arg1,Arg2>(f,p,a1,a2);
-    }
-
-    template<class obj,class Arg1,class Arg2,class Arg3>
-    static function_callback_v*
-    create(void (obj::*f)(Arg1,Arg2,Arg3),obj* p,Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_vm3<obj,Arg1,Arg2,Arg3>(f,p,a1,a2,a3);
-    }
-
-    template<class obj,class Arg1,class Arg2,class Arg3,class Arg4>
-    static function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3,Arg4),obj* p,
-    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_vm4<obj,Arg1,Arg2,Arg3,Arg4>(f,p,a1,a2,a3,a4);
-    }
-
-    template<class obj,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    static function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),obj* p,
-    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_vm5<obj,Arg1,Arg2,Arg3,Arg4,Arg5>(f,p,a1,a2,a3,a4,a5);
-    }
-
-};
-
-/**
- function_callback_r
- 返り値ありのコールバック関数クラスの元締め
- getResultで引数を取得する
-*/
-template<class Result>
-class function_callback_r : public function_callback {
-public:
-
-    function_callback_r() : m_Result(NULL) {}
-    virtual ~function_callback_r() {}
-
-    static function_callback_r<Result>* create(Result (*f)()) {
-        return new function_callback_r0<Result>(f);
-    }
-
-    template<class T>
-    static function_callback_r<Result>* create(Result (T::*f)()) {
-        return new function_callback_rg0<Result,T>(f);
-    }
-
-    //非メンバ関数
-    template<class Arg1>
-    static function_callback_r<Result>* 
-    create(Result (*f)(Arg1),Arg1 a1) {
-        return new function_callback_r1<Result,Arg1>(f,a1);
-    }
-
-    template<class Arg1,class Arg2>
-    static function_callback_r<Result>* 
-    create(Result (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
-        return new function_callback_r2<Result,Arg1,Arg2>(f,a1,a2);
-    }
-
-    template<class Arg1,class Arg2,class Arg3>
-    static function_callback_r<Result>* 
-    create(Result (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_r3<Result,Arg1,Arg2,Arg3>(f,a1,a2,a3);
-    }
-    
-    template<class Arg1,class Arg2,class Arg3,class Arg4>
-    static function_callback_r<Result>* 
-    create(Result (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_r4<Result,Arg1,Arg2,Arg3,Arg4>(f,a1,a2,a3,a4);
-    }
-
-    template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    static function_callback_r<Result>* create(Result (*f)(Arg1,Arg2,Arg3,Arg4),
-    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_r5<Result,Arg1,Arg2,Arg3,Arg4,Arg5>(f,a1,a2,a3,a4,a5);
-    }
-
-    //メンバ関数
-    template<class T>
-    static function_callback_r<Result>* 
-    create(Result (T::*f)(),T* p) {
-        return new function_callback_rm0<Result,T>(f,p);
-    }
-
-    template<class T,class Arg1>
-    static function_callback_r<Result>* 
-    create(Result (T::*f)(Arg1),T* p,Arg1 a1) {
-        return new function_callback_rm1<Result,T,Arg1>(f,p,a1);
-    }
-
-    template<class T,class Arg1,class Arg2>
-    static function_callback_r<Result>* 
-    create(Result (T::*f)(Arg1,Arg2),T* p,Arg1 a1,Arg2 a2) {
-        return new function_callback_rm2<Result,T,Arg1,Arg2>(f,p,a1,a2);
-    }
-
-    template<class T,class Arg1,class Arg2,class Arg3>
-    static function_callback_r<Result>* 
-    create(Result (T::*f)(Arg1,Arg2,Arg3),T* p,Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_rm3<Result,T,Arg1,Arg2,Arg3>(f,p,a1,a2,a3);
-    }
-
-    template<class T,class Arg1,class Arg2,class Arg3,class Arg4>
-    static function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3,Arg4),T* p,
-    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_rm4<Result,T,Arg1,Arg2,Arg3,Arg4>(f,p,a1,a2,a3,a4);
-    }
-
-    template<class T,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    static function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),T* p,
-    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_rm5<Result,T,Arg1,Arg2,Arg3,Arg4,Arg5>(f,p,a1,a2,a3,a4,a5);
-    }
-
-    Result getResult() {
-        return m_Result;
-    }
-
-protected:
-
-    Result m_Result;
-
-};
-
-class function_callback_v0 : public function_callback_v {
-public:
-    typedef void (*CallBack)(void);
-
-    function_callback_v0(CallBack c) : m_lpFunc(c) {}
-
-    virtual void run() {
-        m_lpFunc();
-    }
-
-private:
-
-    CallBack m_lpFunc;
-
-};
-
-template<class T>
-class function_callback_vg0 : public function_callback_v {
-public:
-    typedef void (T::*CallBack)();
-
-    function_callback_vg0(CallBack c) : m_lpFunc(c) {}
-
-    virtual void run() {
-        m_lpFunc();
-    }
-
-private:
-
-    CallBack m_lpFunc;
-
-};
-
-template<class Arg1>
-class function_callback_v1 : public function_callback_v {
-public:
-    typedef void (*CallBack)(Arg1);
-
-    function_callback_v1(CallBack c,Arg1 a1) : m_lpFunc(c),m_Arg1(a1) {}
-
-    virtual void run() {
-        m_lpFunc(m_Arg1);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-
-};
-
-template<class Arg1,class Arg2>
-class function_callback_v2 : public function_callback_v {
-public:
-    typedef void (*CallBack)(Arg1,Arg2);
-
-    function_callback_v2(CallBack c,Arg1 a1,Arg2 a2) : 
-        m_lpFunc(c),m_Arg1(a1),m_Arg2(a2) {}
-
-    virtual void run() {
-        m_lpFunc(m_Arg1,m_Arg2);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-
-};
-
-template<class Arg1,class Arg2,class Arg3>
-class function_callback_v3 : public function_callback_v {
-public:
-    typedef void (*CallBack)(Arg1,Arg2,Arg3);
-
-    function_callback_v3(CallBack c,Arg1 a1,Arg2 a2,Arg3 a3) : 
-        m_lpFunc(c),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3) {}
-
-    virtual void run() {
-        m_lpFunc(m_Arg1,m_Arg2,m_Arg3);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-
-};
-
-template<class Arg1,class Arg2,class Arg3,class Arg4>
-class function_callback_v4 : public function_callback_v {
-public:
-    typedef void (*CallBack)(Arg1,Arg2,Arg3,Arg4);
-
-    function_callback_v4(CallBack c,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) : 
-        m_lpFunc(c),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4) {}
-
-    virtual void run() {
-        m_lpFunc(m_Arg1,m_Arg2,m_Arg3,m_Arg4);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-    Arg4 m_Arg4;
-
-};
-
-template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-class function_callback_v5 : public function_callback_v {
-public:
-    typedef void (*CallBack)(Arg1,Arg2,Arg3,Arg4,Arg5);
-
-    function_callback_v5(CallBack c,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) : 
-        m_lpFunc(c),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4),m_Arg5(a5) {}
-
-    virtual void run() {
-        m_lpFunc(m_Arg1,m_Arg2,m_Arg3,m_Arg4,m_Arg5);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-    Arg4 m_Arg4;
-    Arg5 m_Arg5;
-
-};
-
-//------------------------------------------------------------------
-
-template<class obj>
-class function_callback_vm0 : public function_callback_v {
-public:
-    typedef void (obj::*CallBack)();
-
-    function_callback_vm0(CallBack c,obj* p) : m_lpFunc(c),m_lpObj(p) {}
-
-    virtual void run() {
-        (m_lpObj->*m_lpFunc)();
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    obj* m_lpObj;
-
-};
-
-template<class obj,class Arg1>
-class function_callback_vm1 : public function_callback_v {
-public:
-    typedef void (obj::*CallBack)(Arg1);
-
-    function_callback_vm1(CallBack c,obj* p,Arg1 a1) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1) {}
-
-    virtual void run() {
-        (m_lpObj->*m_lpFunc)(m_Arg1);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    obj* m_lpObj;
-    Arg1 m_Arg1;
-
-};
-
-template<class obj,class Arg1,class Arg2>
-class function_callback_vm2 : public function_callback_v {
-public:
-    typedef void (obj::*CallBack)(Arg1,Arg2);
-
-    function_callback_vm2(CallBack c,obj* p,Arg1 a1,Arg2 a2) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2) {}
-
-    virtual void run() {
-        (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    obj* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-
-};
-
-template<class obj,class Arg1,class Arg2,class Arg3>
-class function_callback_vm3 : public function_callback_v {
-public:
-    typedef void (obj::*CallBack)(Arg1,Arg2,Arg3);
-
-    function_callback_vm3(CallBack c,obj* p,Arg1 a1,Arg2 a2,Arg3 a3) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3) {}
-
-    virtual void run() {
-        (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2,m_Arg3);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    obj* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_ARg3;
-
-};
-
-template<class obj,class Arg1,class Arg2,class Arg3,class Arg4>
-class function_callback_vm4 : public function_callback_v {
-public:
-    typedef void (obj::*CallBack)(Arg1,Arg2,Arg3,Arg4);
-
-    function_callback_vm4(CallBack c,obj* p,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4) {}
-
-    virtual void run() {
-        (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2,m_Arg3,m_Arg4);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    obj* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_ARg3;
-    Arg4 m_Arg4;
-
-};
-
-template<class obj,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-class function_callback_vm5 : public function_callback_v {
-public:
-    typedef void (obj::*CallBack)(Arg1,Arg2,Arg3,Arg4,Arg5);
-
-    function_callback_vm5(CallBack c,obj* p,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4),m_Arg5(a5) {}
-
-    virtual void run() {
-        (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2,m_Arg3,m_Arg4,m_Arg5);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    obj* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_ARg3;
-    Arg4 m_Arg4;
-    Arg5 m_Arg5;
-
-};
-
-//-----------------------------------------------------------------------
-
-template<class Result>
-class function_callback_r0 : public function_callback_r<Result> {
-public:
-    typedef Result (*CallBack)();
-
-    function_callback_r0(CallBack c) : m_lpFunc(c) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc();
-    }
-
-private:
-
-    CallBack m_lpFunc;
-
-};
-
-template<class Result,class T>
-class function_callback_rg0 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)();
-
-    function_callback_rg0(CallBack c) : m_lpFunc(c) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc();
-    }
-
-private:
-
-    CallBack m_lpFunc;
-
-};
-
-template<class Result,class Arg1>
-class function_callback_r1 : public function_callback_r<Result> {
-public:
-    typedef Result (*CallBack)(Arg1);
-
-    function_callback_r1(CallBack c,Arg1 a1) : m_lpFunc(c),m_Arg1(a1) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc(m_Arg1);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-
-};
-
-template<class Result,class Arg1,class Arg2>
-class function_callback_r2 : public function_callback_r<Result> {
-public:
-    typedef Result (*CallBack)(Arg1,Arg2);
-
-    function_callback_r2(CallBack c,Arg1 a1,Arg2 a2) : m_lpFunc(c),m_Arg1(a1),m_Arg2(a2) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc(m_Arg1,m_Arg2);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-
-};
-
-template<class Result,class Arg1,class Arg2,class Arg3>
-class function_callback_r3 : public function_callback_r<Result> {
-public:
-    typedef Result (*CallBack)(Arg1,Arg2,Arg3);
-
-    function_callback_r3(CallBack c,Arg1 a1,Arg2 a2,Arg3 a3) : 
-    m_lpFunc(c),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc(m_Arg1,m_Arg2,m_Arg3);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-
-};
-
-template<class Result,class Arg1,class Arg2,class Arg3,class Arg4>
-class function_callback_r4 : public function_callback_r<Result> {
-public:
-    typedef Result (*CallBack)(Arg1,Arg2,Arg3,Arg4);
-
-    function_callback_r4(CallBack c,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) : 
-    m_lpFunc(c),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc(m_Arg1,m_Arg2,m_Arg3,m_Arg4);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-    Arg4 m_Arg4;
-
-};
-
-template<class Result,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-class function_callback_r5 : public function_callback_r<Result> {
-public:
-    typedef Result (*CallBack)(Arg1,Arg2,Arg3,Arg4);
-
-    function_callback_r5(CallBack c,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) : 
-    m_lpFunc(c),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4),m_Arg5(a5) {}
-
-    virtual void run() {
-        m_Result = m_lpFunc(m_Arg1,m_Arg2,m_Arg3,m_Arg4,m_Arg5);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-    Arg4 m_Arg4;
-    Arg5 m_Arg5;
-
-};
-
-template<class Result,class T>
-class function_callback_rm0 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)();
-
-    function_callback_rm0(CallBack c,T* p) : m_lpFunc(c),m_lpObj(p) {}
-
-    virtual void run() {
-        m_Result = (m_lpObj->*m_lpFunc)();
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    T* m_lpObj;
-
-};
-
-template<class Result,class T,class Arg1>
-class function_callback_rm1 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)(Arg1);
-
-    function_callback_rm1(CallBack c,T* p,Arg1 a1) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1) {}
-
-    virtual void run() {
-        m_Result = (m_lpObj->*m_lpFunc)(m_Arg1);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    T* m_lpObj;
-    Arg1 m_Arg1;
-
-};
-
-template<class Result,class T,class Arg1,class Arg2>
-class function_callback_rm2 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)(Arg1,Arg2);
-
-    function_callback_rm2(CallBack c,T* p,Arg1 a1,Arg2 a2) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2) {}
-
-    virtual void run() {
-        m_Result = (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    T* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-
-};
-
-template<class Result,class T,class Arg1,class Arg2,class Arg3>
-class function_callback_rm3 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)(Arg1,Arg2,Arg3);
-
-    function_callback_rm3(CallBack c,T* p,Arg1 a1,Arg2 a2,Arg3 a3) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3) {}
-
-    virtual void run() {
-        m_Result = (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2,m_Arg3);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    T* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-
-};
-
-template<class Result,class T,class Arg1,class Arg2,class Arg3,class Arg4>
-class function_callback_rm4 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)(Arg1,Arg2,Arg3,Arg4);
-
-    function_callback_rm4(CallBack c,T* p,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4) {}
-
-    virtual void run() {
-        m_Result = (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2,m_Arg3,m_Arg4);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    T* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-    Arg4 m_Arg4;
-
-};
-
-template<class Result,class T,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-class function_callback_rm5 : public function_callback_r<Result> {
-public:
-    typedef Result (T::*CallBack)(Arg1,Arg2,Arg3,Arg4,Arg5);
-
-    function_callback_rm5(CallBack c,T* p,Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) : 
-    m_lpFunc(c),m_lpObj(p),m_Arg1(a1),m_Arg2(a2),m_Arg3(a3),m_Arg4(a4),m_Arg5(a5) {}
-
-    virtual void run() {
-        m_Result = (m_lpObj->*m_lpFunc)(m_Arg1,m_Arg2,m_Arg3,m_Arg4,m_Arg5);
-    }
-
-private:
-
-    CallBack m_lpFunc;
-    T* m_lpObj;
-    Arg1 m_Arg1;
-    Arg2 m_Arg2;
-    Arg3 m_Arg3;
-    Arg4 m_Arg4;
-    Arg5 m_Arg5;
-
-};
-
-inline function_callback_v* function_callback_v::create(void (*f)(void)) {
-    return new function_callback_v0(f);
-}
-
-#endif
diff --git a/common/proxy_ptr.h b/common/proxy_ptr.h
deleted file mode 100755 (executable)
index c8467ce..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef ___HGL___PROXY_PTR___
-#define ___HGL___PROXY_PTR___
-
-/**
- * @brief 必要な時にだけ生成するようなポインタ。
- */
-template<class T>
-class proxy_ptr {
-public:
-
-       proxy_ptr() : m_pObj(NULL) {}
-       ~proxy_ptr() {
-               if (m_pObj != NULL) {
-                       delete m_pObj;
-               }
-       }
-
-       //ポインタの代わりをするための機能。
-       T* operator->() {checkInstance();return m_pObj;}
-       T& operator*() { checkInstance();return *m_pObj;}
-       const T* operator->() const {checkInstance();return m_pObj;}
-       const T& operator*() const {checkInstance(); return *m_pObj;}
-
-       operator T*() {checkInstance();return m_pObj;}
-
-private:
-
-       void checkInstance() const {
-               proxy_ptr<T>* p = const_cast<proxy_ptr<T>*>(this);
-               if (p->m_pObj == NULL) {
-                       p->m_pObj = new T;
-               }
-       }
-
-       T* m_pObj;
-
-};
-
-#endif
\ No newline at end of file
diff --git a/common/ref_delete.h b/common/ref_delete.h
deleted file mode 100755 (executable)
index 481e252..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-#ifndef ___HGL___ref_delete___
-#define ___HGL___ref_delete___
-
-/**
- ref_delete
- 参照カウントを保持して、
- 0になったときに、保持してあるオブジェクトを破棄するための
- クラス。
- smart_ptr中で、配列と非配列オブジェクトとを区別するために
- 使用される。
-*/
-class ref_delete_base {
-public:
-
-       virtual ~ref_delete_base() {}
-
-       /**
-        dec_ref
-        参照カウントのデクリメント。
-        これを実行したとき、参照カウントが0になったら、do_deleteを
-        実行する。
-        @access public
-        @return bool true:削除済み false:未削除
-       */
-       bool dec_ref() {
-               if (--m_nRef <= 0) {
-                       if (m_bOwner) {
-                               do_delete();
-                       }
-                       return true;
-               }
-               return false;
-       }
-
-       /**
-        inc_ref
-        参照カウントのインクリメント
-        @access public
-        @return void
-       */
-       void inc_ref() {
-               m_nRef++;
-       }
-
-       /**
-        getRef
-        参照カウントの取得
-        @access public
-        @return int 参照カウント
-       */
-       int getRef() const {return m_nRef;}
-       
-       /**
-        setRef
-        参照カウントの設定
-        @param int i 参照カウント
-        @access public
-        @return void
-       */
-       void setRef(int i) {m_nRef = i;}
-
-       /**
-        setOwner
-        所有権の設定
-        @param bool b 所有権の有無
-        @access public
-        @return void
-       */
-       void setOwner(bool b) {m_bOwner = b;}
-       
-       /**
-        getOwner
-        所有権の取得
-        @access public
-        @return bool
-       */
-       bool getOwner() {return m_bOwner;}
-
-       /**
-        getObjSize
-        オブジェクトサイズの取得
-        @access public
-        @return int オブジェクトサイズ
-       */
-       int getObjSize() const {return m_nObjSize;}
-       
-       /**
-        setObjSize
-        オブジェクトサイズの設定
-        @param int i オブジェクトサイズ
-        @access public
-        @return void
-       */
-       void setObjSize(int i) {m_nObjSize = i;}
-
-       /**
-        getMaxNum
-        最大インデックスの取得
-        @access public
-        @return int 最大インデックス
-       */
-       int getMaxNum() const {return m_nMaxNum;}
-       
-       /**
-        setMaxNum
-        最大インデックスの設定
-        @param int i 最大インデックス
-        @access public
-        @return void
-       */
-       void setMaxNum(int i) {m_nMaxNum = i;}
-
-       /**
-        do_delete
-        参照カウントがゼロになった際に実行される。
-        主に、deleteとdelete[]の違いを埋めるために使う
-        @access protected
-        @return void
-       */
-       virtual void do_delete() = 0;
-
-protected:
-
-       int m_nRef;                     //参照カウント
-       bool m_bOwner;          //所有権
-       int m_nMaxNum;          //最大インデックス
-       int m_nObjSize;         //オブジェクトのサイズ
-
-};
-
-/**
- ref_noarray_object
- 非配列オブジェクトに対する、
- 参照カウントを保持した削除クラス
-*/
-template<class T>
-class ref_noarray_object : public ref_delete_base{
-public:
-
-       ref_noarray_object(T* p) : m_pObj(p) {}
-       
-       virtual void do_delete() {
-               if (m_pObj != NULL) {
-                       delete m_pObj;
-               }
-       }
-
-protected:
-
-       T* m_pObj;
-
-};
-
-/**
- ref_array_object
- 配列オブジェクトに対する、
- 参照カウントを保持した削除クラス
-*/
-template<class T>
-class ref_array_object : public ref_delete_base{
-public:
-
-       ref_array_object(T* p) : m_pObj(p) {}
-       
-       virtual void do_delete() {
-               if (m_pObj != NULL) {
-                       delete [] m_pObj;
-               }
-       }
-
-protected:
-
-       T* m_pObj;
-
-};
-
-/**
- ref_null_object
- 所有権を持たないオブジェクトに対する、
- 参照カウントを保持した削除クラス
-*/
-template<class T>
-class ref_null_object : public ref_delete_base{
-public:
-
-       ref_null_object(T* p) : m_pObj(p) {}
-       
-       virtual void do_delete() {
-       }
-
-protected:
-
-       T* m_pObj;
-
-};
-
-#endif
\ No newline at end of file
diff --git a/common/singleton.h b/common/singleton.h
deleted file mode 100755 (executable)
index f69ea4a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef ___HGL___singleton___
-#define ___HGL___singleton___
-
-/**
- singleton
- そのプログラムで、一つしかオブジェクトが存在しないことを
- 保証するためのクラス。
-*/
-template<class T>
-class singleton {
-public:
-
-       singleton() {}
-       virtual ~singleton(){release();}
-
-       /**
-        release
-        オブジェクトが確保されている場合、それを削除する
-        @access public
-        @return void
-       */
-       void release() {
-               if (m_pObj != NULL) {
-                       delete m_pObj;
-                       m_pObj = NULL;
-               }
-       }
-
-       /**
-        get
-        最初にアクセスしたときに、そのオブジェクトをnewしつつ、
-        保持するオブジェクトを返す。
-        @access public
-        @return T* オブジェクト
-       */
-       T* get() {
-        const_cast<T*>(static_cast<const singleton<T>*>(this)->get());
-       }
-
-    const T* get() const {
-        singleton<T>* p = const_cast<singleton<T>*>(this);
-        if (p->m_pObj == NULL) {
-            m_pObj = new T;
-        }
-        return static_cast<T*>(m_pObj);
-    }
-
-       //ポインターの振りをするための演算子オーバーロード
-       T* operator->() {return get();}
-       T& operator*() {return *get();}
-    const T* operator->() const {return get();}
-    const T& operator*() const {return *get();}
-
-    const operator T*() const {return get();}
-
-private:
-
-       static T* m_pObj;       //静的に保持するオブジェクト。
-                                               //初期は、必ずNULLであることが保証されている。
-
-};
-
-template<class T> T* singleton<T>::m_pObj = 0;
-
-#endif
diff --git a/common/smart_ptr.h b/common/smart_ptr.h
deleted file mode 100755 (executable)
index 80871d2..0000000
+++ /dev/null
@@ -1,449 +0,0 @@
-#ifndef ___HGL___smart_ptr___
-#define ___HGL___smart_ptr___
-
-#include "ref_delete.h"
-#include "function_callback.h"
-
-/**
- smart_ptr_base
- スマートポインタの基底クラス。
- 特に何をするわけでもない。
-*/
-class smart_ptr_base {
-public:
-       virtual ~smart_ptr_base(){}
-};
-
-/**
- smart_ptr
- スマートポインタ。
- smart_ptr<CHoge> h(new CHoge);
- とやれば、後はコピーしても解体責任を委譲したりして、
- ちゃんとdeleteしてくれるようなクラス。
- また、配列もとれるようにして、配列であっても
- 通常のポインタであっても、ちゃんとdeleteとdelete[]を
- 分けてくれる。
-
- 配列を生成する際には、
-
- smart_ptr<CHoge> h;
- h.addArray(true,10);
- のように生成するか、
- もしくは、CHogeの派生クラスSHogeを生成したりする場合は、
- h.addArray(new SHoge[10],true,10);
-
- のようにする。
-*/
-template<class T>
-class smart_ptr : public smart_ptr_base {
-public:
-
-       //暗黙の型変換を行わない。
-       //このコンストラクタでは、配列の生成は出来ないことになっている。
-       template<class S> explicit 
-               smart_ptr(S* p, bool owner = true, ref_delete_base* ref = NULL) : 
-                       m_pObj(NULL),m_pRefObj(NULL),m_nIndex(0) {
-               if (p != NULL) {
-                       init(p,owner,1, ref);
-               }
-       }
-
-       //デフォルトコンストラクタ
-       smart_ptr() : m_pObj(NULL),m_pRefObj(NULL),m_nIndex(0) {
-       }
-       
-       //コピーコンストラクタ
-       smart_ptr(const smart_ptr<T>& p) : 
-       m_pObj(NULL),m_pRefObj(NULL),m_nIndex(0) {
-               //参照カウントを増やしつつ、コピー。
-               inc(p);
-       }
-
-       //参照数を減らすだけ。
-       virtual ~smart_ptr() {dec();}
-
-       //明示的に削除するための構文
-       virtual void release() {dec();}
-
-       //ここからは、ポインタの振りをするための仕掛け。
-       T& operator*() const {return *get();}
-       T* operator->() const {return get();}
-
-       //擬似的な配列操作のため。
-       smart_ptr<T>& operator++() {incIndex();return *this;}
-       smart_ptr<T>& operator++(int n) {incIndex();return *this;}
-       smart_ptr<T>& operator--() {decIndex();return *this;}
-       smart_ptr<T>& operator--(int n) {decIndex();return *this;}
-
-       //配列からの取得のため。
-       T& operator[](int n) const {return *get(n + 1);}
-
-       smart_ptr<T>& operator=(const smart_ptr<T>& obj) {
-               //コピーコンストラクタ。
-               //前のオブジェクトの参照カウントを減らした後、
-               //コピーする
-               if (this != &obj) {
-                       dec();
-                       inc(obj);
-               }
-               return *this;
-       }
-
-       /**
-        get
-        保持するメモリから、指定された場所のメモリを確保する。
-        @param int n デフォルトは1
-        @access public
-        @return 指定された位置のテンプレートで指定されたオブジェクト
-       */
-       T* get(int n = 1) const {
-               //配列、単一変数どちらにでも対応するため、
-               //引数で場所を取る。
-               
-
-               if (m_pRefObj == NULL) {
-                       return NULL;
-               }
-
-               if (m_nIndex + n > m_pRefObj->getMaxNum() || m_nIndex + n < 0) {
-                       return NULL;
-               }
-
-               //取得すべきメモリは、
-               //オブジェクトの先頭アドレス+オブジェクトのサイズ*(インデックス+引数)
-               //なお、この際に、m_nIndex = 0かつ、n = 1である場合、
-               //先頭アドレス+オブジェクトサイズということになり、どう考えてもアクセス違反になる。
-               //である
-               return (T*)((unsigned char*)m_pObj + (m_pRefObj->getObjSize() * (m_nIndex + n - 1)));
-       }
-
-       //==============================================
-       //疑似イテレーターとして使用するための関数群
-       //==============================================
-
-       /**
-        isEnd
-        インデックスが、限界に達していないかどうか
-        ここで言う限界とは、MaxNumで、つまり添え字+1をさす。
-        @access public
-        @return bool 達している場合はtrue
-       */
-       bool isEnd() {
-               if (m_pRefObj != NULL) {
-                       return m_pRefObj->getMaxNum()-1 < m_nIndex?true:false;
-               } else {
-                       return true;
-               }
-       }
-
-       /**
-        isBegin
-        インデックスが、先頭であるかどうか
-        @access public
-        @return bool 先頭である場合はtrue
-       */
-       bool isBegin() {
-               return m_nIndex == 0?true:false;
-       }
-
-       /**
-        オブジェクトがNULLかどうか
-        @access public
-        @return bool
-       */
-       bool isNull() const {
-               return m_pRefObj==NULL&&m_pObj==NULL?true:false;
-       }
-       
-       /**
-        end
-        インデックスを、最後尾に位置させる
-        @access public
-        @return void
-       */
-       void end() {
-               if (m_pRefObj != NULL) {
-                       m_nIndex = m_pRefObj->getMaxNum()-1;
-               } else {
-                       m_nIndex = 0;
-               }
-       }
-
-       /**
-        begin
-        インデックスを、先頭に位置させる
-        @access public
-        @return void
-       */
-       void begin() {
-               m_nIndex = 0;
-       }
-
-       //=============================================
-       //追加生成関数群
-       //=============================================
-
-       /**
-        * @brief アップキャストを行う。SはTの派生クラスであること。
-        * また、その特性上同一性チェックが困難であるので、こればかりは仕方がない。
-        * @param const smart_ptr<S>& スマートポインタ
-        * @return smart_ptr<T>& アップキャスト後の自身。
-        */
-       template<class S>
-       smart_ptr<T>& upcast(const smart_ptr<S>& p) {
-               
-               if (reinterpret_cast<void*>(this) != 
-                       reinterpret_cast<void*>(const_cast<smart_ptr<S>*>(&p)) ) {
-                       //pがさすオブジェクトをこのオブジェクトもさすことになるので、
-                       //まずはdec
-                       dec();
-                       
-                       //あとはincとほぼ同じ処理になる。
-                       m_pObj = p.getObj();
-                       m_pRefObj = p.getRefObj();
-                       m_nIndex = p.getIndex();
-
-                       if (m_pRefObj != NULL) {
-                               m_pRefObj->inc_ref();
-                       }
-               }
-
-               return *this;
-       }
-
-       /**
-        * @brief 指定した型の追加生成構文
-        * コンストラクタで何も指定しない場合、これを実行することで、追加生成か可能となる。
-        */
-       void add() {
-               dec();
-               init(new T, true, 1);
-       }
-
-       /**
-        add
-        新しく生成させる。
-        関数テンプレートを使ってはいるが、必ずTとおなじ、
-        もしくはTの派生クラスであること。
-        @param S* p 対象とするオブジェクト
-        @param bool owner 所有権の有無
-        @access public
-        @return void
-       */
-       template<class S>
-       void add(S* _p, bool owner = true) {
-               dec();
-               if (_p != NULL) {
-                       init(_p,owner,1);
-               }
-       }
-
-       /**
-        * @brief デリータを指定した追加生成構文。
-        * これは配列では使用できない。
-        */
-       template<class S>
-       void add(S* _p, bool owner, ref_delete_base* ref) {
-               dec();
-               if (_p != NULL && ref != NULL) {
-                       init(_p, owner, 1, ref);
-               }
-       }
-
-       /**
-        addArray
-        配列オブジェクト生成関数
-        現在のオブジェクトの型を、指定個数作成する場合。
-        @param bool owner 所有権の有無
-        @param int n 個数
-        @access public
-        @return void
-       */
-       void addArray(bool owner, int n) { 
-               dec();
-               if (n > 1) {
-                       init(new T[n], owner, n);
-               } else if (n == 1) {
-                       init(new T, owner, 1);
-               }
-       }
-
-       /**
-        addArray
-        配列オブジェクト生成関数
-        こちらは、配列オブジェクトを生成する際に使用される関数。
-        @param S p 対象とするオブジェクト
-        @param bool owner 所有権の有無
-        @param int n 個数
-        @access public
-        @return void
-       */
-       template<class S>
-       void addArray(S _p, bool owner, int n) { 
-               dec();
-               if (n > 1) {
-                       init(new S[n], owner, n);
-               }
-       }
-
-       /**
-        getIndex
-        現在のインデックスを返す
-        @access public
-        @return int 現在のインデックス
-       */
-       int getIndex() const {return m_nIndex;}
-
-       /**
-        getRefObj
-        削除オブジェクトを返す
-        @access public
-        @return ref_delete_base* 削除オブジェクトのポインタ
-       */
-       ref_delete_base* getRefObj() const {return m_pRefObj;}
-       
-       /**
-        getObj
-        オブジェクトを返す
-        @access public
-        @return T* オブジェクトのポインタ
-       */
-       T* getObj() const {return m_pObj;}
-
-private:
-
-       /**
-        init
-        スマートポインタの初期化補助関数
-        渡されたオブジェクトを元にして、所有権、
-        参照カウント、オブジェクトの個数を設定する。
-        @param template _p 保持するべきオブジェクト
-        @param bool owner 所有権の湯有無
-        @param int n オブジェクトの個数
-        @param ref_delete_base* ref デフォルトはNULL。外部からのコピーならば非NULL
-        @access protected
-        @return void
-       */
-       template<class S>
-       void init(S* _p, bool owner, int n, ref_delete_base* ref = NULL) {
-               
-               m_nIndex = 0;
-               m_pObj = _p;
-
-               if (m_pRefObj != NULL) {
-                       //このとき、すでにdec_refとかはやってあることが前提。
-                       m_pRefObj = NULL;
-               }
-
-               if (ref != NULL) {
-                       m_pRefObj = ref;
-               } else if (owner) {
-                       if (n == 1) {
-                               //非配列オブジェクト
-                               m_pRefObj = new ref_noarray_object<S>(_p);
-                       } else if (n > 1){
-                               m_pRefObj = new ref_array_object<S>(_p);
-                       }
-               } else {
-                       //非所有権オブジェクト
-                       m_pRefObj = new ref_null_object<S>(_p);
-               }
-
-               //オブジェクトの情報を追加
-               m_pRefObj->setRef(1);
-               m_pRefObj->setMaxNum(n);
-               m_pRefObj->setObjSize(sizeof(S));
-               m_pRefObj->setOwner(owner);
-
-       }
-
-       /**
-        inc
-        渡されたsmart_ptrの参照数を一つ増やす。
-        @param const smart_ptr<T>& p 参照カウントを増やすオブジェクト
-        @access protected
-        @return void
-       */
-       void inc(const smart_ptr<T>& p) {
-               m_nIndex        = p.getIndex();
-               m_pRefObj       = p.getRefObj();
-               m_pObj          = p.getObj();
-               
-               if (m_pRefObj != NULL) {
-                       m_pRefObj->inc_ref();
-               }
-       }
-
-       /**
-        dec
-        自分の分の参照カウントを減らす。
-        実行されたら、m_pRefObjおよびm_pObjは
-        NULLになる。
-        @access protected
-        @return void
-       */
-       void dec() {
-               //dec_refは、オブジェクトを削除したかどうかを返す。
-               //削除されている場合は、参照オブジェクトを削除しなければならない。
-               if (m_pRefObj != NULL) {
-                       if (m_pRefObj->dec_ref()) {
-                               delete m_pRefObj;
-                       }
-               }
-               m_pRefObj = NULL;
-               m_pObj = NULL;
-       }
-
-       /**
-        incIndex
-        インデックスカウントを増やす
-        @access protected
-        @return void
-       */
-       void incIndex() {m_nIndex++;}
-
-       /**
-        decIndex
-        インデックスカウントを減らす
-        @access protected
-        @return void
-       */
-       void decIndex() {m_nIndex--;}
-
-       //========================================
-       //コピーの際に使用するconst関数群
-       //========================================
-       
-private:
-
-       T* m_pObj;              //保持すべきオブジェクト。参照カウントオブジェクトと同一
-
-       ref_delete_base* m_pRefObj;             //参照カウントオブジェクト
-
-       int m_nIndex;           //現在のインデックス
-
-};
-
-template<class T>
-class ref_noarray_func_object : public ref_delete_base {
-public:
-
-       ref_noarray_func_object(T* p, const smart_ptr<function_callback>& func) :
-               m_pObj(p), m_pFunc(func)
-       {
-       }
-
-       virtual void do_delete() {
-               m_pFunc->run();
-               if (m_pObj != NULL) {
-                       delete m_pObj;
-               }
-       }
-
-private:
-
-       T* m_pObj;
-       smart_ptr<function_callback> m_pFunc;
-};
-                               
-#endif
\ No newline at end of file