comp.lang.ada
 help / color / mirror / Atom feed
* How discriminants interplay with derived tagged types?
@ 2017-11-26 23:00 Victor Porton
  2017-11-27  8:32 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Victor Porton @ 2017-11-26 23:00 UTC (permalink / 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

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

end of thread, other threads:[~2017-11-28 18:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-26 23:00 How discriminants interplay with derived tagged types? Victor Porton
2017-11-27  8:32 ` Dmitry A. Kazakov
2017-11-28  1:57 ` Randy Brukardt
2017-11-28 18:44 ` AdaMagica

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