comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Dowie" <martin.dowie@btopenworld.com>
Subject: Re: Idiom for a class and an object in Ada
Date: Tue, 19 Oct 2004 14:51:44 +0000 (UTC)
Date: 2004-10-19T14:51:44+00:00	[thread overview]
Message-ID: <cl39m0$erp$1@titan.btinternet.com> (raw)
In-Reply-To: pj8dd.2353$ta5.438@newsread3.news.atl.earthlink.net

Marin David Condic wrote:
> Interesting, but I think it misses my question. In your first package:
> General_Classes - if you had 5 specific objects of type Class and they
> are totally static (something that exists from the moment you hit the
> first instruction to the moment the power goes down and you *really*
> need them to be in global memory) - where would you declare the five
> objects of type "Class" as you've defined it?
>
> How to do it is simple:
>
> Object_1 : General_Classes.Class ;
> Object_2 : General_Classes.Class ;
> Object_3 : General_Classes.Class ;
> Object_4 : General_Classes.Class ;
> Object_5 : General_Classes.Class ;
>
> In what context would you put those objects?

Inside a package body with access routines. These routines tend to be the 
project-specific ones. They /may/ be portable to other systems but are less 
likely to be portable than a class that models the behaviour of those types 
of registers. But in your 5 A-D examples, and assuming that the 5 A-D were 
on a particular device, I would consider make the package name the device 
name.

If there was some issue with having to assign the registers into a 
processors particular area of memory that couldn't be done via an address 
clause but could only be done via a compiler/linker command, then I have 
separated out the data items into their own package spec - to avoid the 
access routines also being mapped into that area. The package names were 
suffixed "_GD" (for Global Data) and the coding rules were that only the 
package without the "_GD" could 'with' them and then only from the package 
body.

-- Martin






  reply	other threads:[~2004-10-19 14:51 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-18 11:47 Idiom for a class and an object in Ada Marin David Condic
2004-10-18 12:14 ` Martin Krischik
2004-10-18 19:40   ` Matthew Heaney
2004-10-19 12:59   ` Marin David Condic
2004-10-19 14:46     ` Martin Dowie
2004-10-19 15:55       ` Matthew Heaney
2004-10-19 18:31         ` Martin Dowie
2004-10-19 15:52     ` Matthew Heaney
2004-10-18 12:26 ` Marius Amado Alves
2004-10-19  2:09   ` Jeffrey Carter
2004-10-19  3:28     ` Matthew Heaney
2004-10-19 12:53       ` Marin David Condic
2004-10-19 14:44         ` Matthew Heaney
2004-10-19 15:01           ` Dmitry A. Kazakov
2004-10-19 15:40             ` Matthew Heaney
2004-10-20  7:58               ` Dmitry A. Kazakov
2004-10-20 12:31                 ` Marin David Condic
2004-10-20 13:53                   ` Dmitry A. Kazakov
2004-10-20 15:23                   ` Matthew Heaney
2004-10-21 12:24                     ` Marin David Condic
2004-10-21 17:15                       ` Matthew Heaney
2004-10-20  5:39         ` Simon Wright
2004-10-20  7:24           ` Matthew Heaney
2004-10-20  8:39             ` Dmitry A. Kazakov
2004-10-21  1:36             ` Jeffrey Carter
2004-10-21  1:46               ` Matthew Heaney
2004-10-21  7:51                 ` Dmitry A. Kazakov
2004-10-21 12:45                   ` Matthew Heaney
2004-10-21 14:11                     ` Dmitry A. Kazakov
2004-10-22  1:04                 ` Jeffrey Carter
2004-10-22  1:36                   ` Matthew Heaney
2004-10-21 19:31               ` Kevin Cline
2004-10-21 22:02                 ` Matthew Heaney
2004-10-22  0:10                   ` Matthew Heaney
2004-10-21  8:25             ` Martin Dowie
2004-10-20 17:04           ` Matthew Heaney
2004-10-20 19:37             ` Simon Wright
2004-10-20 20:04               ` Matthew Heaney
2004-10-22  5:37                 ` Simon Wright
2004-10-20  1:10       ` Jeffrey Carter
2004-10-20  7:04         ` Matthew Heaney
2004-10-20 12:42           ` Marin David Condic
2004-10-20 12:55             ` Matthew Heaney
2004-10-20 15:27             ` Matthew Heaney
2004-10-21  1:36               ` Matthew Heaney
2004-10-19 12:38   ` Marin David Condic
2004-10-18 16:59 ` Matthew Heaney
2004-10-18 18:02 ` Martin Dowie
2004-10-19 13:06   ` Marin David Condic
2004-10-19 14:51     ` Martin Dowie [this message]
2004-10-20 16:20 ` Michael Paus
2004-10-20 17:15   ` Matthew Heaney
2004-10-20 17:55     ` Michael Paus
2004-10-21 12:33   ` Marin David Condic
  -- strict thread matches above, loose matches on Subject: below --
2004-10-21 13:59 Stephen Leake
replies disabled

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