comp.lang.ada
 help / color / mirror / Atom feed
* Reading objects from a file
@ 1997-04-15  0:00 Paul Sjoerdsma
  1997-04-15  0:00 ` Paul Sjoerdsma
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Sjoerdsma @ 1997-04-15  0:00 UTC (permalink / 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 will
--------------------------------------
Paul Sjoerdsma
Managing Director
Straight Line Solutions Co. Ltd.
Bangkok-Chiang Rai, Thailand
email: paulg@loxinfo.co.th
http://www.loxinfo.co.th/~paulg/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading objects from a file
  1997-04-15  0:00 Paul Sjoerdsma
@ 1997-04-15  0:00 ` Paul Sjoerdsma
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Sjoerdsma @ 1997-04-15  0:00 UTC (permalink / raw)



paulg@loxinfo.co.th (Paul Sjoerdsma) wrote:

  >Hi,
  >
  >I'm just starting using Ada and I have a, hopefully simple, question.
  >
  >First 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 will

I posted the previous message while it wasn't finished. Here is the
rest.

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.

regards
Paul




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Reading objects from a file
@ 1997-04-18  0:00 Paul Sjoerdsma
  1997-04-19  0:00 ` Michael Paus
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Sjoerdsma @ 1997-04-18  0:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading objects from a file
  1997-04-18  0:00 Reading objects from a file Paul Sjoerdsma
@ 1997-04-19  0:00 ` Michael Paus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Paus @ 1997-04-19  0:00 UTC (permalink / raw)



Hi,

Ada 95 stream-oriented attributes are exactly what you are looking for.
Have a look at RM(13.13) and RM(A.12).

Michael

-- 
------------------------------------------------------------------------
--Dr.-Ing. Michael Paus   (Member: Team Ada)
--University of Stuttgart, Inst. of Flight Mechanics and Flight Control
--Forststrasse 86, 70176 Stuttgart, Germany
--Phone: (+49) 711-121-1434  FAX: (+49) 711-634856
--Email: Michael.Paus@ifr.luftfahrt.uni-stuttgart.de (NeXT-Mail welcome)





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-04-19  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-18  0:00 Reading objects from a file Paul Sjoerdsma
1997-04-19  0:00 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox