1. pragma Ada_2012; 
  2. --  (c) Copyright, Real-Time Innovations, $Date:: 2012-02-16 #$ 
  3. --  All rights reserved. 
  4. -- 
  5. --  No duplications, whole or partial, manual or electronic, may be made 
  6. --  without express written permission.  Any such copies, or 
  7. --  revisions thereof, must display this notice unaltered. 
  8. --  This code contains trade secrets of Real-Time Innovations, Inc. 
  9.  
  10. with DDS; 
  11. with DDS.DomainParticipant; 
  12. with DDS.TypeSupport; 
  13. with DDS.MetpTypeSupport_None; 
  14. with DDS.DataReader; 
  15. with DDS.DataWriter; 
  16. with Ada.Unchecked_Conversion; 
  17. with Interfaces.C.Pointers; 
  18. with Interfaces.C; 
  19. with DDS.Treats_Generic; 
  20. --  <defgroup>OctetsBuiltInTypeGroupDocs</defgroup> 
  21. --  <dref>OctetsTypeSupport</dref> 
  22. package DDS.Builtin_Octets_TypeSupport is 
  23.  
  24.    type Ref is new Standard.DDS.TypeSupport.Ref with null record; 
  25.    type Ref_Access is access all Ref'Class; 
  26.  
  27.    function Create_TypedDataReaderI 
  28.      (Self : access Ref) return Standard.DDS.DataReader.Ref_Access; 
  29.  
  30.    procedure Destroy_TypedDataReaderI 
  31.      (Self   : access Ref; 
  32.       Reader : in out Standard.DDS.DataReader.Ref_Access); 
  33.  
  34.    function Create_TypedDataWriterI 
  35.      (Self : access Ref) return Standard.DDS.DataWriter.Ref_Access; 
  36.  
  37.    procedure Destroy_TypedDataWriterI 
  38.      (Self   : access Ref; 
  39.       Writer : in out Standard.DDS.DataWriter.Ref_Access) is null; 
  40.  
  41.    --  <internal> 
  42.    --  static methods 
  43.    --  </internal> 
  44.  
  45.    procedure Register_Type 
  46.      (Participant : not null access Standard.DDS.DomainParticipant.Ref'Class; 
  47.       Type_Name   : in Standard.DDS.String); 
  48.    --  <dref>OctetsTypeSupport_register_type</dref> 
  49.  
  50.    procedure Unregister_Type 
  51.      (Participant : not null access Standard.DDS.DomainParticipant.Ref'Class; 
  52.       Type_Name   : in Standard.DDS.String); 
  53.    --  <dref>OctetsTypeSupport_unregister_type</dref> 
  54.  
  55.    function Get_Type_Name return Standard.DDS.String; 
  56.    --  <dref>OctetsTypeSupport_get_type_name</dref> 
  57.  
  58.    procedure Print_Data (A_Data : access DDS.Octets); 
  59.    --  <dref>OctetsTypeSupport_print_data</dref> 
  60.  
  61.    function Create_Data_W_Size 
  62.      (Size : Integer) 
  63.       return DDS.Octets_Ptr; 
  64.  
  65.    procedure Initialize_Data_W_Size 
  66.      (A_Data : access DDS.Octets; 
  67.       Size   : Integer); 
  68.  
  69.    function From_Octets_To_Octet_Array 
  70.      (Octets : DDS.Octets) 
  71.       return DDS.Octet_Array; 
  72.  
  73.    function Get_Octet 
  74.      (Octets : DDS.Octets; 
  75.       Index  : Integer) 
  76.       return Interfaces.Unsigned_8; 
  77.  
  78.    --  <internal> 
  79.    --  Methods to translate from low to high level and backward 
  80.    --  </internal> 
  81.  
  82.    package Octet_Pointer is new Interfaces.C.Pointers 
  83.      (Natural, 
  84.       DDS.Octet, 
  85.       DDS.Octet_Array, 
  86.       0); 
  87.  
  88.    type Octet_Access is access all Interfaces.Unsigned_8; 
  89.    function ConvertToAccess is new Ada.Unchecked_Conversion (System.Address, Octet_Access); 
  90.    function ConvertToPointer is new Ada.Unchecked_Conversion (Octet_Access, Octet_Pointer.Pointer); 
  91.    function ConvertToPointerDiff  (Source : Integer) return Interfaces.C.Ptrdiff_T; 
  92.    pragma Inline (ConvertToPointerDiff); 
  93.  
  94.  
  95.    package Treats is new 
  96.      DDS.Treats_Generic (Data_Type        => DDS.Octets, 
  97.                          Data_Type_Access => DDS.Octets_Ptr, 
  98.                          Index_Type       => Natural, 
  99.                          First_Element    => 1, 
  100.                          Data_Array       => DDS.Octets_Array, 
  101.                          Initialize       => Initialize, 
  102.                          Finalize         => Finalize, 
  103.                          Copy             => Copy, 
  104.                          Data_Sequences   => DDS.Octets_Seq, 
  105.                          Get_Type_Name    => Get_Type_Name, 
  106.                          TypeSupport      => Ref, 
  107.                          MetpTypeSupport  => DDS.MetpTypeSupport_None.Ref); 
  108.  
  109.    procedure Get_Type_Name (Name : out Standard.DDS.String); 
  110.  
  111.  
  112. end DDS.Builtin_Octets_TypeSupport;