DDS-PSM-C++  1.0
ISO C++ API for OpenSplice DDS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
AnyDataWriter.hpp
Go to the documentation of this file.
1 #ifndef OMG_DDS_PUB_DETAIL_ANY_DATA_WRITER_HPP_
2 #define OMG_DDS_PUB_DETAIL_ANY_DATA_WRITER_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 
22 #include <string>
24 #include <dds/pub/Publisher.hpp>
25 #include <dds/pub/DataWriter.hpp>
26 
27 // NOTE: This code is non-normative and is provided only as a guide
28 // to implementor of this specification.
29 
30 namespace dds { namespace pub { namespace detail {
31  class DWHolderBase;
32  template <typename T> class DWHolder;
33 } } }
34 
36 public:
37  virtual ~DWHolderBase() { }
38 
39  virtual const dds::pub::qos::DataWriterQos& qos() const = 0;
40 
41  virtual void qos(const ::dds::pub::qos::DataWriterQos& qos) = 0;
42 
43  virtual const std::string& topic_name() const = 0;
44 
45  virtual const std::string& type_name() const = 0;
46 
47  virtual const dds::pub::Publisher& publisher() const = 0;
48 
49  virtual void wait_for_acknowledgments(const dds::core::Duration& timeout) = 0;
50 
51  virtual void close() = 0;
52 
53  virtual void retain(bool b) = 0;
54 };
55 
56 template <typename T>
58 public:
59  DWHolder(const dds::pub::DataWriter<T>& dw) : dw_(dw) { }
60  virtual ~DWHolder() { }
61 public:
63  return dw_.qos();
64  }
65 
66  virtual void qos(const ::dds::pub::qos::DataWriterQos& the_qos) {
67  dw_.qos(the_qos);
68  }
69 
70  virtual const std::string& topic_name() const {
71  return dw_.topic().name();
72  }
73 
74  virtual const std::string& type_name() const {
75  return dw_.topic().type_name();
76  }
77 
79  return dw_.publisher();
80  }
81 
82  virtual void wait_for_acknowledgments(const dds::core::Duration& timeout) {
83  dw_.wait_for_acknowledgments(timeout);
84  }
85 
86  virtual void close() {
87  dw_.close();
88  }
89 
90  virtual void retain(bool b) { }
91 
92  const dds::pub::DataWriter<T>& get() const { return dw_; }
93 
94 private:
96 };
97 
98 
99 #endif /* OMG_DDS_PUB_DETAIL_ANY_DATA_WRITER_HPP_ */