From: paulg@loxinfo.co.th (Paul Sjoerdsma)
Subject: Reading objects from a file
Date: 1997/04/18
Date: 1997-04-18T00:00:00+00:00 [thread overview]
Message-ID: <335837a9.11747231@news.loxinfo.co.th> (raw)
Hi,
I'm just starting using Ada and I have a, hopefully simple, question.
=46irst I'll explain what I am trying to do:
I am rewriting a simple visualization program, which is used to output
geological (actually micro-paleontological) data. The program needs to
read frequence curves, process the data and output files.
The data structures used (for the graphics part) will look something
like:
Graphic_Elem (base class)
-- Line_Elem (child class)
-- Polyline_Elem (child class)
-- Solid_Elem (child class)
etc
The output would go tho=20
Graphic_Port (base class)
Dxf_port (child class)
Ascii_port (child class)
There will also be a class Figure
procedure Add(Figure, Graphic_Elem)
procedure Draw(Figure, Graphic_Port)
What I am looking for are methods for the Figure class
procedure Read
procedure Write
in such a way that invoking Read(Figure) will build the appropriate
structure. So when it encounters a saved Line_Elem in the file it will
invoke the read procedure associated with the Line_Elem.
I know that one way of doing it would be to write out a unique
identifier as part of each Graphic_Elem and in Read(Figure) use a case
statement. The problem is than that the knowledge about the different
Graphic_Elem children is hardcoded in the Figure class. Can this be
avoided?
regards
Paul
next reply other threads:[~1997-04-18 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-04-18 0:00 Paul Sjoerdsma [this message]
1997-04-19 0:00 ` Reading objects from a file Michael Paus
-- strict thread matches above, loose matches on Subject: below --
1997-04-15 0:00 Paul Sjoerdsma
1997-04-15 0:00 ` Paul Sjoerdsma
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox