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