Cyclone ISO C++ API Reference Guide
DataReader.hpp
Go to the documentation of this file.
1 #ifndef OMG_DDS_SUB_TDATA_READER_HPP_
2 #define OMG_DDS_SUB_TDATA_READER_HPP_
3 
4 /* Copyright 2010, Object Management Group, Inc.
5  * Copyright 2010, PrismTech, Corp.
6  * Copyright 2010, Real-Time Innovations, Inc.
7  * All rights reserved.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 #include <dds/core/detail/conformance.hpp>
26 #include <dds/sub/Subscriber.hpp>
27 
28 
29 namespace dds
30 {
31 namespace sub
32 {
33 template <typename T>
34 class DataReader;
35 
36 template <typename T>
38 }
39 }
40 
104 template <typename T>
106 {
107 
108 public:
112  typedef ::dds::sub::DataReaderListener<T> Listener;
113 
114 public:
115 
163  class Selector
164  {
165  public:
171  Selector(DataReader& dr);
172 
195 
239 
263 
286  Selector& content(const dds::sub::Query& query);
287 
307  Selector& max_samples(uint32_t maxsamples);
308 
328 
348 
349  // --- Forward Iterators: --- //
370  template <typename SamplesFWIterator>
371  uint32_t
372  read(SamplesFWIterator sfit, uint32_t max_samples);
373 
394  template <typename SamplesFWIterator>
395  uint32_t
396  take(SamplesFWIterator sfit, uint32_t max_samples);
397 
398  // --- Back-Inserting Iterators: --- //
418  template <typename SamplesBIIterator>
419  uint32_t
420  read(SamplesBIIterator sbit);
421 
441  template <typename SamplesBIIterator>
442  uint32_t
443  take(SamplesBIIterator sbit);
444 
445  private:
446  typename DELEGATE<T>::Selector impl_;
447  };
448 
509  {
510  public:
520 
530  bool read_mode();
531 
566  void read_mode(bool readmode);
567 
589  ManipulatorSelector& max_samples(uint32_t n);
590 
615 
661 
687 
713 
733 
753 
771  template <typename Functor>
773  operator >> (Functor f);
774 
775  private:
776  typename DELEGATE<T>::ManipulatorSelector impl_;
777 
778  };
779 
780 public:
783 
784 public:
803  DataReader(const dds::sub::Subscriber& sub,
804  const ::dds::topic::Topic<T>& topic);
805 
856  DataReader(const dds::sub::Subscriber& sub,
857  const ::dds::topic::Topic<T>& topic,
861 
862  #ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
863 
865  DataReader(const dds::sub::Subscriber& sub,
866  const ::dds::topic::ContentFilteredTopic<T>& topic);
867 
869  DataReader(const dds::sub::Subscriber& sub,
870  const ::dds::topic::ContentFilteredTopic<T>& topic,
874  #endif /* OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT */
875 
876  #ifdef OMG_DDS_MULTI_TOPIC_SUPPORT
877 
879  DataReader(const dds::sub::Subscriber& sub,
880  const ::dds::topic::MultiTopic<T>& topic);
881 
883  DataReader(const dds::sub::Subscriber& sub,
884  const ::dds::topic::MultiTopic<T>& topic,
888 
889  #endif /* OMG_DDS_MULTI_TOPIC_SUPPORT */
890 
891 public:
893  virtual ~DataReader();
896 public:
897  // == ReadState Management
898 
908 
923 
924  //== Streaming read/take
925 
1026 
1030 
1032  template <typename Functor>
1034  operator>> (Functor f);
1035 
1036 
1038 public:
1039  //== Loan Read/Take API ==================================================
1040 
1116 
1181 
1182  //== Copy Read/Take API ==================================================
1183 
1184  // --- Forward Iterators: --- //
1185 
1244  template <typename SamplesFWIterator>
1245  uint32_t
1246  read(SamplesFWIterator sfit,
1247  uint32_t max_samples);
1248 
1307  template <typename SamplesFWIterator>
1308  uint32_t
1309  take(SamplesFWIterator sfit,
1310  uint32_t max_samples);
1311 
1312 
1313  // --- Back-Inserting Iterators: --- //
1314 
1373  template <typename SamplesBIIterator>
1374  uint32_t
1375  read(SamplesBIIterator sbit);
1376 
1435  template <typename SamplesBIIterator>
1436  uint32_t
1437  take(SamplesBIIterator sbit);
1438 public:
1439  //========================================================================
1440  //== DSL Method for dealing with instances, content and status filters.
1441 
1492  Selector select();
1493 
1494  //========================================================================
1495  //== Instance Management
1496 public:
1526 
1558  T& key_value(T& sample, const dds::core::InstanceHandle& h);
1559 
1582  lookup_instance(const T& key) const;
1583 
1584 public:
1585 
1677  void listener(Listener* listener,
1678  const dds::core::status::StatusMask& event_mask);
1679 
1689  Listener* listener() const;
1690 };
1691 
1692 
1693 #endif /* OMG_DDS_SUB_TDATA_READER_HPP_ */
dds::sub::Query
Query objects contain expressions that allow the application to specify a filter on the locally avail...
Definition: Query.hpp:61
dds::sub::Subscriber
A Subscriber is the object responsible for the actual reception of the data resulting from its subscr...
Definition: Subscriber.hpp:53
dds::sub::DataReader::Selector::read
dds::sub::LoanedSamples< T > read()
dds::sub::DataReader::ManipulatorSelector::read_mode
bool read_mode()
AnyDataReader.hpp
ContentFilteredTopic.hpp
dds::sub::DataReader::key_value
dds::topic::TopicInstance< T > key_value(const dds::core::InstanceHandle &h)
dds::sub::status::DataState
Class to hold sample DataState information.
Definition: DataState.hpp:371
dds::sub::DataReader::ManipulatorSelector::operator>>
ManipulatorSelector & operator>>(dds::sub::LoanedSamples< T > &samples)
dds::sub::DataReader::ManipulatorSelector::state
ManipulatorSelector & state(const dds::sub::status::DataState &state)
dds::core::status::StatusMask
StatusMask is a bitmap or bitset field.
Definition: State.hpp:144
OMG_DDS_IMPLICIT_REF_BASE
#define OMG_DDS_IMPLICIT_REF_BASE(TYPE)
Definition: refmacros.hpp:75
dds::sub::DataReader::ManipulatorSelector::content
ManipulatorSelector & content(const dds::sub::Query &query)
dds::core::InstanceHandle
Class to hold the handle associated with in sample instance.
Definition: InstanceHandle.hpp:40
dds::sub::DataReader::lookup_instance
const dds::core::InstanceHandle lookup_instance(const T &key) const
dds::sub::DataReader::listener
Listener * listener() const
dds::sub::DataReader::read
LoanedSamples< T > read()
dds::core::status::StatusMask::none
static StatusMask none()
Definition: State.hpp:205
dds::sub::AnyDataReader::qos
dds::sub::qos::DataReaderQos qos() const
dds::sub::LoanedSamples
This class encapsulates and automates the management of loaned samples.
Definition: LoanedSamples.hpp:87
dds::sub::DataReader::Selector::next_instance
Selector & next_instance(const dds::core::InstanceHandle &handle)
dds::topic::TopicInstance
A TopicInstance encapsulates a dds::sub::Sample and its associated dds::core::InstanceHandle.
Definition: TopicInstance.hpp:30
dds::sub::DataReader::DataReader
DataReader(const dds::sub::Subscriber &sub, const ::dds::topic::Topic< T > &topic)
dds::sub::DataReader::Selector::take
dds::sub::LoanedSamples< T > take()
dds
Definition: array.hpp:30
dds::sub::AnyDataReader
Typeless base class for the typed DataReader.
Definition: AnyDataReader.hpp:50
OMG_DDS_REF_TYPE_PROTECTED_DC_T
#define OMG_DDS_REF_TYPE_PROTECTED_DC_T(TYPE, BASE, T_PARAM, DELEGATE)
Definition: refmacros.hpp:171
dds::sub::DataReader::select
Selector select()
dds::sub::DataReader::operator>>
DataReader & operator>>(dds::sub::LoanedSamples< T > &ls)
Subscriber.hpp
dds::sub::DataReader::Selector::state
Selector & state(const dds::sub::status::DataState &state)
dds::sub::DataReader::ManipulatorSelector::next_instance
ManipulatorSelector & next_instance(const dds::core::InstanceHandle &handle)
dds::sub::DataReaderListener
DataReader events Listener.
Definition: DataReader.hpp:37
dds::sub::DataReader::ManipulatorSelector::ManipulatorSelector
ManipulatorSelector(DataReader &dr)
dds::sub::DataReader::take
LoanedSamples< T > take()
dds::sub::DataReader::Selector::Selector
Selector(DataReader &dr)
dds::sub::DataReader::Selector::max_samples
Selector & max_samples(uint32_t maxsamples)
dds::sub::DataReader::Listener
::dds::sub::DataReaderListener< T > Listener
Definition: DataReader.hpp:112
dds::sub::DataReader::ManipulatorSelector
Definition: DataReader.hpp:508
LoanedSamples.hpp
dds::sub::DataReader
DataReader allows the applicatin to access published sample data.
Definition: DataReader.hpp:34
dds::sub::qos::DataReaderQos
This class provides the basic mechanism for an application to specify Quality of Service attributes f...
Definition: DataReaderQos.hpp:66
dds::sub::DataReader::default_filter_state
dds::sub::status::DataState default_filter_state()
dds::sub::DataReader::Selector::instance
Selector & instance(const dds::core::InstanceHandle &handle)
dds::sub::DataReader::ManipulatorSelector::max_samples
ManipulatorSelector & max_samples(uint32_t n)
dds::sub::DataReader::Selector::content
Selector & content(const dds::sub::Query &query)
dds::sub::DataReader::Selector
Definition: DataReader.hpp:163
TopicInstance.hpp
dds::sub::DataReader::ManipulatorSelector::instance
ManipulatorSelector & instance(const dds::core::InstanceHandle &handle)