forked from mirror/openmw-tes3mp
- changed namespace
This commit is contained in:
parent
db1b93498d
commit
5248917a6c
2 changed files with 99 additions and 94 deletions
|
@ -19,13 +19,13 @@ namespace ESM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class Base > class DerivedClassStorage;
|
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
class AiPackage;
|
class AiPackage;
|
||||||
|
|
||||||
|
template< class Base > class DerivedClassStorage;
|
||||||
class AiTemporaryBase;
|
class AiTemporaryBase;
|
||||||
typedef DerivedClassStorage<AiTemporaryBase> AiState;
|
typedef DerivedClassStorage<AiTemporaryBase> AiState;
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,18 @@
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/type_traits/is_base_of.hpp>
|
#include <boost/type_traits/is_base_of.hpp>
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
/// \brief stores an object of any class derived from Base
|
|
||||||
template< class Base >
|
|
||||||
class DerivedClassStorage
|
|
||||||
{
|
{
|
||||||
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;
|
Base* mStorage;
|
||||||
|
|
||||||
// assert that Derived is derived from Base.
|
// assert that Derived is derived from Base.
|
||||||
|
@ -31,7 +37,7 @@ private:
|
||||||
DerivedClassStorage( const DerivedClassStorage& other );
|
DerivedClassStorage( const DerivedClassStorage& other );
|
||||||
DerivedClassStorage& operator=( const DerivedClassStorage& );
|
DerivedClassStorage& operator=( const DerivedClassStorage& );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \brief returns reference to stored object or deletes it and creates a fitting
|
/// \brief returns reference to stored object or deletes it and creates a fitting
|
||||||
template< class Derived >
|
template< class Derived >
|
||||||
Derived& get()
|
Derived& get()
|
||||||
|
@ -108,10 +114,9 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace MWMechanics
|
|
||||||
{
|
|
||||||
/// \brief base class for the temporary storage of AiPackages.
|
/// \brief base class for the temporary storage of AiPackages.
|
||||||
/**
|
/**
|
||||||
* Each AI package with temporary values needs a AiPackageStorage class
|
* Each AI package with temporary values needs a AiPackageStorage class
|
||||||
|
|
Loading…
Reference in a new issue