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. with DDS.DataReader; 
  12. with DDS.Domain_Entity_Impl; 
  13. with DDS.Subscriber; 
  14. with DDS.Topic; 
  15. with DDS.TopicDescription; 
  16. with DDS.DataReaderListener; 
  17. with DDS.QueryCondition; 
  18. with DDS.ReadCondition; 
  19. with DDS.MetpTypeSupport; 
  20.  
  21. with System; 
  22. with RTIDDS.Low_Level.ndds_reda_reda_worker_impl_h; 
  23. with RTIDDS.Low_Level.ndds_dds_c_dds_c_infrastructure_h; use RTIDDS.Low_Level.ndds_dds_c_dds_c_infrastructure_h; 
  24.  
  25. package DDS.DataReader_Impl is 
  26.  
  27.    type Ref is new DDS.Domain_Entity_Impl.Ref and DDS.DataReader.Ref with private; 
  28.    type Ref_Access is access all Ref'Class; 
  29.  
  30.    function Create_Readcondition 
  31.      (Self            : not null access Ref; 
  32.       Sample_States   : in DDS.SampleStateMask; 
  33.       View_States     : in DDS.ViewStateMask; 
  34.       Instance_States : in DDS.InstanceStateMask) 
  35.       return DDS.ReadCondition.Ref_Access; 
  36.  
  37.    function Create_Querycondition 
  38.      (Self             : not null access Ref; 
  39.       Sample_States    : in DDS.SampleStateMask; 
  40.       View_States      : in DDS.ViewStateMask; 
  41.       Instance_States  : in DDS.InstanceStateMask; 
  42.       Query_Expression : in DDS.String; 
  43.       Query_Parameters : in DDS.String_Seq.Sequence) 
  44.       return DDS.QueryCondition.Ref_Access; 
  45.  
  46.    procedure Delete_Readcondition 
  47.      (Self        : not null access Ref; 
  48.       A_Condition : access DDS.ReadCondition.Ref'Class); 
  49.  
  50.    procedure  Delete_Contained_Entities 
  51.      (Self : not null access Ref); 
  52.    --  Deletes all the entities that were created by means of the "create" operations on the DDS_DataReader. 
  53.    --  Deletes all contained DDS_ReadCondition and DDS_QueryCondition objects. 
  54.    --  Once DDS_DataReader_delete_contained_entities returns successfully, 
  55.    --  the application may delete the DDS_DataReader, knowing that it has no contained 
  56.    --- DDS_ReadCondition and DDS_QueryCondition objects. 
  57.    --      rasies exception on error 
  58.  
  59.    procedure Set_Qos 
  60.      (Self : not null access Ref; 
  61.       Qos  : in DDS.DataReaderQoS); 
  62.  
  63.    procedure Set_Qos_With_Profile 
  64.      (Self          : not null access Ref; 
  65.       Library_Name  : in String; 
  66.       Profile_Name  : in String); 
  67.    procedure Set_Qos_With_Profile 
  68.      (Self          : not null access Ref; 
  69.       Library_Name  : in Standard.String; 
  70.       Profile_Name  : in Standard.String); 
  71.  
  72.    procedure Get_Qos 
  73.      (Self : not null access Ref; 
  74.       Qos  : in out DDS.DataReaderQoS); 
  75.  
  76.    procedure Set_Listener 
  77.      (Self       : not null access Ref; 
  78.       A_Listener : in DDS.DataReaderListener.Ref_Access; 
  79.       Mask       : in DDS.StatusMask); 
  80.  
  81.    function Get_Listener 
  82.      (Self : not null access Ref) 
  83.       return DDS.DataReaderListener.Ref_Access; 
  84.  
  85.    procedure Call_ListnerT 
  86.      (Self       : not null access Ref; 
  87.       A_Listener : in DDS.DataReaderListener.Ref_Access; 
  88.       Mask       : in DDS.StatusMask); 
  89.  
  90.    function Get_Topicdescription 
  91.      (Self : not null access Ref) 
  92.       return DDS.TopicDescription.Ref_Access; 
  93.  
  94.    function Get_Subscriber 
  95.      (Self : not null access Ref) 
  96.       return access DDS.Subscriber.Ref'Class; 
  97.  
  98.    procedure Get_Sample_Rejected_Status 
  99.      (Self   : not null access Ref; 
  100.       Status : in out DDS.SampleRejectedStatus); 
  101.  
  102.    procedure Get_Liveliness_Changed_Status 
  103.      (Self   : not null access Ref; 
  104.       Status : in out DDS.LivelinessChangedStatus); 
  105.  
  106.    procedure Get_Requested_Deadline_Missed_Status 
  107.      (Self   : not null access Ref; 
  108.       Status : in out DDS.RequestedDeadlineMissedStatus); 
  109.  
  110.    procedure Get_Requested_Incompatible_Qos_Status 
  111.      (Self   : not null access Ref; 
  112.       Status : in out DDS.RequestedIncompatibleQosStatus); 
  113.  
  114.    procedure Get_Subscription_Matched_Status 
  115.      (Self   : not null access Ref; 
  116.       Status : in out DDS.SubscriptionMatchedStatus); 
  117.  
  118.    procedure Get_Sample_Lost_Status 
  119.      (Self   : not null access Ref; 
  120.       Status : in out DDS.SampleLostStatus); 
  121.  
  122.    procedure Get_Datareader_Cache_Status 
  123.      (Self   : not null access Ref; 
  124.       Status : in out DDS.DataReaderCacheStatus); 
  125.  
  126.    procedure Get_Datareader_Protocol_Status 
  127.      (Self   : not null access Ref; 
  128.       Status : in out DDS.DataReaderProtocolStatus); 
  129.  
  130.    procedure Get_Matched_Publication_Datareader_Protocol_Status 
  131.      (Self               : not null access Ref; 
  132.       Status             : in out DDS.DataReaderProtocolStatus; 
  133.       Publication_Handle : not null access DDS.InstanceHandle_T); 
  134.  
  135.    procedure Wait_For_Historical_Data 
  136.      (Self     : not null access Ref; 
  137.       Max_Wait : in DDS.Duration_T); 
  138.  
  139.    function Get_Matched_Publications 
  140.      (Self                : not null access Ref) 
  141.       return DDS.InstanceHandle_Seq.Sequence; 
  142.  
  143.    function Get_Matched_Publication_Data 
  144.      (Self               : not null access Ref; 
  145.       Publication_Handle : not null access DDS.InstanceHandle_T) 
  146.       return DDS.PublicationBuiltinTopicData; 
  147.  
  148.    procedure Free (This : in out Ref_Access); 
  149.  
  150.    function CreateI (Subscriber : not null DDS.Subscriber.Ref_Access; 
  151.                      Topic      : not null access DDS.TopicDescription.Ref'Class; 
  152.                      Qos        : in DDS.DataReaderQoS; 
  153.                      Listener   : in DDS.DataReaderListener.Ref_Access; 
  154.                      Mask       : in DDS.StatusMask) 
  155.                      return DDS.DataReader.Ref_Access; 
  156.  
  157.    function CreateI (Subscriber   : not null DDS.Subscriber.Ref_Access; 
  158.                      Topic        : not null access DDS.TopicDescription.Ref'Class; 
  159.                      Library_Name : in DDS.String; 
  160.                      Profile_Name : in DDS.String; 
  161.                      Listener     : in DDS.DataReaderListener.Ref_Access; 
  162.                      Mask         : in DDS.StatusMask) 
  163.                      return DDS.DataReader.Ref_Access; 
  164.  
  165.    function Create_WrapperI (Subscriber   : not null DDS.Subscriber.Ref_Access; 
  166.                              C_DataReader : System.Address; 
  167.                              Topic        : not null access DDS.Topic.Ref'Class) 
  168.                              return Ref_Access; 
  169.  
  170.    function Get_FacadeI (C_DataReader : System.Address) 
  171.                          return Ref_Access; 
  172.  
  173.  
  174.    procedure Read_Or_Take_UntypedI 
  175.      (Self                                : not null access constant Ref; 
  176.       Is_Loan                             : out DDS.Boolean; 
  177.       Received_Data                       : System.Address; 
  178.       Data_Count                          : out Natural; 
  179.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  180.       Data_Seq_Len                        : Long_Integer; 
  181.       Data_Seq_Max_Len                    : Long_Integer; 
  182.       Data_Seq_Has_Ownership              : Long_Integer; 
  183.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  184.       Data_Size                           : Integer; 
  185.       Max_Samples                         : Long_Integer; 
  186.       Sample_States                       : SampleStateMask; 
  187.       View_States                         : ViewStateMask; 
  188.       Instance_States                     : InstanceStateMask; 
  189.       Take                                : DDS.Boolean); 
  190.    function Read_Or_Take_UntypedI 
  191.      (Self                                : not null access constant Ref; 
  192.       Is_Loan                             : access DDS.Boolean; 
  193.       Received_Data                       : System.Address; 
  194.       Data_Count                          : access Natural; 
  195.       Info_Seq                            : SampleInfo_Seq.Sequence_Access; 
  196.       Data_Seq_Len                        : Long_Integer; 
  197.       Data_Seq_Max_Len                    : Long_Integer; 
  198.       Data_Seq_Has_Ownership              : Long_Integer; 
  199.       Data_Seq_Contiguous_Buffer_For_Copy : System.Address; 
  200.       Data_Size                           : Integer; 
  201.       Max_Samples                         : Long_Integer; 
  202.       Sample_States                       : SampleStateMask; 
  203.       View_States                         : ViewStateMask; 
  204.       Instance_States                     : InstanceStateMask; 
  205.       Take                                : DDS.Boolean) return DDS_ReturnCode_t; 
  206.  
  207.  
  208.    procedure ReadI 
  209.      (Self            : not null access Ref; 
  210.       Received_Data   : System.Address; 
  211.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  212.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  213.       Sample_States   : in Standard.DDS.SampleStateMask := Standard.DDS.ANY_SAMPLE_STATE; 
  214.       View_States     : in Standard.DDS.ViewStateMask := Standard.DDS.ANY_VIEW_STATE; 
  215.       Instance_States : in Standard.DDS.InstanceStateMask := Standard.DDS.ANY_INSTANCE_STATE); 
  216.  
  217.    procedure TakeI 
  218.      (Self            : not null access Ref; 
  219.       Received_Data   : System.Address; 
  220.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  221.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  222.       Sample_States   : in Standard.DDS.SampleStateMask := Standard.DDS.ANY_SAMPLE_STATE; 
  223.       View_States     : in Standard.DDS.ViewStateMask := Standard.DDS.ANY_VIEW_STATE; 
  224.       Instance_States : in Standard.DDS.InstanceStateMask := Standard.DDS.ANY_INSTANCE_STATE); 
  225.  
  226.    procedure Read_W_Condition 
  227.      (Self          : not null access Ref; 
  228.       Received_Data : System.Address; 
  229.       Info_Seq      : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  230.       Max_Samples   : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  231.       Condition     : access Standard.DDS.ReadCondition.Ref'Class); 
  232.  
  233.    function Read_W_Condition 
  234.      (Self          : not null access Ref; 
  235.       Received_Data : System.Address; 
  236.       Info_Seq      : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  237.       Max_Samples   : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  238.       Condition     : access Standard.DDS.ReadCondition.Ref'Class) return DDS_ReturnCode_t; 
  239.  
  240.  
  241.    procedure Take_W_Condition 
  242.      (Self          : not null access Ref; 
  243.       Received_Data : System.Address; 
  244.       Info_Seq      : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  245.       Max_Samples   : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  246.       Condition     : access Standard.DDS.ReadCondition.Ref'Class); 
  247.    function Take_W_Condition 
  248.      (Self          : not null access Ref; 
  249.       Received_Data : System.Address; 
  250.       Info_Seq      : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  251.       Max_Samples   : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  252.       Condition     : access Standard.DDS.ReadCondition.Ref'Class) return DDS_ReturnCode_t; 
  253.  
  254.  
  255.    procedure Read_Next_Sample 
  256.      (Self          : not null access Ref; 
  257.       Received_Data : System.Address; 
  258.       Sample_Info   : not null access Standard.DDS.SampleInfo); 
  259.  
  260.  
  261.    procedure Take_Next_Sample 
  262.      (Self          : not null access Ref; 
  263.       Received_Data : System.Address; 
  264.       Sample_Info   : not null access Standard.DDS.SampleInfo); 
  265.  
  266.  
  267.    procedure Read_Instance 
  268.      (Self            : not null access Ref; 
  269.       Received_Data   : System.Address; 
  270.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  271.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  272.       A_Handle        : access constant Standard.DDS.InstanceHandle_T; 
  273.       Sample_States   : in Standard.DDS.SampleStateMask := Standard.DDS.ANY_SAMPLE_STATE; 
  274.       View_States     : in Standard.DDS.ViewStateMask := Standard.DDS.ANY_VIEW_STATE; 
  275.       Instance_States : in Standard.DDS.InstanceStateMask := Standard.DDS.ANY_INSTANCE_STATE); 
  276.  
  277.  
  278.    procedure Take_Instance 
  279.      (Self            : not null access Ref; 
  280.       Received_Data   : System.Address; 
  281.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  282.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  283.       A_Handle        : access constant Standard.DDS.InstanceHandle_T; 
  284.       Sample_States   : in Standard.DDS.SampleStateMask := Standard.DDS.ANY_SAMPLE_STATE; 
  285.       View_States     : in Standard.DDS.ViewStateMask := Standard.DDS.ANY_VIEW_STATE; 
  286.       Instance_States : in Standard.DDS.InstanceStateMask := Standard.DDS.ANY_INSTANCE_STATE); 
  287.  
  288.  
  289.    procedure Read_Next_Instance 
  290.      (Self            : not null access Ref; 
  291.       Received_Data   : System.Address; 
  292.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  293.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  294.       Previous_Handle : access constant Standard.DDS.InstanceHandle_T; 
  295.       Sample_States   : in Standard.DDS.SampleStateMask := Standard.DDS.ANY_SAMPLE_STATE; 
  296.       View_States     : in Standard.DDS.ViewStateMask := Standard.DDS.ANY_VIEW_STATE; 
  297.       Instance_States : in Standard.DDS.InstanceStateMask := Standard.DDS.ANY_INSTANCE_STATE); 
  298.  
  299.  
  300.    procedure Take_Next_Instance 
  301.      (Self            : not null access Ref; 
  302.       Received_Data   : System.Address; 
  303.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  304.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  305.       Previous_Handle : access constant Standard.DDS.InstanceHandle_T; 
  306.       Sample_States   : in Standard.DDS.SampleStateMask := Standard.DDS.ANY_SAMPLE_STATE; 
  307.       View_States     : in Standard.DDS.ViewStateMask := Standard.DDS.ANY_VIEW_STATE; 
  308.       Instance_States : in Standard.DDS.InstanceStateMask := Standard.DDS.ANY_INSTANCE_STATE); 
  309.  
  310.  
  311.  
  312.    procedure Read_Next_Instance_W_Condition 
  313.      (Self            : not null access Ref; 
  314.       Received_Data   : System.Address; 
  315.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  316.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  317.       Previous_Handle : access constant Standard.DDS.InstanceHandle_T; 
  318.       Condition       : Standard.DDS.ReadCondition.Ref_Access); 
  319.    function Read_Next_Instance_W_Condition 
  320.      (Self            : not null access Ref; 
  321.       Received_Data   : System.Address; 
  322.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  323.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  324.       Previous_Handle : access constant Standard.DDS.InstanceHandle_T; 
  325.       Condition       : Standard.DDS.ReadCondition.Ref_Access) return DDS_ReturnCode_t; 
  326.  
  327.  
  328.  
  329.    procedure Take_Next_Instance_W_Condition 
  330.      (Self            : not null access Ref; 
  331.       Received_Data   : System.Address; 
  332.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  333.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  334.       Previous_Handle : access constant Standard.DDS.InstanceHandle_T; 
  335.       Condition       : Standard.DDS.ReadCondition.Ref_Access); 
  336.    function Take_Next_Instance_W_Condition 
  337.      (Self            : not null access Ref; 
  338.       Received_Data   : System.Address; 
  339.       Info_Seq        : not null access Standard.DDS.SampleInfo_Seq.Sequence; 
  340.       Max_Samples     : in Standard.DDS.Long := Standard.DDS.LENGTH_UNLIMITED; 
  341.       Previous_Handle : access constant Standard.DDS.InstanceHandle_T; 
  342.       Condition       : Standard.DDS.ReadCondition.Ref_Access) return DDS_ReturnCode_t; 
  343.  
  344.  
  345.  
  346.    procedure Return_Loan 
  347.      (Self          : not null access Ref; 
  348.       Received_Data : System.Address; 
  349.       Info_Seq      : not null access Standard.DDS.SampleInfo_Seq.Sequence); 
  350.  
  351.  
  352.    procedure Get_Key_Value 
  353.      (Self       : not null access Ref; 
  354.       Key_Holder : System.Address; 
  355.       Handle     : access constant Standard.DDS.InstanceHandle_T); 
  356.  
  357.  
  358.    function Lookup_Instance 
  359.      (Self       : not null access Ref; 
  360.       Key_Holder : System.Address) return Standard.DDS.InstanceHandle_T; 
  361.  
  362.    function Is_Data_ConsistentI 
  363.      (Self          : not null access constant Ref; 
  364.       Sample        : System.Address; 
  365.       Sample_Info   : not null DDS.SampleInfo_Access; 
  366.       MetpImpl      : DDS.MetpTypeSupport.Unsupported'Class) return Standard.Boolean; 
  367.  
  368.    procedure Finalize_Callback 
  369.      (Arg1 : System.Address; 
  370.       Arg2 : System.Address; 
  371.       Arg3 : access RTIDDS.Low_Level.ndds_reda_reda_worker_impl_h.REDAWorker); 
  372.    pragma Convention (C, Finalize_Callback); 
  373.  
  374. private 
  375.  
  376.    type Ref is new DDS.Domain_Entity_Impl.Ref and DDS.DataReader.Ref with null record; 
  377.  
  378.    procedure Free_Impl is new Ada.Unchecked_Deallocation (Ref'Class, Ref_Access); 
  379.    procedure Free (This : in out Ref_Access) renames Free_Impl; 
  380.  
  381.  
  382. end DDS.DataReader_Impl;