i guess calling the real constructors works fine because you know that you are calling it. and you know the requirements for it. the problem is if you change a base class, the derived class behavior may change unobviously. this really is only a problem for overriden values, so maybe you should just disallow them. i dunno. you have to have some responsibility at some point. if you are doing stupid crap, it just is not going to work. setting the matrix multiple times is not going to hurt anything. in theory you could always call some other constructor of the base class if you want and fill in the base class manually.
lets look at the needed classes now.
class gbDotable
{
public:
virtual gbDotable* dotMember(const char* name)=0;
virtual gbDotable* dotGet(const char* name)=0;
virtual void dotSet(const char* name,gbDotable* value)=0;
virtual const char* dotName()=0;
virtual const char* dotType()=0;
virtual gbDotableValue* dotValue(int index=0)=0;
};
class Float3 : public gbDotable
{
float3 _value;
virtual void dotSet(gbDotable* value)
{
_value=dynamic_cast
}
};
gbDotable* gbBoxGeom::dotGet(const char* name,gbDotable* value)
{
if(!strcmp("_size",name)){return new Float3(_size);}
}
void gbBoxGeom::dotSet(const char* name,gbDotable* value)
{
if(!strcmp("_size",name)){_size=dynamic_cast
}
so you are going to be creating Float3 objects like crazy, but its owner will be null so you delete it right away? SHIT!
should i just put the damn primitive wrappers in the class? it wastes memory, but is it really that much? how many props end up being in a class anyway? is there are wrapper to call a function? how do matrices work?
class gbGeom : public gbDotable
{
public:
float16 _modelMatrix;
float16 _cachedWorldMatrix;
Float16* _wrappedModelMatrix;
Float16* _wrappedCachedWorldMatrix;
public:
gbGeom()
{
_wrappedModelMatrix=new Float16(this,"rw","modelMatrix",&modelMatrix);
_wrappedCachedWorldMatrix=new Float16(this,"r","cachedWorldMatrix",&cachedWorldMatrix);
}
};
class gbBoxGeom : public gbGeom
{
public:
float3 _size;
Float3* _wrappedSize;
gbBoxGeom()
{
_wrappedSize=new Float3(this,"r","size",&_size);
}
};