comp.lang.ada
 help / color / mirror / Atom feed
* access attributes from record
@ 2007-11-12 20:49 Dominik Fässler
  2007-11-12 21:18 ` Adam Beneschan
  2007-11-12 23:25 ` Niklas Holsti
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Fässler @ 2007-11-12 20:49 UTC (permalink / raw)


Hi

Is it possible to determine the 'Length of a record, loop
it an get attribute name/value/type?

Best regards,
Dominik



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

* Re: access attributes from record
  2007-11-12 20:49 access attributes from record Dominik Fässler
@ 2007-11-12 21:18 ` Adam Beneschan
  2007-11-13  5:44   ` Dominik Fässler
  2007-11-12 23:25 ` Niklas Holsti
  1 sibling, 1 reply; 5+ messages in thread
From: Adam Beneschan @ 2007-11-12 21:18 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 498 bytes --]

On Nov 12, 12:49 pm, Dominik Fässler <d.faess...@ambf.ch> wrote:
> Hi
>
> Is it possible to determine the 'Length of a record, loop
> it an get attribute name/value/type?

I can't speak for the others on this group---but personally, I have no
idea what you're talking about.  It might help if you give us an
example of what you're trying to accomplish; even if you write it in
pseudo-Ada code that isn't really Ada at all, it would still help.

                           -- Adam




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

* Re: access attributes from record
  2007-11-12 20:49 access attributes from record Dominik Fässler
  2007-11-12 21:18 ` Adam Beneschan
@ 2007-11-12 23:25 ` Niklas Holsti
  2007-11-13  5:51   ` Dominik Fässler
  1 sibling, 1 reply; 5+ messages in thread
From: Niklas Holsti @ 2007-11-12 23:25 UTC (permalink / raw)


Dominik F�ssler wrote:
> Hi
> 
> Is it possible to determine the 'Length of a record, loop
> it an get attribute name/value/type?

If I understand your question correctly, you have a record type (or 
an object of a record type) and you want to write a loop that 
traverses the record's components, one by one from the first to the 
last, and somehow learns the name, type, and value of each 
component? A bit as if the record were an array, and you were 
traversing over the elements of the array, but in the record case 
the components have names instead of array indices, and may have 
different types?

You cannot do this within you Ada application itself, but you can 
do something similar (at least for component names and types, but 
not for values) by means of the Ada Semantic Interface Standard 
(ASIS), in a metaprogramming fashion. That is, you pass the Ada 
record definition (embedded in a compilable Ada program) to an 
ASIS-enabled Ada compiler such as GNAT, which produces an ASIS 
data-base, and then you write a second Ada (meta-)program to query 
the ASIS data-base for the record structure. But as this is 
meta-programming (not reflective programming) you only have access 
to static type information, not to dynamic values.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



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

* Re: access attributes from record
  2007-11-12 21:18 ` Adam Beneschan
@ 2007-11-13  5:44   ` Dominik Fässler
  0 siblings, 0 replies; 5+ messages in thread
From: Dominik Fässler @ 2007-11-13  5:44 UTC (permalink / raw)


Hi

> I can't speak for the others on this group---but personally, I have no
> idea what you're talking about.  It might help if you give us an
> example of what you're trying to accomplish; even if you write it in
> pseudo-Ada code that isn't really Ada at all, it would still help.

Sorry for my bad description. It is exactly what Niklas describes
in the other post.

Best regards,
Dominik



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

* Re: access attributes from record
  2007-11-12 23:25 ` Niklas Holsti
@ 2007-11-13  5:51   ` Dominik Fässler
  0 siblings, 0 replies; 5+ messages in thread
From: Dominik Fässler @ 2007-11-13  5:51 UTC (permalink / raw)


Hi

That's exactly what I meant. Under these circumstances I will
give attention to 'Write/'Output.

Thank you very much for your detailed description.

Best regards,
Dominik



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

end of thread, other threads:[~2007-11-13  5:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-12 20:49 access attributes from record Dominik Fässler
2007-11-12 21:18 ` Adam Beneschan
2007-11-13  5:44   ` Dominik Fässler
2007-11-12 23:25 ` Niklas Holsti
2007-11-13  5:51   ` Dominik Fässler

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