Fixed template
This commit is contained in:
49
src/include/DataModelV3/Instance.h
Normal file
49
src/include/DataModelV3/Instance.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
#define WINVER 0x0400
|
||||
#include "Reflection/Reflection.h"
|
||||
#include "Reflection/ReflectionDataTable.h"
|
||||
#include "Reflection/ReflectionProperty.h"
|
||||
#include <G3DAll.h>
|
||||
|
||||
namespace B3D
|
||||
{
|
||||
class Instance
|
||||
{
|
||||
public:
|
||||
//Constructors
|
||||
Instance(void);
|
||||
Instance(const Instance&);
|
||||
virtual ~Instance(void);
|
||||
|
||||
//Virtual Functions
|
||||
virtual void render(RenderDevice*);
|
||||
virtual void renderName(RenderDevice*);
|
||||
virtual void update();
|
||||
virtual void setParent(Instance*);
|
||||
virtual Instance* clone() const { return new Instance(*this); }
|
||||
|
||||
//Functions
|
||||
std::vector<Instance*> children; // All children.
|
||||
std::string getClassName();
|
||||
Instance* findFirstChild(std::string);
|
||||
std::vector<Instance* > getChildren();
|
||||
std::vector<Instance* > getAllChildren();
|
||||
void setName(std::string newName);
|
||||
void addChild(Instance*);
|
||||
void removeChild(Instance*);
|
||||
void clearChildren();
|
||||
Instance* getParent();
|
||||
|
||||
//Variables
|
||||
Reflection::ReflectionProperty<std::string> name;
|
||||
protected:
|
||||
//Constructor
|
||||
//Used specifically to identify an instance class by an instance class,
|
||||
//NOT for use outside of Instance and decendants!
|
||||
Instance(std::string className);
|
||||
|
||||
//Variables
|
||||
Reflection::ReflectionDataTable * dataTable;
|
||||
Instance * parent;
|
||||
};
|
||||
}
|
||||
@@ -4,14 +4,13 @@
|
||||
#include <map>
|
||||
#include "ReflectionProperty.h"
|
||||
namespace B3D{
|
||||
namespace Instance{
|
||||
class Instance;
|
||||
}
|
||||
class Instance;
|
||||
|
||||
namespace Reflection{
|
||||
class ReflectionDataTable
|
||||
{
|
||||
public:
|
||||
ReflectionDataTable(Instance::Instance * parentInstance, std::string className);
|
||||
ReflectionDataTable(Instance * parentInstance, std::string className);
|
||||
ReflectionDataTable::ReflectionDataTable(void);
|
||||
~ReflectionDataTable(void);
|
||||
|
||||
@@ -20,7 +19,7 @@ namespace B3D{
|
||||
//Perhaps not stored here?
|
||||
std::string className;
|
||||
std::map<std::string, B3D::Reflection::ReflectionProperty<void*>*> propertyTable;
|
||||
Instance::Instance * parentInstance;
|
||||
Instance * parentInstance;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ namespace B3D{
|
||||
namespace Reflection{
|
||||
class ReflectionDataTable;
|
||||
|
||||
template<typename T>
|
||||
template<class T>
|
||||
class ReflectionProperty
|
||||
{
|
||||
public:
|
||||
T * value;
|
||||
ReflectionType type;
|
||||
ReflectionProperty(T * value, ReflectionType type, ReflectionDataTable * containerTable, bool archivable = true, bool locked = false, bool propertyHidden = false);
|
||||
ReflectionProperty(T * value, ReflectionType type, ReflectionDataTable * containerTable);
|
||||
ReflectionProperty(void);
|
||||
~ReflectionProperty(void);
|
||||
private:
|
||||
@@ -25,4 +25,7 @@ namespace B3D{
|
||||
ReflectionDataTable * containerTable;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//***really*** wanted to avoid implementing this inside of the header
|
||||
#include "ReflectionProperty_imp.h"
|
||||
22
src/include/ReflectionProperty_imp.h
Normal file
22
src/include/ReflectionProperty_imp.h
Normal file
@@ -0,0 +1,22 @@
|
||||
using namespace B3D::Reflection;
|
||||
|
||||
template<class T>
|
||||
ReflectionProperty<T>::ReflectionProperty(T * value, ReflectionType type, ReflectionDataTable * containerTable)
|
||||
{
|
||||
this->value = value;
|
||||
this->type = type;
|
||||
this->containerTable = containerTable;
|
||||
this->locked = locked;
|
||||
this->archivable = archivable;
|
||||
this->propertyHidden = propertyHidden;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
ReflectionProperty<T>::ReflectionProperty(void)
|
||||
{
|
||||
}
|
||||
|
||||
template<class T>
|
||||
ReflectionProperty<T>::~ReflectionProperty(void)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user