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 : public ReferenceCounted 00030 { 00031 public: 00032 00033 // Initialisation and deinitialisation 00035 DataStore(); 00037 ~DataStore(); 00038 00040 void init(); 00042 void clear(); 00043 00044 // Reference counting 00047 void grab(); 00050 void drop(); 00051 00052 // Methods 00056 bool addDataStack(DataStack *stack); 00061 DataStack* createDataStack(const std::string &name, bool grab = true); 00062 00065 DataStack* getDataStack(const u32 id); 00068 DataStack* getDataStack(const std::string &name); 00069 00071 void removeDataStacks(); 00075 bool removeDataStack(DataStack *stack); 00079 bool removeDataStack(const u32 id); 00083 bool removeDataStack(const std::string &name); 00084 00085 private: 00086 00087 // Normal members 00088 std::vector<DataStack*> mStacks; 00089 00090 }; 00091 00092 #endif