473,414 Members | 1,928 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Storage of C++ Class Hierarchy

ik
Hello All,
Please point me to the right news group if this is not the right one.

I have to store c++ class hierarchy, in some structure. From that
structure, I need to query for the baseclasses. I get the base class,
derived class information from a text file of the form

[baseclass1,derivedclass1]
[baseclass1,derivedclass2]
[baseclass2,derivedclass3]
[derivedclass3,derivedclass6] .. etc

This list is a plain one, and has multiple classes, I mean there are
different base classes and its associated derived classes. Multiple
inheritence is also allowed. Fortunately, all the class names are
unique.
I tried diffenent implementaions like maintianing two list, one for the
derived class and another for the inherited class and look the
inherited table to get the base class.. and so I create a structure ..
which I see is not efficient at all. Can somebody recommend a better
way to do this ?

Thanks for any suggestions.

Jul 22 '05 #1
1 1504
ik wrote:
Hello All,
Please point me to the right news group if this is not the right one.

I have to store c++ class hierarchy, in some structure. From that
structure, I need to query for the baseclasses. I get the base class,
derived class information from a text file of the form

[baseclass1,derivedclass1]
[baseclass1,derivedclass2]
[baseclass2,derivedclass3]
[derivedclass3,derivedclass6] .. etc

This list is a plain one, and has multiple classes, I mean there are
different base classes and its associated derived classes. Multiple
inheritence is also allowed. Fortunately, all the class names are
unique.

[snip]

It appears to me that the inheritence data define a directed graph wherein
each class is a vertex and directed edges represent inheritence. What I am
not sure about is the kind of questions you want to ask. For instance, if
you want to know whether a certain class is a (possibly indirect) base
class of some other class, then you would need to decide if there is a
directed path joining two given vertices.

This is a general graph programming problem and not really on-topic is this
group: here we are concerned with the C++ language proper. Neither your use
of C++ for solving the problem nor the origin of your data from a C++ class
hierarchy ensure topicality. You might want to try comp.programming.

This said, you also might want to check out whether the Boost Graph library
(or any other library providing graphs like LEDA) would do better than what
you have so far.
Best

Kai-Uwe Bux
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John J. Lee | last post by:
I'm trying to change a base class of a big class hierarchy. The hierarchy in question is 4DOM (from PyXML). 4DOM has an FtNode class that defines __getattr__ and __setattr__ that I need to...
1
by: Stefan Seefeld | last post by:
hi there, I'v run into a little problem for which I only found an ugly workaround, so I'd like to know whether people are aware of better ways to achieve this... I'm defining a class 'Class'...
9
by: mead | last post by:
What kind of classes is qualified as "concrete classes"? When should a member function in a class defined as "pure virtual" and when as "virtual"? Thanks!
21
by: Blue Ocean | last post by:
The reason why I ask is because I am unfamiliar with the idea of templates. It seems like it would be easier if all classes that needed something like template<class T> class Stack { ... } ...
2
by: Matt | last post by:
Hello, I would like to generate what I call an "overall class hierarchy" in UML automatically derived from my C++ code source. An example of what I seek: ...
21
by: Mark Broadbent | last post by:
Consider the following statements //------- Item i = Basket.Items; //indexer is used to return instance of class Item Basket.Items.Remove(); //method on class item is fired item i = new...
2
by: Bror Johansson | last post by:
Hi, I have a class-hierarchy (fairly deep and fairly wide). Is there a good and general way to test an instance-object obj for having a class belonging to a certain "sub-tree" of the hierarchy...
2
by: sarathy | last post by:
Hi, What is the difference b/w a "storage class" and "storage class specifier"? It is said that there, Storage Class --automatic static ( K&R ) Storage Class Specifier --auto extern register...
3
by: krzysztof.konopko | last post by:
Hello! I want to design a class hierarchy with one base abstract class, let's say CBase. I have a predicate that every object in the class hierarchy must have a parent object of type from this...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.