AbyssLib 1.301
あびす謹製ノベルゲームフレームワークライブラリ

AbyssLibSrc/AbyssLib/AbyssLib/SimulatedHeap.h

説明を見る。
00001 /*************************************************
00002 ファイル名:SimulatedHeap.h
00003 作成者  :あびす
00004 役割   :擬似ヒープ
00005 *************************************************/
00010 #ifndef ABYSSLIB_SIMULATEDHEAP_H
00011 #define ABYSSLIB_SIMULATEDHEAP_H
00012 
00013 namespace nsAbyssLib{
00014 
00015 namespace nsTextStream{
00016 //依存クラス(参照先:TextStream.h)
00017 class ITextStream;
00018 }
00019 namespace nsCommand{
00020 //依存構造体(参照先:Command.h)
00021 struct CmdParam;
00022 //依存クラス(参照先:Command.h)
00023 class ICmd_Base;
00024 }
00025 namespace nsCore{
00026 //依存クラス(参照先:AbyssLib.h)
00027 class INovelEngine;
00028 }
00029 
00030 namespace nsSimulatedHeap{
00031 
00032 //擬似ヒープ(インターフェース)
00044 class ISingleHeap{
00045 public:
00046     //操作
00054     virtual int Get(const char* Text) const = 0;                            //取得
00061     virtual bool Find(const char* Text) const = 0;                          //検索
00069     virtual void Set(const char* Text, int Value) = 0;                      //追加/設定
00074     virtual void Print(const ITextStream* Output) const = 0;                //内容を表示
00075 };
00076 
00077 //擬似ヒープ
00089 class SingleHeap : public ISingleHeap{
00090 public:
00094     SingleHeap(){}                                                          //デフォルトコンストラクタ
00095 
00099     void Clear();                                                           //消去
00100     int Get(const char* Text) const;                                        //取得
00101     bool Find(const char* Text) const;                                      //検索
00102     void Set(const char* Text, int Value);                                  //追加/設定
00103     void Print(const ITextStream* Output) const;                            //内容を表示
00104 
00109     map<string, int>* GetObj();                                             //実体を取得(1)
00114     const map<string, int>* GetObj() const;                                 //実体を取得(2)
00115 
00120     void Save(IIOStream* IOStream);                                         //保存
00125     void Load(IIOStream* IOStream);                                         //読み込み
00126 private:
00127     map<string, int> m_Heap;                                                //擬似ヒープ
00128 
00129     SingleHeap(const SingleHeap&);                                          //コピーコンストラクタ(禁止)
00130     SingleHeap& operator =(const SingleHeap&);                              //代入演算子(禁止)
00131 };
00132 
00133 //擬似ヒープ(命令)(インターフェース)
00141 class ICommandHeap{
00142 public:
00143     //操作(命令リスト)
00148     virtual void Print(const ITextStream* Output) const = 0;                //命令の内容を表示
00149     //操作(イテレータ)
00158     virtual int GetIterator() const = 0;                                    //イテレータを取得
00167     virtual void AddIterator(int it) = 0;                                   //イテレータを加算
00176     virtual void SetIterator(int it) = 0;                                   //イテレータを設定
00184     virtual void PopIterator() = 0;                                         //イテレータをポップ
00192     virtual void PushIterator(int it) = 0;                                  //イテレータをプッシュ
00197     virtual void PrintIterator(const ITextStream* Output) const = 0;        //イテレータの内容を表示
00198 };
00199 
00200 //擬似ヒープ(命令)
00208 class CommandHeap : public ICommandHeap{
00209 public:
00213     CommandHeap();                                                          //デフォルトコンストラクタ
00217     ~CommandHeap();                                                         //デストラクタ
00218 
00222     void Initialize();                                                      //初期化
00223 
00230     void SetParent(INovelEngine* Parent);                                   //親エンジンを設定
00231 
00239     void Run();                                                             //命令を実行
00243     void Clear();                                                           //命令リストを消去
00244     void Print(const ITextStream* Output) const;                            //命令の内容を表示
00250     void Add(ICmd_Base* NewCommand, const CmdParam& Parameter);             //命令を新規に追加
00251 
00256     vector<ICmd_Base*>* GetObj();                                           //実体を取得(1)
00261     const vector<ICmd_Base*>* GetObj() const;                               //実体を取得(2)
00262 
00267     void Save(IIOStream* IOStream);                                         //保存
00272     void Load(IIOStream* IOStream);                                         //読み込み
00273 
00274     int GetIterator() const;                                                //イテレータを取得
00275     void AddIterator(int it);                                               //イテレータを加算
00276     void SetIterator(int it);                                               //イテレータを設定
00277     void PopIterator();                                                     //イテレータをポップ
00281     void ClearIterator();                                                   //イテレータを全消去
00282     void PushIterator(int it);                                              //イテレータをプッシュ
00283     void PrintIterator(const ITextStream* Output) const;                    //イテレータの内容を表示
00284 
00289     void SaveIterator(IIOStream* IOStream);                                 //イテレータを保存する
00294     void LoadIterator(IIOStream* IOStream);                                 //イテレータを読み込む
00295 private:
00296     INovelEngine* Outer;                                                    //親エンジンのアドレス
00297     vector<int> m_Iterator;                                                 //イテレータ(命令)
00298     vector<ICmd_Base*> m_Heap;                                              //擬似ヒープ(命令)
00299 
00300     CommandHeap(const CommandHeap&);                                        //コピーコンストラクタ(禁止)
00301     CommandHeap& operator =(const CommandHeap&);                            //代入演算子(禁止)
00302 };
00303 
00304 }
00305 }
00306 
00307 #endif
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義