Can QxOrm persist pointers to abstract classes?
[I asked this on StackOverflow, but thought I'd ask here too since I haven't yet gotten a definitive answer.]
I am trying to figure out how to use QxOrm to persist a large, complex class structure. I've made some progress, but am stuck on what to do with pointers to abstract classes.
Here's a simple example, where Table (a concrete class) has a pointer to some kind of Shape (an abstract class):
I get error messages complaining that Shape is abstract when I try this.
It looks to me like this is impossible to do with QxOrm, I suspect because its only inheritance model is Concrete.
Does anyone know if this is possible or not? I'd rather not give up on QxOrm since it looks good in many ways (and I've put a bunch of time into it already), but it looks like I will have to.
I know about QX_REGISTER_ABSTRACT_CLASS. It does not help for this use case.
I experimented with making the comment class in the qxBlog example abstract. I made it subclass qx::IxPersistable and used the QX_REGISTER_ABSTRACT_CLASS macro. When I compile, it dies in the invocation of the macro QX_PERSISTABLE_CPP, with:
../../../QxOrm/include/QxDao/../../inl/QxDao/QxDao_Count.inl:36: error: cannot declare variable 't' to be of abstract type 'comment'
There are similar error messages from other places, too.
Thanks!
I am trying to figure out how to use QxOrm to persist a large, complex class structure. I've made some progress, but am stuck on what to do with pointers to abstract classes.
Here's a simple example, where Table (a concrete class) has a pointer to some kind of Shape (an abstract class):
- Code: Select all
class Table {
Shape* top;
};
class Shape {
public:
virtual float getWidth() = 0;
};
class Square : public Shape {
virtual float getWidth();
};
class Circle : public Shape {
virtual float getWidth();
};
I get error messages complaining that Shape is abstract when I try this.
It looks to me like this is impossible to do with QxOrm, I suspect because its only inheritance model is Concrete.
Does anyone know if this is possible or not? I'd rather not give up on QxOrm since it looks good in many ways (and I've put a bunch of time into it already), but it looks like I will have to.
I know about QX_REGISTER_ABSTRACT_CLASS. It does not help for this use case.
I experimented with making the comment class in the qxBlog example abstract. I made it subclass qx::IxPersistable and used the QX_REGISTER_ABSTRACT_CLASS macro. When I compile, it dies in the invocation of the macro QX_PERSISTABLE_CPP, with:
../../../QxOrm/include/QxDao/../../inl/QxDao/QxDao_Count.inl:36: error: cannot declare variable 't' to be of abstract type 'comment'
There are similar error messages from other places, too.
Thanks!