1. pragma Ada_2012; 
  2.  
  3. with RTIDDS.Low_Level.ndds_mig_mig_rtps_h; 
  4. with Interfaces.C; 
  5. package DDS.Ximages  is 
  6.    use Interfaces.C; 
  7.  
  8.    function Image (Item : DDS.SampleFlag) return Standard.String is (Item'Img); 
  9.    function Image (Item : DDS.Boolean) return Standard.String is (Item'Img); 
  10.    function Image (Item : DDS.Short) return Standard.String is (Item'Img); 
  11.    function Image (Item : DDS.Unsigned_Short) return Standard.String is (Item'Img); 
  12.    function Image (Item : DDS.Long) return Standard.String is (Item'Img); 
  13.    function Image (Item : DDS.Long_Long) return Standard.String is (Item'Img); 
  14.    function Image (Item : DDS.Unsigned_Long) return Standard.String is (Item'Img); 
  15.    function Image (Item : DDS.Unsigned_Long_Long) return Standard.String is (Item'Img); 
  16.    function Image (Item : DDS.Enum) return Standard.String is (Item'Img); 
  17.    function Image (Item : DDS.Float) return Standard.String is (Item'Img); 
  18.    function Image (Item : DDS.Double) return Standard.String is (Item'Img); 
  19.    function Image (Item : DDS.String) return Standard.String is (To_Standard_String (Item)); 
  20.  
  21.    function Image (Item : DDS.SampleLostStatusKind) return Standard.String is 
  22.      (case Item is 
  23.          when DDS.NOT_LOST                                              => "NOT_LOST", 
  24.          when DDS.LOST_BY_WRITER                                        => "WRITER", 
  25.          when DDS.LOST_BY_INSTANCES_LIMIT                               => "INSTANCES", 
  26.          when DDS.LOST_BY_REMOTE_WRITERS_PER_INSTANCE_LIMIT             => "REMOTE_WRITERS_PER_INSTANCE", 
  27.          when DDS.LOST_BY_INCOMPLETE_COHERENT_SET                       => "INCOMPLETE_COHERENT_SET", 
  28.          when DDS.LOST_BY_LARGE_COHERENT_SET                            => "LARGE_COHERENT_SET", 
  29.          when DDS.LOST_BY_SAMPLES_PER_REMOTE_WRITER_LIMIT               => "SAMPLES_PER_REMOTE_WRITER", 
  30.          when DDS.LOST_BY_VIRTUAL_WRITERS_LIMIT                         => "VIRTUAL_WRITERS", 
  31.          when DDS.LOST_BY_REMOTE_WRITERS_PER_SAMPLE_LIMIT               => "REMOTE_WRITERS_PER_SAMPLE", 
  32.          when DDS.LOST_BY_AVAILABILITY_WAITING_TIME                     => "AVAILABILITY_WAITING_TIME", 
  33.          when DDS.LOST_BY_REMOTE_WRITER_SAMPLES_PER_VIRTUAL_QUEUE_LIMIT => "REMOTE_WRITER_SAMPLES_PER_VIRTUAL_QUEUE", 
  34.          when others                                                    => "lost_by_unkown_reason"); 
  35.    function Image (Item : DDS.SampleLostStatus) return Standard.String is 
  36.      ("(Total_Count => " & Image (Item.Total_Count) & 
  37.          "Total_Count_Change => " &  Image (Item.Total_Count_Change) & 
  38.          "Last_Reason =>" & Image (Item.Last_Reason) & ")"); 
  39.  
  40.  
  41.    type SampleInfoField is (Sample_State, 
  42.                             View_State, 
  43.                             Instance_State, 
  44.                             Source_Timestamp, 
  45.                             Instance_Handle, 
  46.                             Publication_Handle, 
  47.                             Disposed_Generation_Count, 
  48.                             No_Writers_Generation_Count, 
  49.                             Sample_Rank, 
  50.                             Generation_Rank, 
  51.                             Absolute_Generation_Rank, 
  52.                             Valid_Data, 
  53.                             Reception_Timestamp, 
  54.                             Publication_Sequence_Number, 
  55.                             Reception_Sequence_Number, 
  56.                             Publication_Virtual_Guid, 
  57.                             Publication_Virtual_Sequence_Number, 
  58.                             Original_Publication_Virtual_Guid, 
  59.                             Original_Publication_Virtual_Sequence_Number, 
  60.                             Related_Original_Publication_Virtual_Guid, 
  61.                             Related_Original_Publication_Virtual_Sequence_Number, 
  62.                             Flag, 
  63.                             Source_Guid, 
  64.                             Related_Source_Guid, 
  65.                             Related_Subscription_Guid, 
  66.                             Topic_Query_Guid, 
  67.                             Sample_Info_Hash, 
  68.                             Sample_Signature); 
  69.    type SampleInfoFields is array (SampleInfoField) of Boolean; 
  70.  
  71.    function Image (Item : DDS.SampleStateKind) return Standard.String is 
  72.      (case Item is 
  73.          when DDS.READ_SAMPLE_STATE     => "READ", 
  74.          when DDS.NOT_READ_SAMPLE_STATE => "NOT_READ", 
  75.          when DDS.ANY_SAMPLE_STATE      => "ANY", 
  76.          when others                    => "UNKOWMN"); 
  77.  
  78.    function Image (Item : DDS.ViewStateKind) return Standard.String is 
  79.      (case Item is 
  80.          when DDS.NEW_VIEW_STATE        => "NEW", 
  81.          when DDS.NOT_NEW_VIEW_STATE    => "NOT_NEW", 
  82.          when DDS.ANY_VIEW_STATE        => "ANY", 
  83.          when others                    => "UNKOWMN_VIWE_STATE"); 
  84.  
  85.    function Image (Item : DDS.InstanceStateKind) return Standard.String is 
  86.      (case Item is 
  87.          when DDS.ALIVE_INSTANCE_STATE                     => "ALIVE", 
  88.          when DDS.NOT_ALIVE_DISPOSED_INSTANCE_STATE        => "NOT_ALIVE_DISPOSED", 
  89.          when DDS.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE      => "NOT_ALIVE_NO_WRITERS", 
  90.          when DDS.NOT_ALIVE_INSTANCE_STATE                 => "NOT_ALIVE", 
  91.          when DDS.ANY_INSTANCE_STATE                       => "ANY", 
  92.          when others                                       => "UNKOWMN"); 
  93.  
  94.    function Image (Item : DDS.Time_T) return Standard.String is (Image (Item.Sec) & "." & Image (Item.Nanosec)); 
  95.    function Image (Item : DDS.SequenceNumber_T) return Standard.String is (Image (Item.High) & "." & Image (Item.Low)); 
  96.  
  97.    function Image (Item : RTIDDS.Low_Level.ndds_mig_mig_rtps_h.MIGRtpsKeyHash) return Standard.String; 
  98.    pragma Warnings (Off); 
  99.    function Image (Item : RTIDDS.Low_Level.ndds_osapi_osapi_hash_h.RTIOsapiHash) return Standard.String is ("RTIOsapiHash<UNIMPLEMENTED>"); 
  100.  
  101.    function Image (Item : RTIDDS.Low_Level.ndds_pres_pres_common_impl_h.PRESSampleSignature) return Standard.String is ("PRESSampleSignature<UNIMPLEMENTED>"); 
  102.  
  103.    function Image (Item : DDS.InstanceHandle_T) return Standard.String is (if Item.isValid /= 0 then Image (Item.keyHash) else "<INVALID_HANDLE>"); 
  104.    function Image (Item : DDS.Guid_T) return Standard.String is ("Guid_T<UNIMPLEMENTED>"); 
  105.    pragma Warnings (on); 
  106.  
  107.  
  108.    function Image (Item : DDS.SampleInfo; Fields : SampleInfoFields := (others => True)) return Standard.String is 
  109.      ((if Fields (Sample_State) then " Sample_State =>" & Image (Item.Sample_State) else "") & 
  110.       (if Fields (View_State) then " View_State =>" & Image (Item.View_State) else "") & 
  111.       (if Fields (Instance_State) then " Instance_State =>" & Image (Item.Instance_State) else "") & 
  112.       (if Fields (Source_Timestamp) then " Source_Timestamp =>" & Image (Item.Source_Timestamp) else "") & 
  113.       (if Fields (Instance_Handle) then " Instance_Handle =>" & Image (Item.Instance_Handle) else "") & 
  114.       (if Fields (Publication_Handle) then " Publication_Handle =>" & Image (Item.Publication_Handle) else "") & 
  115.       (if Fields (Disposed_Generation_Count) then " Disposed_Generation_Count =>" & Image (Item.Disposed_Generation_Count) else "") & 
  116.       (if Fields (No_Writers_Generation_Count) then " No_Writers_Generation_Count =>" & Image (Item.No_Writers_Generation_Count) else "") & 
  117.       (if Fields (Sample_Rank) then " Sample_Rank =>" & Image (Item.Sample_Rank) else "") & 
  118.       (if Fields (Generation_Rank) then " Generation_Rank =>" & Image (Item.Generation_Rank) else "") & 
  119.       (if Fields (Absolute_Generation_Rank) then " Absolute_Generation_Rank =>" & Image (Item.Absolute_Generation_Rank) else "") & 
  120.       (if Fields (Valid_Data) then " Valid_Data =>" & Image (Item.Valid_Data) else "") & 
  121.       (if Fields (Reception_Timestamp) then " Reception_Timestamp =>" & Image (Item.Reception_Timestamp) else "") & 
  122.       (if Fields (Publication_Sequence_Number) then " Publication_Sequence_Number =>" & Image (Item.Publication_Sequence_Number) else "") & 
  123.       (if Fields (Reception_Sequence_Number) then " Reception_Sequence_Number =>" & Image (Item.Reception_Sequence_Number) else "") & 
  124.       (if Fields (Publication_Virtual_Guid) then (" Publication_Virtual_Guid =>" & Standard.String'(Image (Item.Publication_Virtual_Guid))) else "") & 
  125.       (if Fields (Publication_Virtual_Sequence_Number) then " Publication_Virtual_Sequence_Number =>" & Image (Item.Publication_Virtual_Sequence_Number) else "") & 
  126.       (if Fields (Original_Publication_Virtual_Guid) then " Original_Publication_Virtual_Guid =>" & Standard.String'(Image (Item.Original_Publication_Virtual_Guid)) else "") & 
  127.       (if Fields (Original_Publication_Virtual_Sequence_Number) then " Original_Publication_Virtual_Sequence_Number =>" & Image (Item.Original_Publication_Virtual_Sequence_Number) else "") & 
  128.       (if Fields (Related_Original_Publication_Virtual_Guid) then " Related_Original_Publication_Virtual_Guid =>" & Standard.String'(Image (Item.Related_Original_Publication_Virtual_Guid)) else "") & 
  129.       (if Fields (Related_Original_Publication_Virtual_Sequence_Number) then " Related_Original_Publication_Virtual_Sequence_Number =>" & Image (Item.Related_Original_Publication_Virtual_Sequence_Number) else "") & 
  130.       (if Fields (Flag) then " Flag =>" & Image (Item.Flag) else "") & 
  131.       (if Fields (Source_Guid) then " Source_Guid =>" & Standard.String'(Image (Item.Source_Guid)) else "") & 
  132.       (if Fields (Related_Source_Guid) then " Related_Source_Guid =>" & Standard.String'(Image (Item.Related_Source_Guid)) else "") & 
  133.       (if Fields (Related_Subscription_Guid) then " Related_Subscription_Guid =>" & Standard.String'(Image (Item.Related_Subscription_Guid)) else "") & 
  134.       (if Fields (Topic_Query_Guid) then " Topic_Query_Guid =>" & Standard.String'(Image (Item.Topic_Query_Guid)) else "") & 
  135.       (if Fields (Sample_Info_Hash) then " Sample_Info_Hash =>" & Image (Item.Sample_Info_Hash) else "") & 
  136.       (if Fields (Sample_Signature) then " Sample_Signature =>" & Standard.String'(Image (Item.Sample_Signature.all)) else "")); 
  137.  
  138. end DDS.Ximages;