[odb-users] Problem with pointer in base class

Ball, John R jrball at sandia.gov
Wed Jul 3 11:22:21 EDT 2013


Thanks for the quick reply. You are correct, I'm talking derivation not specialization. Sorry about that.  I tried this with polymorphic inheritance and ended up with large Foo and Bar base tables which might be a problem - I don' t know yet. In the meantime, if I go this way, can I still do queries against Foo derived or do I have to query against Foo base?

==========
John R. Ball - CISSP
Sandia National Laboratories, Albuquerque NM
Organization 5541 - Data Systems IA Lead Engineer
Phone: (505) 844-1356
Pager: (505) 951-6328
Bldg 752/122 MS 0975
E-Mail: jrball at sandia.gov <mailto:jrball at sandia.gov>
========== 

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, July 03, 2013 9:12 AM
To: Ball, John R
Cc: odb-users at codesynthesis.com
Subject: [EXTERNAL] Re: [odb-users] Problem with pointer in base class

Hi John,

Ball, John R <jrball at sandia.gov> writes:

> Consider a base class Foo that references another base class Bar by 
> pointer. The pointer is held by the Foo base and is instantiated on 
> the Bar base class. We now want to have parallel specialization 
> hierarchies for Foo and Bar.

I am confused by your terminology: do you mean template specializations? Maybe you mean "derivation" instead of "specialization"? I.e., you have parallel inheritance hierarchies starting with the Foo and Bar base classes?


> When we store Foo and Bar specializations, they of course go into 
> individual tables. However, since the pointer is held by the Foo
> base class and instantiated on the Bar base class, ODB can't find
> the Bar specialization objects to resolve the pointer.

Yes, I am pretty sure you are talking about inheritance 
hierarchies here. And you are using reuse-style inheritance
support in ODB. I think polymorphic inheritance will work much
better in this situation. With polymorphic inheritance, any
(derived) Foo object can reference any (derived) Bar object.
See Section 8.2, "Polymorphism Inheritance" in the ODB manual
for more information on this inheritance style.

If, however, I am completely wrong about what you trying to
achieve, then can you show some sample class declarations (e.g.,
for Foo and Bar and for a few of their "specializations")?

Boris




More information about the odb-users mailing list