- changed namespace

This commit is contained in:
terrorfisch 2014-10-10 23:28:49 +02:00
parent db1b93498d
commit 5248917a6c
2 changed files with 99 additions and 94 deletions

View file

@ -19,13 +19,13 @@ namespace ESM
}
}
template< class Base > class DerivedClassStorage;
namespace MWMechanics
{
class AiPackage;
template< class Base > class DerivedClassStorage;
class AiTemporaryBase;
typedef DerivedClassStorage<AiTemporaryBase> AiState;

View file

@ -8,12 +8,18 @@
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
/// \brief stores an object of any class derived from Base
template< class Base >
class DerivedClassStorage
namespace MWMechanics
{
private:
/** \brief stores one object of any class derived from Base.
* Requesting a certain dereived class via get() either returns
* the stored object if it has the correct type or otherwise replaces
* it with an object of the requested type.
*/
template< class Base >
class DerivedClassStorage
{
private:
Base* mStorage;
// assert that Derived is derived from Base.
@ -31,7 +37,7 @@ private:
DerivedClassStorage( const DerivedClassStorage& other );
DerivedClassStorage& operator=( const DerivedClassStorage& );
public:
public:
/// \brief returns reference to stored object or deletes it and creates a fitting
template< class Derived >
Derived& get()
@ -108,10 +114,9 @@ public:
};
};
namespace MWMechanics
{
/// \brief base class for the temporary storage of AiPackages.
/**
* Each AI package with temporary values needs a AiPackageStorage class