Re: [C++] Help with a Database for User Defined Classes
From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 12/21/04
- Next message: Ulrich Eckhardt: "Re: Asigning to char *"
- Previous message: Chris \( Val \): "Re: [OT] Critical section ?"
- Next in thread: B. v Ingen Schenau: "Re: [C++] Help with a Database for User Defined Classes"
- Maybe reply: B. v Ingen Schenau: "Re: [C++] Help with a Database for User Defined Classes"
- Maybe reply: Chris \( Val \): "Re: [C++] Help with a Database for User Defined Classes"
- Maybe reply: Karl Heinz Buchegger: "Re: [C++] Help with a Database for User Defined Classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 21 Dec 2004 15:29:18 +1100
"entropy123" <email_entropy123@yahoo.com> wrote in message
news:1103577782.251492.216930@c13g2000cwb.googlegroups.com...
| Hi All,
|
| Poor 3rd year engineering grad student here. My C++ knowledge is
| effectively limited to inheritance and its not enough to meet the task
| at hand. Would love to hire one of you to do this job; but no cash!
|
| My C++ problem: Too much data, the need to collect various statistics,
| the need to be very flexible, and code that needs to be easily
| maintained and reused.
|
| My current approach: Create a database for each object type along the
| following lines: Items of "Type" go into "Types" which is basically a
| vector of "Type's". Database Types class functions exist for I/O and
| statistics gathering the objects of "Type". I continue this for classes
| Y and Z. Classes Type, Y, and Z all derive from the same base class
| "Datum".
|
| My apparent problem: The "Database" code for Type, Y, and Z are all
| essentially the same, but I need to rewrite the database code for each
| and every user defined object. The database code sounds like a case for
| templates, but there seems to be some rule agains user defined objects
| accessing their functions from within a template. If I want to sort
| "Type" by "name" how can I if I can't access "name" within the
| database? My attempt to derive the Databse for Type (Types) from "Data"
| also doesn't work because I need to declare the vector<Type*> within
| "Data" - virtually the same problem I had with templates.
|
| (1) Templates: Can't use class member functions within a template
| (2) Inheritance: Can't declare a different type of vector in the base
| class
|
| Solutions: I am open to anything. Is there a better design philosophy
| to which I may adhere? I have about 10 user defined classes which all
| have at least some degree of interrelationship which I would like to
| capture.
[snip]
To provide you with assistance, you first need to assist us.
Your description is very obscure - Discussing 'Type', 'Types',
'Y' and 'Z' don't really help too much.
Can you provide in code (Just a skeleton hierarchy, with better
chosen names, and only one data member and one member function
in each class, defined in-line (in the class)), to illustrate
the problem ?
It's not that hard do present it in such a way, is it ?
Once we can properly establish your needs, we can move forward
from there, but you can't expect us to wade through something
that is so obscurely described to begin with, and come up with
reasonable advice - Well, at least I cant :-)
Cheers.
Chris Val
- Next message: Ulrich Eckhardt: "Re: Asigning to char *"
- Previous message: Chris \( Val \): "Re: [OT] Critical section ?"
- Next in thread: B. v Ingen Schenau: "Re: [C++] Help with a Database for User Defined Classes"
- Maybe reply: B. v Ingen Schenau: "Re: [C++] Help with a Database for User Defined Classes"
- Maybe reply: Chris \( Val \): "Re: [C++] Help with a Database for User Defined Classes"
- Maybe reply: Karl Heinz Buchegger: "Re: [C++] Help with a Database for User Defined Classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|