00001 // ///////////////////////////////////////////////////////////////////////////// 00002 // 00003 // Name: DataStore.h 00004 // Author: Michael Bartsch (ZCCdark203) 00005 // 00006 // Desc : Declaration of the DataStore class. 00007 // 00008 // License: Copyright (C) 2009 Michael Bartsch and Contributors 00009 // 00010 // This program is free software: you can redistribute it 00011 // and/or modify it under the terms of the zlib/libpng License. 00012 // See main.cpp for conditions of distribution and use. 00013 // 00014 // ///////////////////////////////////////////////////////////////////////////// 00015 00016 #ifndef __DATASTORE_H__ 00017 #define __DATASTORE_H__ 00018 00019 // Include files 00020 #include "../dependencies.h" 00021 #include "DataStack.h" 00022 00023 // Forward declarations 00024 class DataStack; 00025 00026 00027 // DataStore class 00029 class DataStore 00030 { 00031 public: 00032 00033 // Initialisation and deinitialisation 00035 DataStore(); 00037 ~DataStore(); 00038 00040 void init(); 00042 void clear(); 00043 00044 // AngelScript binding 00047 void refAdd(); 00050 void refRelease(); 00051 00052 // Methods 00056 bool addDataStack(DataStack *stack); 00060 DataStack* createDataStack(const std::string &name); 00061 00064 DataStack* getDataStack(const u32 id); 00067 DataStack* getDataStack(const std::string &name); 00068 00070 void removeAllDataStacks(); 00074 bool removeDataStack(DataStack *stack); 00078 bool removeDataStack(const u32 id); 00082 bool removeDataStack(const std::string &name); 00083 00084 private: 00085 00086 // Normal members 00087 std::vector<DataStack*> mStacks; 00088 00089 }; 00090 00091 00092 // DataStore Angelscript binding. 00094 extern void bindDataStore(asIScriptEngine *engine); 00095 00096 #endif