00001 #ifndef OMG_DDS_SUB_DETAIL_ANY_DATAREADER_HPP_ 00002 #define OMG_DDS_SUB_DETAIL_ANY_DATAREADER_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/sub/qos/DataReaderQos.hpp> 00023 #include <dds/sub/Subscriber.hpp> 00024 #include <dds/sub/parent.hpp> 00025 00026 namespace dds { namespace sub { namespace detail { 00027 class DRHolderBase { 00028 public: 00029 virtual ~DRHolderBase(); 00030 virtual const ::dds::sub::qos::DataReaderQos qos() const = 0; 00031 00032 virtual void qos(const dds::sub::qos::DataReaderQos& qos) = 0; 00033 00034 virtual const std::string topic_name() const = 0; 00035 00036 virtual const std::string type_name() const = 0; 00037 00038 virtual ::dds::sub::Subscriber parent() const = 0; 00039 00040 virtual void close() = 0; 00041 00042 // TODO: Add other non type-dependent methods. 00043 }; 00044 00045 template <typename DR> 00046 class DRHolder : public DRHolderBase { 00047 public: 00048 DRHolder(const DR& dr) : DR_(dr) { } 00049 virtual ~DRHolder() { } 00050 public: 00051 virtual const dds::sub::qos::DataReaderQos qos() const { 00052 return DR_.qos(); 00053 } 00054 00055 virtual void qos(const dds::sub::qos::DataReaderQos& the_qos) { 00056 return DR_.qos(the_qos); 00057 } 00058 00059 virtual const std::string topic_name() const { 00060 return DR_.topic().name(); 00061 } 00062 00063 virtual const std::string type_name() const { 00064 return DR_.topic().type_name(); 00065 } 00066 00067 virtual ::dds::sub::Subscriber parent() const { 00068 return parent(DR_); 00069 } 00070 00071 virtual void close() { 00072 DR_.close(); 00073 } 00074 00075 private: 00076 DR DR_; 00077 }; 00078 } } } 00079 00080 00081 #endif /* OMG_DDS_SUB_DETAIL_ANY_DATAREADER_HPP_ */
1.7.1