comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal Obry <pascal@obry.net>
To: ytomino <aghia05@gmail.com>
Subject: Re: Question: dynamic rename?
Date: Sat, 03 Sep 2011 15:22:25 +0200
Date: 2011-09-03T15:22:25+02:00	[thread overview]
Message-ID: <4E622A11.5030403@obry.net> (raw)
In-Reply-To: <0629faf5-21ff-40ea-8fce-5fa8e7e91e51@p25g2000pri.googlegroups.com>

Le 03/09/2011 14:27, ytomino a �crit :
> If signal_one and signal_two are (aliased) variable,
>
> function signal_ref return access signal_type is
> begin
>     case configuration is
>        when one =>  return signal_one'Access;
>        when two =>  return signal_two'Access;
>     end case;
> end signal_ref;
>
> signal : signal_type renames signal_ref.all;

Or using a case expression in Ada 2012:

    Signal : Signal_Type :=
               (case Configuration is
                   when One => Signal_One,
                   when Two => Signal_Two);

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B




  reply	other threads:[~2011-09-03 13:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03  2:28 Question: dynamic rename? Darkwing
2011-09-03  8:03 ` Dmitry A. Kazakov
2011-09-03 10:04   ` Simon Wright
2011-09-03 10:47     ` Dmitry A. Kazakov
2011-09-03 12:27 ` ytomino
2011-09-03 13:22   ` Pascal Obry [this message]
2011-09-04  3:11     ` Darkwing
2011-09-04  8:43       ` Pascal Obry
2011-09-07 16:35         ` Anh Vo
replies disabled

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