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. pragma Ada_05; 
  10.  
  11. limited with DDS.Subscriber; 
  12. with DDS.TopicDescription; 
  13. with DDS.DataReaderListener; 
  14. with DDS.QueryCondition; 
  15. with DDS.ReadCondition; 
  16. with DDS.Domain_Entity; 
  17.  
  18. --  <dref>DataReader</dref> 
  19. package DDS.DataReader is 
  20.  
  21.    type Ref is limited interface and DDS.Domain_Entity.Ref; 
  22.    type Ref_Access is access all Ref'Class; 
  23.  
  24.    --  Allows the application to: 
  25.    --   (1) declare the data it wishes to receive (i.e. make a subscription) and 
  26.    --   (2) access the data received by the attached DDS.Subscriber. 
  27.    -- 
  28.    --  A DDS.DataReader refers to exactly one DDS.TopicDescription 
  29.    --  (either a DDS.Topic, a DDS.ContentFilteredTopic or a DDS.MultiTopic) 
  30.    --  that identifies the data to be read. 
  31.    --  The subscription has a unique resulting type. The data-reader may give 
  32.    --  access to several instances of the resulting type, 
  33.    --  which can be distinguished from each other by their key. 
  34.    -- 
  35.    --  DDS.DataReader is an abstract class. 
  36.    --  It must be specialised for each particular application data-type 
  37.    --  (see USER_DATA). The additional methods or functions that must be defined 
  38.    --  in the auto-generated class for a hypothetical application type Foo are 
  39.    --  specified in the generic type DDS.example.FooDataReader. 
  40.    -- 
  41.    --  The following operations may be called even if the DDS.DataReader 
  42.    --  is not enabled. Other operations will fail with 
  43.    --  exception RETCODE_NOT_ENABLED if called on a disabled DDS.DataReader: 
  44.    -- 
  45.    --  See also: 
  46.    --      Operations Allowed in Listener Callbacks 
  47.  
  48.    type Ref_Access_Access is access all Ref_Access; 
  49.    type Ref_Access_Array is array (Natural range <>) of aliased Ref_Access; 
  50.  
  51.    procedure Initialize 
  52.      (Self : in out Ref_Access) is null; 
  53.  
  54.    procedure Finalize 
  55.      (Self : in out Ref_Access) is null; 
  56.  
  57.    procedure Copy 
  58.      (Dst : in out Ref_Access; 
  59.       Src : in Ref_Access) is null; 
  60.  
  61.    function Create_Readcondition 
  62.      (Self            : not null access Ref; 
  63.       Sample_States   : in DDS.SampleStateMask; 
  64.       View_States     : in DDS.ViewStateMask; 
  65.       Instance_States : in DDS.InstanceStateMask) 
  66.       return DDS.ReadCondition.Ref_Access is abstract; 
  67.    --  <dref>DataReader_create_readcondition</dref> 
  68.    --  <internal> 
  69.    --  The returned DDS.ReadCondition will be 
  70.    --  attached and belong to the DDS.DataReader. 
  71.    --  </internal> 
  72.  
  73.    function Create_Querycondition 
  74.      (Self             : not null access Ref; 
  75.       Sample_States    : in DDS.SampleStateMask; 
  76.       View_States      : in DDS.ViewStateMask; 
  77.       Instance_States  : in DDS.InstanceStateMask; 
  78.       Query_Expression : in DDS.String; 
  79.       Query_Parameters : in DDS.String_Seq.Sequence) 
  80.       return DDS.QueryCondition.Ref_Access is abstract; 
  81.    --  <dref>DataReader_create_querycondition</dref> 
  82.    --  <internal> 
  83.    --  Not supported (optional>> Creates a DDS.QueryCondition. 
  84.    --  The returned DDS.QueryCondition will be attached 
  85.    --  and belong to the DDS.DataReader. 
  86.    --  Queries and Filters Syntax describes the syntax of 
  87.    --  query_expression and query_parameter 
  88.    --  </internal> 
  89.  
  90.    procedure Delete_Readcondition 
  91.      (Self        : not null access Ref; 
  92.       A_Condition : access DDS.ReadCondition.Ref'Class) is abstract; 
  93.    --  <dref>DataReader_delete_readcondition</dref> 
  94.  
  95.    procedure  Delete_Contained_Entities 
  96.      (Self : not null access Ref) is abstract; 
  97.    --  <dref>DataReader_delete_contained_entities</dref> 
  98.    --  <internal> 
  99.    --  Deletes all the entities that were created by means of the "create" 
  100.    --  operations on the dds.DataReader. 
  101.    --  Deletes all contained dds.ReadCondition and dds.QueryCondition objects. 
  102.    --  The operation will fail with RETCODE_PRECONDITION_NOT_MET if the any of 
  103.    --  the contained entities is in a state where it cannot be deleted. 
  104.    --  Once dds.DataReader.delete_contained_entities completes successfully, 
  105.    --  the application may delete the dds.DataReader, knowing that it has no 
  106.    --  contained dds.ReadCondition and dds.QueryCondition objects. 
  107.    --  </internal> 
  108.  
  109.    procedure Set_Qos 
  110.      (Self : not null access Ref; 
  111.       Qos  : in DDS.DataReaderQoS) is abstract; 
  112.    --  <dref>DataReader_set_qos</dref> 
  113.  
  114.    procedure Set_Qos_With_Profile 
  115.      (Self          : not null access Ref; 
  116.       library_name  : in String; 
  117.       profile_name  : in String) is abstract; 
  118.    procedure Set_Qos_With_Profile 
  119.      (Self          : not null access Ref; 
  120.       library_name  : in Standard.String; 
  121.       profile_name  : in Standard.String) is abstract; 
  122.    --  <dref>DataReader_set_qos_with_profile</dref> 
  123.    --  <internal> 
  124.    --  This operation modifies the QoS of the DDS.DataReader. 
  125.    --  The DataReaderQos.user_data, 
  126.    --      DataReaderQos.deadline, 
  127.    --      DataReaderQos.latency_budget, 
  128.    --      DataReaderQos.time_based_filter, 
  129.    --      DataReaderQos.reader_data_lifecycle 
  130.    --  can be changed. 
  131.    --  The other policies are immutable. 
  132.    --  </internal> 
  133.  
  134.  
  135.    procedure Get_Qos 
  136.      (Self : not null access Ref; 
  137.       Qos  : in out DDS.DataReaderQoS) is abstract; 
  138.    --  <dref>DataReader_get_qos</dref> 
  139.    --  <internal> 
  140.    --  Gets the reader QoS. 
  141.    --  This method may potentially allocate memory depending on the sequences 
  142.    --  contained in some QoS policies 
  143.    --  </internal> 
  144.  
  145.  
  146.    procedure Set_Listener 
  147.      (Self       : not null access Ref; 
  148.       A_Listener : in DDS.DataReaderListener.Ref_Access; 
  149.       Mask       : in DDS.StatusMask) is abstract; 
  150.    --  <dref>DataReader_set_listener</dref> 
  151.    --  <internal> 
  152.    --  Sets the reader listener. 
  153.    --  </internal> 
  154.  
  155.  
  156.    function Get_Listener 
  157.      (Self : not null access Ref) 
  158.       return DDS.DataReaderListener.Ref_Access is abstract; 
  159.    --  <dref>DataReader_get_listener</dref> 
  160.    --  <internal> 
  161.    --  Get the reader listener 
  162.    --  </internal> 
  163.  
  164.    procedure Call_ListnerT 
  165.      (Self       : not null access Ref; 
  166.       A_Listener : in DDS.DataReaderListener.Ref_Access; 
  167.       Mask       : in DDS.StatusMask) is abstract; 
  168.    --  <internal> 
  169.    --  Calls the reader listener. 
  170.    --  </internal> 
  171.  
  172.    function Get_Topicdescription 
  173.      (Self : not null access Ref) 
  174.       return DDS.TopicDescription.Ref_Access is abstract; 
  175.    --  <dref>DataReader_get_topicdescription</dref> 
  176.    --  <internal> 
  177.    --  Returns the dds.TopicDescription associated with the dds.DataReader. 
  178.    --  </internal> 
  179.  
  180.    function Get_Subscriber 
  181.      (Self : not null access Ref) 
  182.       return access DDS.Subscriber.Ref'Class is abstract; 
  183.    --  <dref>DataReader_get_subscriber</dref> 
  184.    --  <internal> 
  185.    --  Returns the dds.Subscriber to which the dds.DataReader belongs. 
  186.    --  </internal> 
  187.  
  188.  
  189.    procedure Get_Sample_Rejected_Status 
  190.      (Self   : not null access Ref; 
  191.       Status : in out DDS.SampleRejectedStatus) is abstract; 
  192.    --  <dref>DataReader_get_sample_rejected_status</dref> 
  193.    --  <internal> 
  194.    --  Return the StatusKind.SAMPLE_REJECTED_STATUS communication status. 
  195.    --  </internal> 
  196.  
  197.    procedure Get_Liveliness_Changed_Status 
  198.      (Self : not null access Ref; 
  199.       Status : in out DDS.LivelinessChangedStatus) is abstract; 
  200.    --  <dref>DataReader_get_liveliness_changed_status</dref> 
  201.    --  <internal> 
  202.    --  Returns the StatusKind.LIVELINESS_CHANGED_STATUS communication status. 
  203.    --  </internal> 
  204.  
  205.    procedure Get_Requested_Deadline_Missed_Status 
  206.      (Self : not null access Ref; 
  207.       Status : in out DDS.RequestedDeadlineMissedStatus) is abstract; 
  208.    --  <dref>DataReader_get_requested_deadline_missed_status</dref> 
  209.    --  <internal> 
  210.    --  Returns the StatusKind.REQUESTED_DEADLINE_MISSED_STATUS 
  211.    --  communication status. 
  212.    --  </internal> 
  213.  
  214.    procedure Get_Requested_Incompatible_Qos_Status 
  215.      (Self : not null access Ref; 
  216.       Status : in out DDS.RequestedIncompatibleQosStatus) is abstract; 
  217.    --  <dref>DataReader_get_requested_incompatible_qos_status</dref> 
  218.    --  <internal> 
  219.    --  Returns the StatusKind.REQUESTED_INCOMPATIBLE_QOS_STATUS 
  220.    --  communication status 
  221.    --  </internal> 
  222.  
  223.    procedure Get_Subscription_Matched_Status 
  224.      (Self : not null access Ref; 
  225.       Status : in out DDS.SubscriptionMatchedStatus) is abstract; 
  226.    --  <dref>DataReader_get_subscription_matched_status</dref> 
  227.    --  <internal> 
  228.    --  Returns the StatusKind.SUBSCRIPTION_MATCHED_STATUS communication status. 
  229.    --  </internal> 
  230.  
  231.    procedure Get_Sample_Lost_Status 
  232.      (Self : not null access Ref; 
  233.       Status : in out DDS.SampleLostStatus) is abstract; 
  234.    --  <dref>DataReader_get_sample_lost_status</dref> 
  235.    --  <internal> 
  236.    --  Returns the StatusKind.SAMPLE_LOST_STATUS_STATUS communication status 
  237.    --  </internal> 
  238.  
  239.    procedure Get_Datareader_Cache_Status 
  240.      (Self : not null access Ref; 
  241.       Status : in out DDS.DataReaderCacheStatus) is abstract; 
  242.    --  <dref>DataReader_get_datareader_cache_status</dref> 
  243.    --  <internal> 
  244.    --  Returns the StatusKind.DATA_READER_CACHE_STATUS communication status 
  245.    --  </internal> 
  246.  
  247.    procedure Get_Datareader_Protocol_Status 
  248.      (Self : not null access Ref; 
  249.       Status : in out DDS.DataReaderProtocolStatus) is abstract; 
  250.    --  <dref>DataReader_get_datareader_protocol_status</dref> 
  251.    --  <internal> 
  252.    --  Returns the StatusKind.DATA_READER_PROTOCOL_STATUS communication status 
  253.    --  </internal> 
  254.  
  255.    procedure Get_Matched_Publication_Datareader_Protocol_Status 
  256.      (Self : not null access Ref; 
  257.       Status : in out DDS.DataReaderProtocolStatus; 
  258.       Publication_Handle : not null access DDS.InstanceHandle_T) is abstract; 
  259.    --  <dref>DataReader_get_matched_publication_datareader_protocol_status</dref> 
  260.    --  <internal> 
  261.    --  Returns the StatusKind.DATA_READER_PROTOCOL_STATUS communication status 
  262.    --  for this reader, per matched publication identified by the 
  263.    --  Publication_Handle. 
  264.    --  </internal> 
  265.  
  266.    procedure Wait_For_Historical_Data 
  267.      (Self     : not null access Ref; 
  268.       Max_Wait : in DDS.Duration_T) is abstract; 
  269.    --  <dref>DataReader_wait_for_historical_data</dref> 
  270.    --  <internal> 
  271.    --  Waits until all "historical" data is received for dds.DataReader entities 
  272.    --  that have a non-VOLATILE PERSISTENCE Qos kind. 
  273.    --  This operation is intended only for dds.DataReader entities that have a 
  274.    --  non-VOLATILE PERSISTENCE QoS kind. 
  275.    --  As soon as an application enables a non-VOLATILE dds.DataReader, it will 
  276.    --  start receiving both "historical" data, i.e. the data that was written 
  277.    --  prior to the time the dds.DataReader joined the domain, as well as any 
  278.    --  new data written by the dds.DataWriter entities. 
  279.    --  There are situations where the application logic may require the 
  280.    --  application to wait until all "historical" data is received. 
  281.    --  This is the purpose of the dds.DataReader.wait_for_historical_data operations. 
  282.    --  The operation dds.DataReader.wait_for_historical_data blocks the calling 
  283.    --  thread until either all "historical" data is received, or else duration 
  284.    --  specified by the max_wait parameter clapses, whichever happens first. 
  285.    --  A successful completion indicates that all the "historical" data was 
  286.    --  "received"; timing out indicates that max_wait elapsed before all the 
  287.    --  data was received 
  288.    --  </internal> 
  289.  
  290.  
  291.    function Get_Matched_Publications 
  292.      (Self    : not null access Ref) 
  293.       return DDS.InstanceHandle_Seq.Sequence is abstract; 
  294.    --  <dref>DataReader_get_matched_publications</dref> 
  295.    --  <internal> 
  296.    --  Retrieve the list of publications currently "associated" with this 
  297.    --  DDS.DataReader. 
  298.    --  Matching publications are those in the same domain that have a matching 
  299.    --  DDS.Topic, compatible QoS common partition that the DDS.DomainParticipant 
  300.    --  has not indicated should be "ignored" by means of the 
  301.    --  DDS.DomainParticipant.ignore_publication operation. 
  302.    --  The handles returned in the publication_handles' list are the ones that 
  303.    --  are used by the DDS implementation to locally identify the corresponding 
  304.    --  matched DDSDataWriter entities. 
  305.    --  These handles match the ones that appear in the instance_handle field 
  306.    --  of the DDS.SampleInfo when reading the 
  307.    --  PublicationBuiltinTopicDataTypeSupport.PUBLICATION_TOPIC_NAME builtin topic 
  308.    --  The sequence will be grown if the sequence has ownership and the system 
  309.    --  has the corresponding resources. Use a sequence without ownership to 
  310.    --  avoid dynamic memory allocation. If the sequence is too small to 
  311.    --  store all the matches and the system can not resize the sequence, 
  312.    --  this method will fail with RETCODE_OUT_OF_RESOURCES. 
  313.    --  The maximum number of matches possible is configured with 
  314.    --  DDS.DomainParticipantResourceLimitsQosPolicy. 
  315.    --  You can use a zero-maximum sequence without ownership to quickly check 
  316.    --  whether there are any matches without allocating any memory. 
  317.    --  </internal> 
  318.  
  319.    function Get_Matched_Publication_Data 
  320.      (Self               : not null access Ref; 
  321.       Publication_Handle : not null access DDS.InstanceHandle_T) 
  322.       return DDS.PublicationBuiltinTopicData is abstract; 
  323.    --  <dref>DataReader_get_matched_publication_data</dref> 
  324.    --  <internal> 
  325.    --  This operation retrieves the information on a publication that is 
  326.    --  currently "associated" with the dds.DataReader. 
  327.    --  Publication with a matching dds.Topic, compatible QoS and common 
  328.    --  partition that the application has not indicated should be "ignored" 
  329.    --  by means of the dds.DomainParticipant.ignore_publication operation. 
  330.    --  The publication_handle must correspond to a publication currently 
  331.    --  associated with the dds.DataReader. Otherwise, the operation will fail 
  332.    --   with RETCODE_BAD_PARAMETER. 
  333.    --  use the operation dds.DataReader.get_matched_publications to find the 
  334.    --  publications that are currently matched with the DDS.DataReader. 
  335.    --  </internal> 
  336.  
  337. end DDS.DataReader;