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.  
  10. with DDS.DataReader; 
  11. with DDS.DataReader_Impl; 
  12. with DDS.ReadCondition; 
  13.  
  14. with RTIDDS.Low_Level.dds_c.infrastructure_h;    use RTIDDS.Low_Level.dds_c.infrastructure_h; 
  15. with Ada.Unchecked_Conversion; 
  16. with DDS.Treats_Generic; pragma Elaborate (DDS.Treats_Generic); 
  17. generic 
  18.    with package Treats is new DDS.Treats_Generic (<>); 
  19.    use Treats; 
  20. package DDS.Typed_DataReader_Generic is 
  21.    pragma Suppress (Elaboration_Check); 
  22.  
  23.    type Ref is new DDS.DataReader_Impl.Ref with null record; 
  24.    type Ref_Access is access all Ref; 
  25.  
  26.  
  27.    type Element_Type is record 
  28.       Data        : Data_Type_Access; 
  29.       Sample_Info : SampleInfo_Access; 
  30.    end record; 
  31.    type Cursor is new DDS.Natural; 
  32.  
  33.  
  34.    type Container (<>) is limited new Ada.Finalization.Limited_Controlled with private with 
  35.      Iterable => (First        => I_First_Element, 
  36.                   Element      => I_Get_Element, 
  37.                   Has_Element  => I_Has_Element, 
  38.                   Next         => I_Advance); 
  39.    function I_First_Element (Self : Container) return Cursor; 
  40.    function I_Advance (Self : Container; C : Cursor) return Cursor; 
  41.    function I_Has_Element (Self : Container; C : Cursor) return Standard.Boolean; 
  42.    function I_Get_Element (Self : Container; C : Cursor) return Element_Type; 
  43.  
  44.    --  This is only to simplify the iteration over the read data 
  45.    --   procedure On_Data_Available 
  46.    --      (Self       : not null access Ref; 
  47.    --       The_Reader : in DataReader_Access is 
  48.    --   begin 
  49.    --      for E of Ref (The_Reader).{Read|Take|..} do 
  50.    --         Process (E.Data, E.Sample_Info); 
  51.    --      end loop; 
  52.    --   end; 
  53.  
  54.  
  55.    procedure Read 
  56.      (Self            : not null access Ref; 
  57.       Received_Data   : not null access Data_Sequences.Sequence; 
  58.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  59.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  60.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  61.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  62.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  63.    procedure Read 
  64.      (Self            : not null access Ref; 
  65.       Received_Data   : in out  Data_Sequences.Sequence; 
  66.       Info_Seq        : in out  DDS.SampleInfo_Seq.Sequence; 
  67.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  68.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  69.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  70.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  71.    function Read 
  72.      (Self            : not null access Ref; 
  73.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  74.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  75.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  76.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE) return Container'Class; 
  77.    --  <dref>FooDataReader_read</dref> 
  78.    --  <internal> 
  79.    --  Access a collection of data samples from the DDS_DataReader. 
  80.    --  This operation offers the same functionality and API as take except that the 
  81.    --  samples returned remain in the DDS_DataReader such that they can be retrieved 
  82.    --  again by means of a read or take operation. 
  83.    --  Please refer to the documentation of take for details on the number of samples 
  84.    --  returned within the received_data and info_seq as well as the order in which 
  85.    --  the samples appear in these sequences. 
  86.    --  The act of reading a sample changes its sample_state to DDS_READ_SAMPLE_STATE. 
  87.    --  If the sample belongs to the most recent generation of the instance, 
  88.    --  it will also set the view_state of the instance to be DDS_NOT_NEW_VIEW_STATE. 
  89.    --  It will not affect the instance_state of the instance. 
  90.    --  Important: If the samples "returned" by this function are loaned from 
  91.    --  RTI Data Distribution Service (see take for more information on memory loaning), 
  92.    --  it is important that their contents not be changed. 
  93.    --  Because the memory in which the data is stored belongs to the middleware, 
  94.    --  any modifications made to the data will be seen the next time the same samples 
  95.    --  are read or taken; 
  96.    --  the samples will no longer reflect the state that was received from the network. 
  97.    --  </internal> 
  98.  
  99.  
  100.    procedure Take 
  101.      (Self            : not null access Ref; 
  102.       Received_Data   : not null access Data_Sequences.Sequence; 
  103.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  104.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  105.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  106.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  107.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  108.    procedure Take 
  109.      (Self            : not null access Ref; 
  110.       Received_Data   : out Data_Sequences.Sequence; 
  111.       Info_Seq        : out DDS.SampleInfo_Seq.Sequence; 
  112.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  113.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  114.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  115.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  116.  
  117.    function Take 
  118.      (Self            : not null access Ref; 
  119.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  120.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  121.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  122.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE) return Container'Class; 
  123.    --  <dref>FooDataReader_take</dref> 
  124.    --  <internal> 
  125.    --  Access a collection of data-samples from the DataReader. 
  126.    --  The operation will return the list of samples received by the 
  127.    --  DataReader since the last DataReader.take operation that match the 
  128.    --  specified SampleStateMask, ViewStateMask and InstanceStateMask. 
  129.    --  This operation may fail with an exception if 
  130.    --  DataReaderResourceLimitsQosPolicy::max_outstanding_reads limit 
  131.    --  has been exceeded. 
  132.    --  The actual number of samples returned depends on the information that has 
  133.    --  been received by the middleware as well as the HistoryQosPolicy, 
  134.    --  ResourceLimitsQosPolicy, DataReaderResourceLimitsQosPolicy and the 
  135.    --  characteristics of the data-type that is associated with the DataReader: 
  136.    --    * In the case where the HistoryQosPolicy::kind is KEEP_LAST_HISTORY_QOS, 
  137.    --      the call will return at most HistoryQosPolicy::depth samples per instance. 
  138.    --    * The maximum number of samples returned is limited by 
  139.    --       ResourceLimitsQosPolicy::max_samples, and by 
  140.    --       DataReaderResourceLimitsQosPolicy::max_samples_per_read. 
  141.    --    * For multiple instances, the number of samples returned is additionally 
  142.    --      limited by the product 
  143.    --       (ResourceLimitsQosPolicy::max_samples_per_instance * 
  144.    --        ResourceLimitsQosPolicy::max_instances) 
  145.    --    * If DataReaderResourceLimitsQosPolicy::max_infos is limited, 
  146.    --      the number of samples returned may also be limited if insufficient 
  147.    --  SampleInfo resources are available. 
  148.    --  If the read or take succeeds and the number of samples returned has been 
  149.    --  limited (by means of a maximum limit, as listed above, or insufficient 
  150.    --  SampleInfo resources), 
  151.    --  the call will complete successfully and provide those samples the reader 
  152.    --  is able to return. The user may need to make additional calls, 
  153.    --  or return outstanding loaned buffers in the case of insuffificient resources, 
  154.    --  in order to access remaining samples. 
  155.    --  Note that in the case where the Topic associated with the DataReader 
  156.    --  is bound to a data-type that has no key definition, 
  157.    --  then there will be at most one instance in the DataReader. 
  158.    --  So the per-sample limits will apply. 
  159.    --  The act of taking a sample removes it from Data Distribution Service 
  160.    --  so it cannot be read or taken again. 
  161.    --  If the sample belongs to the most recent generation of the instance, 
  162.    --  it will also set the view_state of the sample's instance to NOT_NEW_VIEW_STATE. 
  163.    --  It will not affect the instance_state of the sample's instance. 
  164.    --  After DataReader.take completes, received_data and info_seq will be of 
  165.    --  the same length and contain the received data. 
  166.    --  If the sequences are empty (maximum size equal 0) when the take is called, 
  167.    --  the samples returned in the received_data and the corresponding 
  168.    --  info_seq are 'loaned' to the application from buffers provided by the DataReader. 
  169.    --  The application can use them as desired and has guaranteed exclusive access to them. 
  170.    --  Once the application completes its use of the samples it must 'return the loan' 
  171.    --  to the DataReader by calling the DataReader.return_loan operation. 
  172.    --  Note: 
  173.    --   While you must call Return_Loan at some point, you do not have to do so 
  174.    --   before the next take call. 
  175.    --  However, failure to return the loan will eventually deplete the DataReader 
  176.    --  of the buffers it needs to receive new samples and eventually samples will 
  177.    --  start to be lost. The total number of buffers available to the DataReader 
  178.    --  is specified by the ResourceLimitsQosPolicy and the DataReaderResourceLimitsQosPolicy. 
  179.    --  If the sequences are not empty (maximum size not equal 0) when the take is called, 
  180.    --  samples are copied to received_data and info_seq. The application will not 
  181.    --  need to call return_loan. 
  182.    --  The order of the samples returned to the caller depends on the PresentationQosPolicy. 
  183.    --      * If PresentationQosPolicy::access_scope is INSTANCE_PRESENTATION_QOS, 
  184.    --        the returned collection is a list where samples belonging to the 
  185.    --        same data instance are consecutive. 
  186.    --      * If PresentationQosPolicy::access_scope is TOPIC_PRESENTATION_QOS and 
  187.    --        PresentationQosPolicy::ordered_access is set to BOOLEAN_FALSE, 
  188.    --        then returned collection is a list where samples belonging to 
  189.    --        the same data instance are consecutive. 
  190.    --      * If PresentationQosPolicy::access_scope is TOPIC_PRESENTATION_QOS and 
  191.    --        PresentationQosPolicy::ordered_access is set to TRUE, then the 
  192.    --        returned collection is a list were the relative order of samples is 
  193.    --        preserved also accross different instances. Note that samples belonging 
  194.    --        to the same instance may or may not be consecutive. This is because 
  195.    --        to preserve order it may be necessary to mix samples from different instances. 
  196.    --      * If PresentationQosPolicy::access_scope is GROUP_PRESENTATION_QOS and 
  197.    --           PresentationQosPolicy::ordered_access is set to FALSE, then returned 
  198.    --        collection is a list where samples belonging to the same data instance 
  199.    --        are consecutive. [Not supported (optional)] 
  200.    --      * If PresentationQosPolicy::access_scope is GROUP_PRESENTATION_QOS and 
  201.    --           PresentationQosPolicy::ordered_access is set to TRUE, 
  202.    --        then the returned collection contains at most one sample. 
  203.    --        The difference in this case is due to the fact that is required that 
  204.    --        the application is able to read samples belonging to different DataReader 
  205.    --        objects in a specific order. [Not supported (optional)] 
  206.    --  In any case, the relative order between the samples of one instance is consistent 
  207.    --  with the DESTINATION_ORDER policy: 
  208.    --    * If DestinationOrderQosPolicy::kind is BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS, 
  209.    --      samples belonging to the same instances will appear in the relative order 
  210.    --     in which there were received (FIFO, earlier samples ahead of the later samples). 
  211.    --    * If DestinationOrderQosPolicy::kind is BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS, 
  212.    --      samples belonging to the same instances will appear in the relative order 
  213.    --      implied by the source_timestamp (FIFO, smaller values of source_timestamp 
  214.    --      ahead of the larger values). 
  215.    --  If the DataReader has no samples that meet the constraints, the function 
  216.    --  will fail with exception NO_DATA. 
  217.    --  In addition to the collection of samples, the read and take operations also 
  218.    --   use a collection of SampleInfo structures. 
  219.    --  SEQUENCES USAGE IN TAKE AND READ 
  220.    --  The initial (input) properties of the received_data and info_seq collections 
  221.    --  will determine the precise behavior of the read or take operation. 
  222.    --  For the purposes of this description, the collections are modeled as having 
  223.    --  these properties: 
  224.    --      * whether the collection container owns the memory of the elements 
  225.    --        within (owns, see Seq_has_ownership) 
  226.    --      * the current-length (len, see Seq_get_length) 
  227.    --      * the maximum length (max_len, see Seq_get_maximum) 
  228.    -- 
  229.    --  The initial values of the owns, len and max_len properties for the received_data 
  230.    --  and info_seq collections govern the behavior of the read and take operations 
  231.    --  as specified by the following rules : 
  232.    --   1. The values of owns, len and max_len properties for the two collections must be identical. 
  233.    --      Otherwise read/take will fail with PRECONDITION_NOT_MET. 
  234.    --   2. On successful output, the values of owns, len and max_len 
  235.    --      will be the same for both collections. 
  236.    --   3. If the initial max_len==0, then the received_data and info_seq 
  237.    --      collections will be filled with elements that are loaned by the DataReader. 
  238.    --      On output, owns will be FALSE, len will be set to the number of values returned, 
  239.    --      and max_len will be set to a value verifying max_len >= len. 
  240.    --      The use of this variant allows for zero-copy access to the data and 
  241.    --      the application will need to return the loan to the DataWriter using return_loan. 
  242.    --   4. If the initial max_len>0 and owns==FALSE, then the read or take operation 
  243.    --      will fail with exception PRECONDITION_NOT_MET. 
  244.    --      This avoids the potential hard-to-detect memory leaks caused by an 
  245.    --      application forgetting to return the loan. 
  246.    --   5. If initial max_len>0 and owns==TRUE, then the read or take operation will copy 
  247.    --      the received_data values and SampleInfo values into the elements already 
  248.    --      inside the collections. On output, owns will be TRUE, len will be set to 
  249.    --      the number of values copied and max_len will remain unchanged. 
  250.    --      The use of this variant forces a copy but the application can control 
  251.    --      where the copy is placed and the application will not need to return the loan. 
  252.    --      The number of samples copied depends on the relative values of max_len and max_samples: 
  253.    --    * If max_samples == LENGTH_UNLIMITED, then at most max_len values will be copied. 
  254.    --      The use of this variant lets the application limit the number of samples 
  255.    --      returned to what the sequence can accommodate. 
  256.    --    * If max_samples <= max_len, then at most max_samples values will be copied. 
  257.    --      The use of this variant lets the application limit the number of samples 
  258.    --      returned to fewer that what the sequence can accommodate. 
  259.    --    * If max_samples > max_len, then the read or take operation will fail with 
  260.    --      exception PRECONDITION_NOT_MET. This avoids the potential confusion where 
  261.    --      the application expects to be able to access up to max_samples, but that 
  262.    --      number can never be returned, even if they are available in the DataReader, 
  263.    --      because the output sequence cannot accommodate them. 
  264.    --  As described above, upon completion, the received_data and info_seq collections 
  265.    --  may contain elements loaned from the DataReader. 
  266.    --  If this is the case, the application will need to use return_loan to return 
  267.    --  the loan once it is no longer using the received_data in the collection. 
  268.    --  When return_loan completes, the collection will have owns=FALSE and max_len=0. 
  269.    --  The application can determine whether it is necessary to return the loan or not 
  270.    --  based on how the state of the collections when the read/take operation was called 
  271.    --  or by accessing the owns property. However, in many cases it may be simpler to 
  272.    --  always call return_loan, as this operation is harmless 
  273.    --  (i.e., it leaves all elements unchanged) if the collection does not have a loan. 
  274.    --  To avoid potential memory leaks, the implementation of the data and SampleInfo 
  275.    --  collections should disallow changing the length of a collection for which owns==FALSE. 
  276.    --  Furthermore, deleting a collection for which owns==FALSE should be considered an error. 
  277.    --  On output, the collection of data values and the collection of SampleInfo structures 
  278.    --  are of the same length and are in a one-to-one correspondence. 
  279.    --  Each SampleInfo provides information, such as the source_timestamp, 
  280.    --  the sample_state, view_state, and instance_state, etc., about the corresponding sample. 
  281.    -- 
  282.    --  Some elements in the returned collection may not have valid data. 
  283.    --  If the instance_state in the SampleInfo is NOT_ALIVE_DISPOSED_INSTANCE_STATE 
  284.    --  or NOT_ALIVE_NO_WRITERS_INSTANCE_STATE, then the last sample for that instance 
  285.    --  in the collection (that is, the one whose SampleInfo has sample_rank==0) 
  286.    --  does not contain valid data. 
  287.    --  Samples that contain no data do not count towards the limits imposed by the 
  288.    --  ResourceLimitsQosPolicy. The act of reading/taking a sample sets its 
  289.    --  sample_state to READ_SAMPLE_STATE. 
  290.    --  If the sample belongs to the most recent generation of the instance, 
  291.    --  it will also set the view_state of the instance to NOT_NEW_VIEW_STATE. 
  292.    --  It will not affect the instance_state of the instance. 
  293.    --  This operation must be provided on the specialized class that is generated for 
  294.    --  the particular application data-type that is being read. If the DataReader has 
  295.    --  no samples that meet the constraints, the operations fails with exception NO_DATA. 
  296.    --  </internal> 
  297.  
  298.  
  299.    procedure Read_W_Condition 
  300.      (Self          : not null access Ref; 
  301.       Received_Data : not null access Data_Sequences.Sequence; 
  302.       Info_Seq      : not null access DDS.SampleInfo_Seq.Sequence; 
  303.       Max_Samples   : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  304.       Condition     : access DDS.ReadCondition.Ref'Class); 
  305.    procedure Read_W_Condition 
  306.      (Self          : not null access Ref; 
  307.       Received_Data : out Data_Sequences.Sequence; 
  308.       Info_Seq      : out DDS.SampleInfo_Seq.Sequence; 
  309.       Max_Samples   : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  310.       Condition     : access DDS.ReadCondition.Ref'Class); 
  311.    function Read_W_Condition 
  312.      (Self          : not null access Ref; 
  313.       Max_Samples   : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  314.       Condition     : access DDS.ReadCondition.Ref'Class) return Container'Class; 
  315.    --  <dref>FooDataReader_read_w_condition</dref>Ret.Received_Data 
  316.    --  <internal> 
  317.    --  Accesses via read the samples that match the criteria specified in the ReadCondition. 
  318.    --  This operation is especially useful in combination with QueryCondition to 
  319.    --  filter data samples based on the content. 
  320.    --  The specified ReadCondition must be attached to the DataReader; 
  321.    --  otherwise the operation will fail with exception PRECONDITION_NOT_MET. 
  322.    --  In case the ReadCondition is a plain ReadCondition and not the 
  323.    --  specialized QueryCondition, the operation is equivalent to calling read 
  324.    --  and passing as sample_states, view_states and instance_states the value of 
  325.    --  the corresponding attributes in the read_condition. 
  326.    --  Using this operation, the application can avoid repeating the same parameters 
  327.    --  specified when creating the ReadCondition. 
  328.    --  The samples are accessed with the same semantics as read. 
  329.    --  If the DataReader has no samples that meet the constraints, 
  330.    --  the operation will fail with exception RETCODE_NO_DATA. 
  331.    --  </internal> 
  332.  
  333.  
  334.    procedure Take_W_Condition 
  335.      (Self          : not null access Ref; 
  336.       Received_Data : not null access Data_Sequences.Sequence; 
  337.       Info_Seq      : not null access DDS.SampleInfo_Seq.Sequence; 
  338.       Max_Samples   : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  339.       Condition     : access DDS.ReadCondition.Ref'Class); 
  340.    function Take_W_Condition 
  341.      (Self          : not null access Ref; 
  342.       Max_Samples   : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  343.       Condition     : access DDS.ReadCondition.Ref'Class) return Container'Class; 
  344.    --  <dref>FooDataReader_take_w_condition</dref> 
  345.    --  <internal> 
  346.    --  Analogous to read_w_condition except it accesses samples via the take operation. 
  347.    --  This operation is analogous to read_w_condition except that it accesses 
  348.    --  samples via the take operation. 
  349.    --  The specified ReadCondition must be attached to the DataReader; 
  350.    --  otherwise the operation will fail with exception PRECONDITION_NOT_MET. 
  351.    --  The samples are accessed with the same semantics as take. 
  352.    --  This operation is especially useful in combination with QueryCondition 
  353.    --  to filter data samples based on the content. 
  354.    --  If the DataReader has no samples that meet the constraints, 
  355.    --  the function will fail with exception NO_DATA. 
  356.    --  </internal> 
  357.  
  358.  
  359.    procedure Read_Next_Sample 
  360.      (Self          : not null access Ref; 
  361.       Received_Data : out Data_Type; 
  362.       Sample_Info   : not null access DDS.SampleInfo); 
  363.    procedure Read_Next_Sample 
  364.      (Self          : not null access Ref; 
  365.       Received_Data : not null Data_Type_Access; 
  366.       Sample_Info   : not null access DDS.SampleInfo); 
  367.    --  <dref>FooDataReader_read_next_sample</dref> 
  368.    --  <internal> 
  369.    --  Copies the next not-previously-accessed data value from the DataReader. 
  370.    --  This operation copies the next not-previously-accessed data value from the DataReader. 
  371.    --  This operation also copies the corresponding SampleInfo. The implied order among 
  372.    --  the samples stored in the DataReader is the same as for the read operation. 
  373.    --  The read_next_sample operation is semantically equivalent to the read operation, 
  374.    --  where the input data sequences has max_len=1, the sample_states=NOT_READ, 
  375.    --  the view_states=ANY_VIEW_STATE, and the instance_states=ANY_INSTANCE_STATE. 
  376.    --  The read_next_sample operation provides a simplified API to 'read' samples, 
  377.    --  avoiding the need for the application to manage sequences and specify states. 
  378.    --  If there is no unread data in the DataReader, the operation will fail with 
  379.    --  exception NO_DATA and nothing is copied. 
  380.    --  </internal> 
  381.  
  382.  
  383.    procedure Take_Next_Sample 
  384.      (Self          : not null access Ref; 
  385.       Received_Data : not null Data_Type_Access; 
  386.       Sample_Info   : not null access DDS.SampleInfo); 
  387.    procedure Take_Next_Sample 
  388.      (Self          : not null access Ref; 
  389.       Received_Data : out Data_Type; 
  390.       Sample_Info   : not null access DDS.SampleInfo); 
  391.    --  <dref>FooDataReader_take_next_sample</dref> 
  392.    --  <internal> 
  393.    --  Copies the next not-previously-accessed data value from the DataReader. 
  394.    --  This operation copies the next not-previously-accessed data value from the DataReader 
  395.    --  and 'removes' it from the DataReader so that it is no longer accessible. 
  396.    --  This operation also copies the corresponding SampleInfo. 
  397.    --  This operation is analogous to the read_next_sample except for the fact 
  398.    --  that the sample is removed from the DataReader. 
  399.    --  The take_next_sample operation is semantically equivalent to the take operation, 
  400.    --  where the input data sequences has max_len=1, the sample_states=NOT_READ, 
  401.    --  the view_states=ANY_VIEW_STATE, and the instance_states=ANY_INSTANCE_STATE. 
  402.    --  The read_next_sample operation provides a simplified API to 'take' samples, 
  403.    --  avoiding the need for the application to manage sequences and specify states. 
  404.    --  If tere is no unread data in the DataReader, the operation will fail 
  405.    --  with exception NO_DATA and nothing is copied. 
  406.    --  </internal> 
  407.  
  408.  
  409.    procedure Read_Instance 
  410.      (Self            : not null access Ref; 
  411.       Received_Data   : not null access Data_Sequences.Sequence; 
  412.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  413.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  414.       A_Handle        : access constant DDS.InstanceHandle_T; 
  415.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  416.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  417.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  418.    function Read_Instance 
  419.      (Self            : not null access Ref; 
  420.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  421.       A_Handle        : access constant DDS.InstanceHandle_T; 
  422.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  423.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  424.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE) return Container'Class; 
  425.    --  <dref>FooDataReader_read_instance</dref> 
  426.    --  <internal> 
  427.    --  Access a collection of data samples from the DataReader. 
  428.    --  This operation accesses a collection of data values from the DataReader. 
  429.    --  The behavior is identical to read, except that all samples returned belong 
  430.    --  to the single specified instance whose handle is a_handle. 
  431.    --  Upon successful completion, the data collection will contain samples all 
  432.    --  belonging to the same instance. The corresponding SampleInfo verifies 
  433.    --  SampleInfo::instance_handle == a_handle. 
  434.    --  The read_instance operation is semantically equivalent to the read operation, 
  435.    --  except in building the collection, the DataReader will check that the sample 
  436.    --  belongs to the specified instance and otherwise it will not place the sample 
  437.    --  in the returned collection. 
  438.    --  The behavior of the read_instance operation follows the same rules as the 
  439.    --  read operation regarding the pre-conditions and post-conditions for the received_data 
  440.    --  and sample_info. Similar to the read, the read_instance operation may 'loan' elements 
  441.    --  to the output collections, which must then be returned by means of return_loan. 
  442.    --  Similar to the read, this operation must be provided on the specialized class that 
  443.    --  is generated for the particular application data-type that is being taken. 
  444.    --  If the DataReader has no samples that meet the constraints, 
  445.    --  the function will fail with RETCODE_NO_DATA. 
  446.    --  This operation may fail with RETCODE_BAD_PARAMETER if the InstanceHandle_t 
  447.    --  a_handle does not correspond to an existing data-object known to the DataReader. 
  448.    --  </internal> 
  449.  
  450.  
  451.    procedure Take_Instance 
  452.      (Self            : not null access Ref; 
  453.       Received_Data   : not null access Data_Sequences.Sequence; 
  454.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  455.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  456.       A_Handle        : access constant DDS.InstanceHandle_T; 
  457.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  458.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  459.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  460.    function Take_Instance 
  461.      (Self            : not null access Ref; 
  462.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  463.       A_Handle        : access constant DDS.InstanceHandle_T; 
  464.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  465.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  466.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE) return Container'Class; 
  467.    --  <dref>FooDataReader_take_instance</dref> 
  468.    --  <internal> 
  469.    --  Access a collection of data samples from the DataReader. 
  470.    --  This operation accesses a collection of data values from the DataReader. 
  471.    --  The behavior is identical to take, except for that all samples returned belong 
  472.    --  to the single specified instance whose handle is a_handle. 
  473.    --  The semantics are the same for the take operation, except in building the collection, 
  474.    --  the DataReader will check that the sample belongs to the specified instance, 
  475.    --  and otherwise it will not place the sample in the returned collection. 
  476.    --  The behavior of the take_instance operation follows the same rules as the 
  477.    --  read operation regarding the pre-conditions and post-conditions for the 
  478.    --  received_data and sample_info. Similar to the read, the take_instance operation may 
  479.    --  'loan' elements to the output collections, which must then be returned by means of return_loan. 
  480.    --  Similar to the read, this operation must be provided on the specialized class 
  481.    --  that is generated for the particular application data-type that is being taken. 
  482.    --  If the DataReader has no samples that meet the constraints, the function fails with exception NO_DATA. 
  483.    --  This operation may fail with exception BAD_PARAMETER if the InstanceHandle_t 
  484.    --  a_handle does not correspond to an existing data-object known to the DataReader. 
  485.    --  </internal> 
  486.  
  487.  
  488.    procedure Read_Next_Instance 
  489.      (Self            : not null access Ref; 
  490.       Received_Data   : not null access Data_Sequences.Sequence; 
  491.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  492.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  493.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  494.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  495.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  496.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  497.    function Read_Next_Instance 
  498.      (Self            : not null access Ref; 
  499.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  500.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  501.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  502.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  503.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE) return Container'Class; 
  504.    --  <dref>FooDataReader_read_next_instance</dref> 
  505.    --  <internal> 
  506.    --  Access a collection of data samples from the DataReader. 
  507.    --  This operation accesses a collection of data values from the DataReader 
  508.    --  where all the samples belong to a single instance. The behavior is similar to 
  509.    --  read_instance, except that the actual instance is not directly specified. 
  510.    --  Rather, the samples will all belong to the 'next' instance with instance_handle 
  511.    --  'greater' than the specified 'previous_handle' that has available samples. 
  512.    --  This operation implies the existence of a total order 'greater-than' relationship 
  513.    --  between the instance handles. The specifics of this relationship are not all 
  514.    --  important and are implementation specific. The important thing is that, 
  515.    --  according to the middleware, all instances are ordered relative to each other. 
  516.    --  This ordering is between the instance handles; It should not depend on the state 
  517.    --  of the instance (e.g. whether it has data or not) and must be defined even for 
  518.    --  instance handles that do not correspond to instances currently managed by the DataReader. 
  519.    --  For the purposes of the ordering, it should be 'as if' each instance handle was 
  520.    --  represented as unique integer. 
  521.    --  The behavior of read_next_instance is 'as if' the DataReader invoked read_instance, 
  522.    --  passing the smallest instance_handle among all the ones that: 
  523.    --   (a) are greater than previous_handle, and 
  524.    --   (b) have available samples (i.e. samples that meet the constraints imposed by the specified states). 
  525.    --  The special value HANDLE_NIL is guaranteed to be 'less than' any valid instance_handle. 
  526.    --  So the use of the parameter value previous_handle == HANDLE_NIL will 
  527.    --   return the samples for the instance which has the smallest instance_handle 
  528.    --  among all the instances that contain available samples. 
  529.    --  The operation read_next_instance is intended to be used in an 
  530.    --  application-driven iteration, where the application starts by passing 
  531.    --  previous_handle == HANDLE_NIL, examines the samples returned, and then uses 
  532.    --  the instance_handle returned in the SampleInfo as the value of the previous_handle 
  533.    --  argument to the next call to read_next_instance. The iteration continues 
  534.    --  until read_next_instance fails with the value exception NO_DATA. 
  535.    --  Note that it is possible to call the read_next_instance operation with a 
  536.    --  previous_handle that does not correspond to an instance currently managed by 
  537.    --  the DataReader. This is because as stated earlier the 'greater-than' relationship 
  538.    --  is defined even for handles not managed by the DataReader. 
  539.    --  One practical situation where this may occur is when an application is iterating 
  540.    --  though all the instances, takes all the samples of a NOT_ALIVE_NO_WRITERS_INSTANCE_STATE 
  541.    --  instance, returns the loan (at which point the instance information may be removed, 
  542.    --  and thus the handle becomes invalid), and tries to read the next instance. 
  543.    --  The behavior of the read_next_instance operation follows the same rules as 
  544.    --  the read operation regarding the pre-conditions and post-conditions for the 
  545.    --  received_data and sample_info. Similar to the read, the read_instance operation may 
  546.    --  'loan' elements to the output collections, which must then be returned by means of return_loan. 
  547.    --  Similar to the read, this operation must be provided on the specialized class 
  548.    --  that is generated for the particular application data-type that is being taken. 
  549.    --  If the DataReader has no samples that meet the constraints, the function 
  550.    --  will fail with exception NO_DATA. 
  551.    --  </internal> 
  552.  
  553.  
  554.    procedure Take_Next_Instance 
  555.      (Self            : not null access Ref; 
  556.       Received_Data   : not null access Data_Sequences.Sequence; 
  557.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  558.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  559.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  560.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  561.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  562.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE); 
  563.    function Take_Next_Instance 
  564.      (Self            : not null access Ref; 
  565.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  566.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  567.       Sample_States   : in DDS.SampleStateMask := DDS.ANY_SAMPLE_STATE; 
  568.       View_States     : in DDS.ViewStateMask := DDS.ANY_VIEW_STATE; 
  569.       Instance_States : in DDS.InstanceStateMask := DDS.ANY_INSTANCE_STATE) return Container'Class; 
  570.    --  <dref>FooDataReader_take_next_instance</dref> 
  571.    --  <internal> 
  572.    --  Access a collection of data samples from the DataReader. 
  573.    --  This operation accesses a collection of data values from the DataReader and 
  574.    --  'removes' them from the DataReader. 
  575.    --  This operation has the same behavior as read_next_Ret.Received_Datainstance, except that the 
  576.    --  samples are 'taken' from the DataReader such that they are no longer accessible 
  577.    --  via subsequent 'read' or 'take' operations. 
  578.    --  Similar to the operation read_next_instance, it is possible to call take_next_instance 
  579.    --  with a previous_handle that does not correspond to an instance currently managed by the DataReader. 
  580.    --  The behavior of the take_next_instance operation follows the same rules as the 
  581.    --  read operation regarding the pre-conditions and post-conditions for the received_data 
  582.    --  and sample_info. Similar to the read, the take_next_instance operation may 'loan' 
  583.    --  elements to the output collections, which must then be returned by means of return_loan. 
  584.    --  Similar to the read, this operation must be provided on the specialized class that 
  585.    --  is generated for the particular application data-type that is being taken. 
  586.    --  If the DataReader has no samples that meet the constraints, 
  587.    --  the function will fail with exception NO_DATA. 
  588.    --  </internal> 
  589.  
  590.  
  591.    procedure Read_Next_Instance_W_Condition 
  592.      (Self            : not null access Ref; 
  593.       Received_Data   : not null access Data_Sequences.Sequence; 
  594.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  595.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  596.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  597.       Condition       : DDS.ReadCondition.Ref_Access); 
  598.    function Read_Next_Instance_W_Condition 
  599.      (Self            : not null access Ref; 
  600.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  601.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  602.       Condition       : DDS.ReadCondition.Ref_Access) return Container'Class; 
  603.    --  <dref>FooDataReader_read_next_instance_w_condition</dref> 
  604.    --  <internal> 
  605.    --  Accesses via read_next_instance the samples that match the criteria 
  606.    --  specified in the ReadCondition. 
  607.    --  This operation access a collection of data values from the DataReader. 
  608.    --  The behavior is identical to read_next_instance, except that all samples returned satisfy 
  609.    --  the specified condition. In other words, on success, all returned samples 
  610.    --  belong to the same instance, and the instance is the instance with 'smallest' 
  611.    --  instance_handle among the ones that verify: 
  612.    --   (a) instance_handle >= previous_handle, and 
  613.    --   (b) have samples for which the specified ReadCondition evaluates to TRUE. 
  614.    --  Similar to the operation read_next_instance, it is possible to call 
  615.    --  read_next_instance_w_condition with a previous_handle that does not correspond 
  616.    --  to an instance currently managed by the DataReader. 
  617.    --  The behavior of the read_next_instance_w_condition operation follows the same 
  618.    --  rules as the read operation regarding the pre-conditions and post-conditions for 
  619.    --  the received_data and sample_info. Similar to the read, the 
  620.    --  read_next_instance_w_condition operation may 'loan' elements to the output collections, 
  621.    --  which must then be returned by means of return_loan. 
  622.    --  Similar to the read, this operation must be provided on the specialized class that 
  623.    --  is generated for the particular application data-type that is being taken. 
  624.    --  If the DataReader has no samples that meet the constraints, 
  625.    --  the function will fail with exception NO_DATA. 
  626.    --  </internal> 
  627.  
  628.  
  629.    procedure Take_Next_Instance_W_Condition 
  630.      (Self            : not null access Ref; 
  631.       Received_Data   : not null access Data_Sequences.Sequence; 
  632.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  633.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  634.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  635.       Condition       : DDS.ReadCondition.Ref_Access); 
  636.    procedure Take_Next_Instance_W_Condition 
  637.      (Self            : not null access Ref; 
  638.       Received_Data   : in out Data_Sequences.Sequence; 
  639.       Info_Seq        : in out DDS.SampleInfo_Seq.Sequence; 
  640.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  641.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  642.       Condition       : DDS.ReadCondition.Ref_Access); 
  643.    function Take_Next_Instance_W_Condition 
  644.      (Self            : not null access Ref; 
  645.       Max_Samples     : in DDS.Long := DDS.LENGTH_UNLIMITED; 
  646.       Previous_Handle : access constant DDS.InstanceHandle_T; 
  647.       Condition       : DDS.ReadCondition.Ref_Access) return Container'Class; 
  648.    --  <dref>FooDataReader_take_next_instance_w_condition</dref> 
  649.    --  <internal> 
  650.    --  Accesses via take_next_instance the samples that match the criteria specified 
  651.    --  in the ReadCondition. 
  652.    --  This operation access a collection of data values from the DataReader and 
  653.    --  'removes' them from the DataReader. 
  654.    --  The operation has the same behavior as read_next_instance_w_condition, except 
  655.    --  that the samples are 'taken' from the DataReader such that they are no longer 
  656.    --  accessible via subsequent 'read' or 'take' operations. 
  657.    --  Similar to the operation read_next_instance, it is possible to call 
  658.    --  take_next_instance_w_condition with a previous_handle that does not correspond 
  659.    --  to an instance currently managed by the DataReader. 
  660.    --  The behavior of the take_next_instance_w_condition operation follows the same 
  661.    --  rules as the read operation regarding the pre-conditions and post-conditions 
  662.    --  for the received_data and sample_info. Similar to the read, 
  663.    --  the take_next_instance_w_condition operation may 'loan' elements to the output 
  664.    --  collections, which must then be returned by means of return_loan. 
  665.    --  Similar to the read, this operation must be provided on the specialized class 
  666.    --  that is generated for the particular application data-type that is being taken. 
  667.    --  If the DataReader has no samples that meet the constraints, 
  668.    --  the function will fail with exception NO_DATA. 
  669.    --  </internal> 
  670.  
  671.  
  672.    procedure Return_Loan 
  673.      (Self          : not null access Ref; 
  674.       Received_Data : not null access Data_Sequences.Sequence; 
  675.       Info_Seq      : not null access DDS.SampleInfo_Seq.Sequence); 
  676.    procedure Return_Loan 
  677.      (Self          : not null access Ref; 
  678.       Received_Data : in out  Data_Sequences.Sequence; 
  679.       Info_Seq      : in out  DDS.SampleInfo_Seq.Sequence); 
  680.  
  681.    --  <dref>FooDataReader_return_loan</dref> 
  682.    --  <internal> 
  683.    --  Indicates to the DataReader that the application is done accessing the collection 
  684.    --  of received_data and info_seq obtained by some earlier invocation of 
  685.    --  read or take on the DataReader. 
  686.    --  This operation indicates to the DataReader that the application is done accessing 
  687.    --  the collection of received_data and info_seq obtained by some earlier 
  688.    --  invocation of read or take on the DataReader. 
  689.    --  The received_data and info_seq must belong to a single related "pair"; that is, 
  690.    --  they should correspond to a pair returned from a single call to read or take. 
  691.    --  The received_data and info_seq must also have been obtained from the same DataReader 
  692.    --  to which they are returned. If either of these conditions is not met, the operation 
  693.    --  will fail with exception PRECONDITION_NOT_MET. 
  694.    --  The operation return_loan allows implementations of the read and take operations 
  695.    --  to "loan" buffers from the DataReader to the application and in this manner provide 
  696.    --  "zerocopy" access to the data. During the loan, the DataReader will guarantee 
  697.    --  that the data and sample-information are not modified. 
  698.    --  It is not necessary for an application to return the loans immediately after 
  699.    --  the read or take calls. However, as these buffers correspond to internal resources 
  700.    --  inside the DataReader, the application should not retain them indefinitely. 
  701.    --  The use of return_loan is only necessary if the read or take calls "loaned" 
  702.    --  buffers to the application. This only occurs if the received_data and info_Seq 
  703.    --  collections had max_len=0 at the time read or take was called. 
  704.    --  The application may also examine the "owns" property of the collection to determine 
  705.    --  where there is an outstanding loan. However, calling return_loan on a collection 
  706.    --  that does not have a loan is safe and has no side effects. 
  707.    --  If the collections had a loan, upon completion of return_loan, 
  708.    --  the collections will have max_len=0. 
  709.    --  Similar to read, this operation must be provided on the specialized class that 
  710.    --  is generated for the particular application data-type that is being taken. 
  711.    --  </internal> 
  712.  
  713.  
  714.    procedure Get_Key_Value 
  715.      (Self       : not null access Ref; 
  716.       Key_Holder : not null Data_Type_Access; 
  717.       Handle     : access constant DDS.InstanceHandle_T); 
  718.    procedure Get_Key_Value 
  719.      (Self       : not null access Ref; 
  720.       Key_Holder : out Data_Type; 
  721.       Handle     : access constant DDS.InstanceHandle_T); 
  722.    procedure Get_Key_Value 
  723.      (Self       : not null access Ref; 
  724.       Key_Holder : out Data_Type; 
  725.       Handle     : in DDS.InstanceHandle_T); 
  726.    --  <dref>FooDataReader_get_key_value</dref> 
  727.    --  <internal> 
  728.    --  Retrieve the instance key that corresponds to an instance handle. 
  729.    --  Useful for keyed data types. 
  730.    --  The operation will only fill the fields that form the key inside the key_holder instance. 
  731.    --  For keyed data types, this operation may fail with exception BAD_PARAMETER 
  732.    --  if the handle does not correspond to an existing data-object known to the DDS_DataReader. 
  733.    --  </internal> 
  734.  
  735.  
  736.    function Lookup_Instance 
  737.      (Self       : not null access Ref; 
  738.       Key_Holder : not null Data_Type_Access) return DDS.InstanceHandle_T; 
  739.    function Lookup_Instance 
  740.      (Self       : not null access Ref; 
  741.       Key_Holder : Data_Type) return DDS.InstanceHandle_T; 
  742.    procedure Lookup_Instance 
  743.      (Self       : not null access Ref; 
  744.       Key_Holder : Data_Type; 
  745.       Instance   : out DDS.InstanceHandle_T); 
  746.    --  <dref>FooDataReader_lookup_instance</dref> 
  747.    --  <internal> 
  748.    --  Retrieve the instance handle that corresponds to an instance key_holder. 
  749.    --  Useful for keyed data types. 
  750.    --  This operation takes as a parameter an instance and returns a handle that 
  751.    --  can be used in subsequent operations that accept an instance handle as an argument. 
  752.    --  The instance parameter is only used for the purpose of examining the fields that 
  753.    --  define the key. This operation does not register the instance in question. 
  754.    --  If the instance has not been previously registered, or if for any other reason 
  755.    --  the Service is unable to provide an instance handle, 
  756.    --  the Service will return the special value HANDLE_NIL 
  757.    --  </internal> 
  758.  
  759.    function As_DataReader (Self : Ref_Access) return Standard.DDS.DataReader.Ref_Access is 
  760.      (Standard.DDS.DataReader.Ref_Access (Self)); 
  761.  
  762.    function Narrow 
  763.      (Self        : access DDS.DataReader.Ref'Class) return not null access Ref is 
  764.      (Ref (Self.all)'Access); 
  765.  
  766.  
  767.    function CreateTypedI return DDS.DataReader.Ref_Access; 
  768.  
  769.    procedure DestroyTypedI 
  770.      (Reader : in out DDS.DataReader.Ref_Access); 
  771.  
  772. private 
  773.  
  774.  
  775.    procedure  read_or_takeI 
  776.      (self            : not null access Ref; 
  777.       Received_Data   : not null access Data_Sequences.Sequence; 
  778.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  779.       max_samples     : DDS.Long; 
  780.       sample_states   : DDS.SampleStateMask; 
  781.       view_states     : DDS.ViewStateMask; 
  782.       instance_states : DDS.InstanceStateMask; 
  783.       take            : DDS.Boolean); 
  784.  
  785.    procedure  read_or_take_w_conditionI 
  786.      (Self            : not null access Ref; 
  787.       Received_Data   : not null access Data_Sequences.Sequence; 
  788.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  789.       Max_samples     : DDS.Long; 
  790.       Condition       : not null access constant DDS.ReadCondition.Ref'Class; 
  791.       Take            : DDS.Boolean); 
  792.  
  793.    procedure  read_or_take_next_sampleI 
  794.      (self            : not null access Ref; 
  795.       Received_Data   : not null Data_Type_Access; 
  796.       sample_info     : not null access DDS.SampleInfo; 
  797.       take            : DDS.Boolean); 
  798.  
  799.    procedure  read_or_take_instanceI 
  800.      (self            : not null access Ref; 
  801.       Received_Data   : not null access Data_Sequences.Sequence; 
  802.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  803.       max_samples     : DDS.Long; 
  804.       handle          : not null access constant DDS.InstanceHandle_T; 
  805.       sample_states   : DDS.SampleStateMask; 
  806.       view_states     : DDS.ViewStateMask; 
  807.       instance_states : DDS.InstanceStateMask; 
  808.       take            : DDS.Boolean); 
  809.  
  810.    procedure  read_or_take_next_instanceI 
  811.      (self            : not null access Ref; 
  812.       Received_Data   : not null access Data_Sequences.Sequence; 
  813.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  814.       max_samples     : DDS.Long; 
  815.       previous_handle : not null access constant DDS.InstanceHandle_T; 
  816.       sample_states   : DDS.SampleStateMask; 
  817.       view_states     : DDS.ViewStateMask; 
  818.       instance_states : DDS.InstanceStateMask; 
  819.       Take            : DDS.Boolean); 
  820.  
  821.    procedure Read_Or_Take_Instance_W_ConditionI 
  822.      (Self            : not null access Ref; 
  823.       Received_Data   : not null access Data_Sequences.Sequence; 
  824.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  825.       Max_Samples     : DDS.Long; 
  826.       Handle          : not null access constant DDS.InstanceHandle_T; 
  827.       Condition       : not null access constant DDS.ReadCondition.Ref'Class; 
  828.       Take            : DDS.Boolean); 
  829.  
  830.    procedure  read_or_take_next_instance_w_conditionI 
  831.      (self            : not null access Ref; 
  832.       Received_Data   : not null access Data_Sequences.Sequence; 
  833.       Info_Seq        : not null access DDS.SampleInfo_Seq.Sequence; 
  834.       max_samples     : DDS.Long; 
  835.       previous_handle : not null access constant DDS.InstanceHandle_T; 
  836.       condition       : not null access constant DDS.ReadCondition.Ref'Class; 
  837.       take            : DDS.Boolean); 
  838.  
  839.  
  840.  
  841.    ---------------------------------------------------- 
  842.    --  Below here to be moved to dds-datareader_impl -- 
  843.    ---------------------------------------------------- 
  844.  
  845.    procedure Get_Key_Value_UntypedI (Self          : not null access Ref; 
  846.                                      Key_Holder    : System.Address; 
  847.                                      Handle        : access constant DDS.InstanceHandle_T); 
  848.  
  849.  
  850.    function Lookup_Instance_UntypedI (Self          : not null access Ref; 
  851.                                        Key_Holder    : System.Address) return DDS.InstanceHandle_T; 
  852.  
  853.  
  854. --  DDS_InstanceHandle_t TDataReader_lookup_instance(TDataReader* self, 
  855. --                                                   const TData* key_holder) { 
  856. --      return DDS_DataReader_lookup_instance_untypedI( 
  857. --          (DDS_DataReader *)self, key_holder); 
  858. --  } 
  859. -- 
  860. --  DDS_ReturnCode_t TDataReader_add_sample_to_remote_writer_queue(TDataReader* self, 
  861. --                                                              const TData* local_data, 
  862. --                                                              const struct DDS_GUID_t* queue_writer_guid) { 
  863. --      return DDS_DataReader_add_sample_to_remote_writer_queue_untypedI( 
  864. --          (DDS_DataReader *)self, local_data, queue_writer_guid); 
  865. --  } 
  866.  
  867.    function Return_Loan_UntypedI 
  868.      (Self          : not null access Ref; 
  869.       Received_Data : System.Address; 
  870.       Data_Count    : Natural; 
  871.       Info_Seq      : not null Standard.DDS.SampleInfo_Seq.Sequence_Access) return DDS_ReturnCode_t; 
  872.  
  873.    procedure Return_Loan_UntypedI 
  874.      (Self          : not null access Ref; 
  875.       Received_Data : System.Address; 
  876.       Data_Count    : Natural; 
  877.       Info_Seq      : not null Standard.DDS.SampleInfo_Seq.Sequence_Access); 
  878.  
  879.  
  880.    function Read_Or_Take_W_Condition_UntypedI 
  881.      (Self                                : not null access Ref; 
  882.       Is_Loan                             : access DDS.Boolean; 
  883.       Received_Data                       : System.Address; 
  884.       Data_Count                          : access Natural; 
  885.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  886.       Data_Seq_Len                        : Long_Integer; 
  887.       Data_Seq_Max_Len                    : Long_Integer; 
  888.       Data_Seq_Has_Ownership              : Long_Integer; 
  889.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  890.       Data_Size                           : Integer; 
  891.       Max_Samples                         : Long_Integer; 
  892.       Condition                           : not null access DDS.ReadCondition.Ref'Class; 
  893.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  894.  
  895.    function Read_Or_Take_Instance_UntypedI 
  896.      (Self                                : not null access Ref; 
  897.       Is_Loan                             : access DDS.Boolean; 
  898.       Received_Data                       : System.Address; 
  899.       Data_Count                          : access Natural; 
  900.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  901.       Data_Seq_Len                        : Long_Integer; 
  902.       Data_Seq_Max_Len                    : Long_Integer; 
  903.       Data_Seq_Has_Ownership              : Long_Integer; 
  904.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  905.       Data_Size                           : Integer; 
  906.       Max_Samples                         : Long_Integer; 
  907.       Handle                              : DDS.InstanceHandle_T_Access; 
  908.       Sample_States                       : DDS.SampleStateMask; 
  909.       View_States                         : DDS.ViewStateMask; 
  910.       Instance_States                     : DDS.InstanceStateMask; 
  911.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  912.  
  913.    function Read_Or_Take_Instance_W_Condition_UntypedI 
  914.      (Self                                : not null access Ref; 
  915.       Is_Loan                             : access DDS.Boolean; 
  916.       Received_Data                       : System.Address; 
  917.       Data_Count                          : access Natural; 
  918.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  919.       Data_Seq_Len                        : Long_Integer; 
  920.       Data_Seq_Max_Len                    : Long_Integer; 
  921.       Data_Seq_Has_Ownership              : Long_Integer; 
  922.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  923.       Data_Size                           : Integer; 
  924.       Max_Samples                         : Long_Integer; 
  925.       Handle                              : DDS.InstanceHandle_T_Access; 
  926.       Condition                           : not null access DDS.ReadCondition.Ref'Class; 
  927.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  928.  
  929.    function Read_Or_Take_Next_Instance_UntypedI 
  930.      (Self                                : not null access Ref; 
  931.       Is_Loan                             : access DDS.Boolean; 
  932.       Received_Data                       : System.Address; 
  933.       Data_Count                          : access Natural; 
  934.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  935.       Data_Seq_Len                        : Long_Integer; 
  936.       Data_Seq_Max_Len                    : Long_Integer; 
  937.       Data_Seq_Has_Ownership              : Long_Integer; 
  938.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  939.       Data_Size                           : Integer; 
  940.       Max_Samples                         : Long_Integer; 
  941.       Previous_Handle                     : DDS.InstanceHandle_T_Access; 
  942.       Sample_States                       : DDS.SampleStateMask; 
  943.       View_States                         : DDS.ViewStateMask; 
  944.       Instance_States                     : DDS.InstanceStateMask; 
  945.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  946.  
  947.    function Read_Or_Take_Next_Instance_W_Condition_UntypedI 
  948.      (Self                                : not null access Ref; 
  949.       Is_Loan                             : access DDS.Boolean; 
  950.       Received_Data                       : System.Address; 
  951.       Data_Count                          : access Natural; 
  952.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  953.       Data_Seq_Len                        : Long_Integer; 
  954.       Data_Seq_Max_Len                    : Long_Integer; 
  955.       Data_Seq_Has_Ownership              : Long_Integer; 
  956.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  957.       Data_Size                           : Integer; 
  958.       Max_Samples                         : Long_Integer; 
  959.       Previous_Handle                     : DDS.InstanceHandle_T_Access; 
  960.       Condition                           : not null access DDS.ReadCondition.Ref'Class; 
  961.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  962.  
  963.    function Read_Or_Take_Next_Sample_UntypedI 
  964.      (Self                                : not null access Ref; 
  965.       Received_Data                       : System.Address; 
  966.       Sample_Info                         : DDS.SampleInfo_Access; 
  967.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  968.  
  969.  
  970. --     type DDS_InstanceHandle_T_Access is access all DDS_InstanceHandle_t; 
  971. --     function Convert_Handle is new Ada.Unchecked_Conversion (DDS.InstanceHandle_T_Access, DDS_InstanceHandle_T_Access); 
  972. -- 
  973. --     type DDS_SampleInfoSeq_Access is access all DDS_SampleInfoSeq; 
  974. --     function Convert_SampleInfoSeq is new Ada.Unchecked_Conversion (SampleInfo_Seq.Sequence_Access, DDS_SampleInfoSeq_Access); 
  975. -- 
  976. --     type DDS_SampleInfo_Access is access all DDS_SampleInfo; 
  977. --     function Convert_SampleInfo is new Ada.Unchecked_Conversion (DDS.SampleInfo_Access, DDS_SampleInfo_Access); 
  978.  
  979.  
  980.    type Container is limited new Ada.Finalization.Limited_Controlled with record 
  981.       Received_Data   : aliased Data_Sequences.Sequence; 
  982.       Info_Seq        : aliased DDS.SampleInfo_Seq.Sequence; 
  983.       Reader          : Ref_Access; 
  984.    end record; 
  985.  
  986.    procedure Finalize (Self : in out Container); 
  987. end DDS.Typed_DataReader_Generic;