• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/hpp/dds/sub/ReaderQuery.hpp

Go to the documentation of this file.
00001 #ifndef OMG_DDS_SUB_READER_QUERY_HPP_
00002 #define OMG_DDS_SUB_READER_QUERY_HPP_
00003 
00004 /* Copyright 2010, Object Management Group, Inc.
00005  * Copyright 2010, PrismTech, Corp.
00006  * Copyright 2010, Real-Time Innovations, Inc.
00007  * All rights reserved.
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License");
00010  * you may not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  *     http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS,
00017  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #include <dds/core/InstanceHandle.hpp>
00023 #include <dds/sub/subfwd.hpp>
00024 #include <dds/sub/status/ReaderState.hpp>
00025 #include <dds/sub/cond/ReadCondition.hpp>
00026 
00027 
00028 namespace dds { namespace sub {
00029 
00034 template <typename T>
00035 class ReaderQuery {
00036     // --- Type Aliases: --- //
00037 public:
00038     typedef ::dds::sub::cond::ReadCondition<T> ReadCondition;
00039 
00040     // --- Default Construction & Destruction: --- //
00041 public:
00042     ReaderQuery()
00043     : instance_(), read_or_take_next_(false),
00044       reader_state_(dds::sub::status::ReaderState::any()),
00045       condition_()
00046     { }
00047 
00048     ~ReaderQuery() { }
00049 
00050     // --- Copy: --- //
00051 public:
00052     ReaderQuery(const ReaderQuery& src)
00053     : instance_(src._instance),
00054       read_or_take_next_(src.read_or_take_next_),
00055       reader_state_(src.reader_state_),
00056       condition_(src.condition_)
00057     { }
00058 
00059     ReaderQuery& operator =(const ReaderQuery& src) {
00060         instance_ = src._instance;
00061         read_or_take_next_ = src.read_or_take_next_;
00062         reader_state_ = src.reader_state_;
00063         condition_ = src.condition_;
00064     }
00065 
00066     // --- Conversion: --- //
00067 public:
00072     /* implicit */ ReaderQuery(const ::dds::sub::status::ReaderState& src)
00073     : instance_(),
00074       read_or_take_next_(false),
00075       reader_state_(src),
00076       condition_()
00077     { }
00078 
00084     /* implicit */ ReaderQuery(const ReadCondition& src)
00085     : instance_(),
00086       read_or_take_next_(false),
00087       reader_state_(src.reader_state()),
00088       condition_(src)
00089     { }
00090 
00103     /* implicit */ ReaderQuery(const ::dds::core::InstanceHandle& src,
00104                                bool read_or_take_next = false)
00105     : instance_(src),
00106       read_or_take_next_(read_or_take_next),
00107       reader_state_(dds::sub::status::ReaderState::any()),
00108       condition_()
00109     { }
00110 
00123     ReaderQuery(const ::dds::sub::status::ReaderState& state,
00124                 const ::dds::core::InstanceHandle& handle,
00125                 bool read_or_take_next = false)
00126     : instance_(handle),
00127       read_or_take_next_(read_or_take_next),
00128       reader_state_(state),
00129       condition_()
00130     { }
00131 
00145     ReaderQuery(const ReadCondition& cond,
00146                 const ::dds::core::InstanceHandle& handle,
00147                 bool read_or_take_next = false)
00148     : instance_(handle),
00149       read_or_take_next_(read_or_take_next),
00150       reader_state_(cond.reader_state()),
00151       condition_(cond)
00152     { }
00153 
00154     // --- Query Access: --- //
00155 public:
00162     const dds::core::InstanceHandle instance() const {
00163         return instance_;
00164     }
00165 
00173     bool is_read_or_take_next() const {
00174         return read_or_take_next_;
00175     }
00176 
00185     const dds::sub::status::ReaderState reader_state() const {
00186         return reader_state_;
00187     }
00188 
00194     ReadCondition condition() const {
00195         return condition_;
00196     }
00197 
00198 private:
00199     dds::core::InstanceHandle instance_;
00200     bool read_or_take_next_;
00201     dds::sub::status::ReaderState reader_state_;
00202     ReadCondition condition_;
00203 };
00204 
00205 } }
00206 
00207 #endif /* OMG_DDS_SUB_READER_QUERY_HPP_ */

Generated on Tue Nov 9 2010 02:16:21 for dds-psm-cxx-doc by  doxygen 1.7.1