[xsde-users] Re: Determine whether an object model supports polymorphism

Boris Kolpackov boris at codesynthesis.com
Wed Oct 21 10:41:09 EDT 2009


Hi Thomas,

Thomas Frenzel (TomSun) <tftomsun at streamteam.de> writes:

> Within the XmlManager template class i need the information whether 
> the given object model class uses polymorphism or not in 3 cases 
> (currently the boolean m_polymorphic  indicates if the object model 
> uses polymorphism):

Thanks for the explanation, it makes sense. I will add the boolean member 
to the *_paggs and *_saggr classes.


> Yes the implementation looks sufficient for my needs. I am happy as long 
> as i can convert  from the string representation to the numeric 
> representation and vice versa.

Ok, I will go ahead and implement this then. Should have something for
you to try in a few days unless I get sidetracked.


> Maybe an constructor overload that takes the string/char* would be 
> useful, too.

Yes, it could be useful but it would also complicate things since
there should be error handling (with and without exceptions), etc.
I will keep it minimal for now and see how it goes.


> It would be nice if you could post the cpp file of your color example.

It will be something along these lines:

inline color:
color ()
  v_ (red)
{
}

inline color:
color (value v)
  v_ (v)
{
}

inline color:
operator value () const
{
  return v_;
}

static const char* color_str_[] = {"red", "green", "blue"};

const char* color:
string () const
{
  return color_str_[v_];
}

Boris



More information about the xsde-users mailing list