comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: How discriminants interplay with derived tagged types?
Date: Mon, 27 Nov 2017 01:00:28 +0200
Date: 2017-11-27T01:00:28+02:00	[thread overview]
Message-ID: <ovfh2i$127m$1@gioia.aioe.org> (raw)

Below three is a fragment of my real code.

It uses both discriminants and derived tagged types. I am not sure I well 
understand how they interplay.

Please explain how discriminants and derived tagged types interplay.


with Ada.Containers.Indefinite_Holders;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

package Boiler.RDF_Format.Resource is

   type Script_Kind_Enum is (Transformer, Validator);

   type Transformer_Kind_Enum is (Entire, Sequential, Up_Down, Down_Up);

   type Validator_Kind_Enum is (Entire, Parts);

   package String_Holder is new Ada.Containers.Indefinite_Holders(String);

   type Script_Info (Script_Kind: Script_Kind_Enum) is tagged
      record
         Completeness, Stability, Preference: Long_Float; -- or better just 
Float?
         -- TODO: Distinguishing transformer and validator scripts does not 
conform to the specification
         case Script_Kind is
            when Transformer =>
               Transformer_Kind: Transformer_Kind_Enum;
            when Validator =>
               Validator_Kind  : Validator_Kind_Enum;
         end case;
      end record;

   type Command_Script_Info is new Script_Info with
      record
         Language: URI_Type;
         Min_Version, Max_Version: String_Holder.Holder;
         Script_URL:     String_Holder.Holder;
         Command_String: String_Holder.Holder;
         OK_Result: String_Holder.Holder;
      end record;

   type Web_Service_Script_Info is new Script_Info with
      record
         Action: RDF.Redland.URI.URI_Type;
         Method: Unbounded_String;
         XML_Field: Unbounded_String;
      end record;

end Boiler.RDF_Format.Resource;


-- 
Victor Porton - http://portonvictor.org

             reply	other threads:[~2017-11-26 23:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26 23:00 Victor Porton [this message]
2017-11-27  8:32 ` How discriminants interplay with derived tagged types? Dmitry A. Kazakov
2017-11-28  1:57 ` Randy Brukardt
2017-11-28 18:44 ` AdaMagica
replies disabled

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