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

src/hpp/dds/pub/DataWriter.hpp

Go to the documentation of this file.
00001 #ifndef OMG_DDS_PUB_DATA_WRITER_HPP_
00002 #define OMG_DDS_PUB_DATA_WRITER_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/corefwd.hpp>
00023 #include <dds/core/InstanceHandle.hpp>
00024 #include <dds/topic/topicfwd.hpp>
00025 #include <dds/topic/BuiltinTopic.hpp>
00026 #include <dds/pub/pubfwd.hpp>
00027 #include <dds/pub/detail/DataWriter.hpp>
00028 #include <dds/pub/qos/DataWriterQos.hpp>
00029 
00030 
00031 namespace dds { namespace pub {
00032 
00033 template <typename T, template <typename Q> class DELEGATE>
00034 class DataWriter : public tdds::core::Entity< DELEGATE<T> >{
00035 public:
00036     typedef dds::pub::DataWriterListener<T>              Listener;
00037     typedef dds::core::cond::StatusCondition<DataWriter> StatusCondition;
00038 
00039 public:
00040     OMG_DDS_REF_TYPE(DataWriter, tdds::core::Entity, DELEGATE<T>)
00041 public:
00042     ~DataWriter() { }
00043 
00044 public:
00054     StatusCondition status_condition() const{
00055         return this->delegate()->template status_condition<DataWriter>(*this);
00056     }
00057 
00058 public:
00059     //==========================================================================
00060     //== Write API
00061     void write(const T& sample) {
00062         this->delegate()->write(sample);
00063     }
00064 
00065     void write(const T& sample, const dds::core::Time& timestamp) {
00066         this->delegate()->write(sample, timestamp);
00067     }
00068 
00069     void write(const T& data, const dds::core::InstanceHandle& instance) {
00070         this->delegate()->write(data, instance);
00071     }
00072 
00073     void write(const T& data,
00074                const dds::core::InstanceHandle& instance,
00075                const dds::core::Time& timestamp) {
00076         this->delegate()->write(data, instance, timestamp);
00077     }
00078 
00079     void write(const dds::topic::TopicInstance<T>& i) {
00080         this->delegate()->write(i);
00081     }
00082 
00083     void write(const dds::topic::TopicInstance<T>& i, const dds::core::Time& timestamp) {
00084         this->delegate()->write(i, timestamp);
00085     }
00086 
00091     template <typename FWIterator>
00092     void write(const FWIterator& begin, const FWIterator& end) {
00093         while (begin != end) {
00094             this->delegate()->write(*begin);
00095             ++begin;
00096         }
00097     }
00098 
00099     template <typename FWIterator>
00100     void write(const FWIterator& begin, const FWIterator& end,
00101             const dds::core::Time& timestamp) {
00102         while (begin != end) {
00103             this->delegate()->write(*begin, timestamp);
00104             ++begin;
00105         }
00106     }
00107 
00111     template <typename SamplesFWIterator, typename HandlesFWIterator>
00112     void write(const SamplesFWIterator& data_begin,
00113                const SamplesFWIterator& data_end,
00114                const HandlesFWIterator& handle_begin,
00115                const HandlesFWIterator& handle_end) {
00116         while (data_begin != data_end && handle_begin != handle_end) {
00117             this->delegate()->write(*data_begin, *handle_begin);
00118             ++data_begin; ++handle_begin;
00119         }
00120     }
00121 
00125     template <typename SamplesFWIterator, typename HandlesFWIterator>
00126     void write(const SamplesFWIterator& data_begin,
00127                const SamplesFWIterator& data_end,
00128                const HandlesFWIterator& handle_begin,
00129                const HandlesFWIterator& handle_end,
00130                const dds::core::Time& timestamp) {
00131         while (data_begin != data_end && handle_begin != handle_end) {
00132             this->delegate()->write(*data_begin, *handle_begin, timestamp);
00133             ++data_begin; ++handle_begin;
00134         }
00135     }
00136 
00137     template <typename DATA>
00138     void operator << (const DATA& data) {
00139         this->write(data);
00140     }
00141 
00142     //==========================================================================
00143     //== Instance Management
00144     const dds::core::InstanceHandle register_instance(const T& key) {
00145         return this->delegate()->register_instance(key);
00146     }
00147 
00148     const dds::core::InstanceHandle register_instance(const T& key,
00149             const dds::core::Time& ts) {
00150         return this->delegate()->register_instance(key, ts);
00151     }
00152 
00153     void unregister_instance(const dds::core::InstanceHandle& i) {
00154         this->delegate()->unregister_instance(i);
00155     }
00156 
00157     void unregister_instance(const dds::core::InstanceHandle& i,
00158                              const dds::core::Time& ts) {
00159         this->delegate()->unregister_instance(i,ts);
00160     }
00161 
00162     void dispose_instance(const dds::core::InstanceHandle& i) {
00163         this->delegate()->dispose_instance(i);
00164     }
00165 
00166     void dispose_instance(const dds::core::InstanceHandle& i,
00167                           const dds::core::Time& ts) {
00168         this->delegate()->dispose_instance(i,ts);
00169     }
00170 
00180     dds::topic::TopicInstance<T>& key_value(dds::topic::TopicInstance<T>& i,
00181                                             const dds::core::InstanceHandle& h) {
00182         return this->delegate()->key_value(i, h);
00183     }
00184 
00194     T& key_value(T& sample, const dds::core::InstanceHandle& h) {
00195         return this->delegate()->key_value(sample, h);
00196     }
00197 
00208     const dds::core::InstanceHandle lookup_instance(const T& key) {
00209         return this->delegate()->lookup_instance(key);
00210     }
00211 
00212     //==========================================================================
00213     //== QoS Management
00214 
00215     using tdds::core::Entity< DELEGATE<T> >::qos;
00216 
00217     const dds::pub::qos::DataWriterQos qos() const {
00218         return this->delegate()->qos();
00219     }
00220 
00221     void qos(const dds::pub::qos::DataWriterQos& the_qos) {
00222         this->delegate()->qos(the_qos);
00223     }
00224 
00225     DataWriter& operator <<(const dds::pub::qos::DataWriterQos& the_qos) {
00226         this->delegate()->qos(the_qos);
00227         return *this;
00228     }
00229 
00230     const DataWriter& operator >> (dds::pub::qos::DataWriterQos& the_qos) const {
00231         the_qos = this->delegate()->qos();
00232         return *this;
00233     }
00234 
00235 
00236     //==========================================================================
00237     //== Entity Navigation
00238     dds::topic::Topic<T> topic() const {
00239         return this->delegate()->topic();
00240     }
00241 
00242 
00243     //==========================================================================
00244     //== ACKs
00245 
00255     void wait_for_acknowledgments(const dds::core::Duration& timeout) {
00256         this->delegate()->wait_for_acknowledgments(timeout);
00257     }
00258 
00259     //==========================================================================
00260     //== Listeners Management
00261 
00269     void listener(
00270             DataWriterListener<T>* the_listener,
00271             const dds::core::status::StatusMask& mask) {
00272         this->delegate()->listener(the_listener, mask);
00273     }
00274 
00280     DataWriterListener<T>* listener() const {
00281         return this->delegate()->listener();
00282     }
00283 
00284     //==========================================================================
00285     //== Status Management
00286 
00287     const dds::core::status::LivelinessLostStatus liveliness_lost_status() {
00288         return this->delegate()->liveliness_lost_status();
00289     }
00290 
00291     const dds::core::status::OfferedDeadlineMissedStatus offered_deadlined_missed_status() {
00292         return this->delegate()->offered_deadlined_missed_status();
00293     }
00294 
00295     const dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_staus() {
00296         return this->delegate()->offered_incompatible_qos_staus();
00297     }
00298 
00299     const dds::core::status::PublicationMatchedStatus publication_matched_status() {
00300         return this->delegate()->publication_matched_status();
00301     }
00302 
00303 
00304     //==========================================================================
00305     //== Liveliness Management
00306     void assert_liveliness() {
00307         return this->delegate()->assert_liveliness();
00308     }
00309 
00310     //==========================================================================
00311     //== Discovery Management
00312 
00325     const dds::core::InstanceHandleSeq matched_subscriptions() {
00326         return this->delegate()->matched_subscriptions();
00327     }
00328 
00341     dds::core::InstanceHandleSeq& matched_subscriptions(dds::core::InstanceHandleSeq& subs) {
00342         return this->delegate()->matched_subscriptions(subs);
00343     }
00344 
00360     const dds::topic::SubscriptionBuiltinTopicData
00361     matched_subscription_data(const dds::core::InstanceHandle& h) {
00362         return this->delegate()->matched_subscription_data(h);
00363     }
00364 };
00365 
00366 } }
00367 
00368 #endif /* OMG_DDS_PUB_DATA_WRITER_HPP_ */

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