OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
BuiltinTopicTypes.hpp
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2021 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_
21 #define OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_
22 
23 #include <dds/topic/Topic.hpp>
24 #include <dds/topic/detail/TTopicImpl.hpp>
25 #include <dds/topic/detail/TBuiltinTopicImpl.hpp>
26 #include <org/opensplice/topic/BuiltinTopicDelegate.hpp>
27 #include <org/opensplice/topic/BuiltinTopic.hpp>
28 
29 #if defined (OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT)
30 
31 namespace dds { namespace core { namespace detail {
32 
33  typedef dds::core::TBytesTopicType<org::opensplice::topic::BytesTopicTypeDelegate>
35 
36  typedef dds::core::TStringTopicType<org::opensplice::topic::StringTopicTypeDelegate>
38 
39  typedef dds::core::TKeyedBytesTopicType<org::opensplice::topic::KeyedBytesTopicTypeDelegate>
41 
42  typedef dds::core::TKeyedStringTopicType<org::opensplice::topic::KeyedStringTopicTypeDelegate>
44 }}}
45 
46 
47 
48 
49 
50 //==============================================================================
51 // Bytes Template
52 //==============================================================================
53 
54 template <typename DELEGATE>
55 dds::core::TBytesTopicType<DELEGATE>::TBytesTopicType() :
56  dds::core::Value<DELEGATE>(std::vector<uint8_t>())
57 {
58 }
59 
60 template <typename DELEGATE>
61 dds::core::TBytesTopicType<DELEGATE>::TBytesTopicType(const std::vector<uint8_t>& data) :
63 {
64 }
65 
66 template <typename DELEGATE>
67 dds::core::TBytesTopicType<DELEGATE>::operator std::vector<uint8_t>& () const
68 {
69  return this->delegate().value();
70 }
71 
72 template <typename DELEGATE>
73 const std::vector<uint8_t>& dds::core::TBytesTopicType<DELEGATE>::data() const
74 {
75  return this->delegate().value();
76 }
77 
78 template <typename DELEGATE>
79 void dds::core::TBytesTopicType<DELEGATE>::data(const std::vector<uint8_t>& data)
80 {
81  this->delegate().value(data);
82 }
83 
84 
85 
86 //==============================================================================
87 // String Template
88 //==============================================================================
89 
90 template <typename DELEGATE>
91 dds::core::TStringTopicType<DELEGATE>::TStringTopicType() :
92  dds::core::Value<DELEGATE>(std::string())
93 {
94 }
95 
96 template <typename DELEGATE>
97 dds::core::TStringTopicType<DELEGATE>::TStringTopicType(const std::string& data) :
99 {
100 }
101 
102 template <typename DELEGATE>
103 dds::core::TStringTopicType<DELEGATE>::operator std::string& () const
104 {
105  return this->delegate().value();
106 }
107 
108 template <typename DELEGATE>
109 const std::string& dds::core::TStringTopicType<DELEGATE>::data() const
110 {
111  return this->delegate().value();
112 }
113 
114 template <typename DELEGATE>
115 void dds::core::TStringTopicType<DELEGATE>::data(const std::string& data)
116 {
117  this->delegate().value(data);
118 }
119 
120 
121 
122 //==============================================================================
123 // KeyedBytes Template
124 //==============================================================================
125 
126 template <typename DELEGATE>
127 dds::core::TKeyedBytesTopicType<DELEGATE>::TKeyedBytesTopicType() :
128  dds::core::Value<DELEGATE>(std::string(), std::vector<uint8_t>())
129 {
130 }
131 
132 template <typename DELEGATE>
133 dds::core::TKeyedBytesTopicType<DELEGATE>::TKeyedBytesTopicType(const std::string& key, const std::vector<uint8_t>& value) :
135 {
136 }
137 
138 template <typename DELEGATE>
139 const std::string& dds::core::TKeyedBytesTopicType<DELEGATE>::key() const
140 {
141  return this->delegate().key();
142 }
143 
144 template <typename DELEGATE>
145 void dds::core::TKeyedBytesTopicType<DELEGATE>::key(const std::string& key)
146 {
147  this->delegate().key(key);
148 }
149 
150 template <typename DELEGATE>
151 const std::vector<uint8_t>& dds::core::TKeyedBytesTopicType<DELEGATE>::value() const
152 {
153  return this->delegate().value();
154 }
155 
156 template <typename DELEGATE>
157 void dds::core::TKeyedBytesTopicType<DELEGATE>::value(const std::vector<uint8_t>& value)
158 {
159  this->delegate().value(value);
160 }
161 
162 
163 
164 //==============================================================================
165 // KeyedString Template
166 //==============================================================================
167 
168 template <typename DELEGATE>
169 dds::core::TKeyedStringTopicType<DELEGATE>::TKeyedStringTopicType() :
170  dds::core::Value<DELEGATE>(std::string(), std::string())
171 {
172 }
173 
174 template <typename DELEGATE>
175 dds::core::TKeyedStringTopicType<DELEGATE>::TKeyedStringTopicType(const std::string& key, const std::string& value) :
177 {
178 }
179 
180 template <typename DELEGATE>
181 const std::string& dds::core::TKeyedStringTopicType<DELEGATE>::key() const
182 {
183  return this->delegate().key();
184 }
185 
186 template <typename DELEGATE>
187 void dds::core::TKeyedStringTopicType<DELEGATE>::key(const std::string& key)
188 {
189  this->delegate().key(key);
190 }
191 
192 template <typename DELEGATE>
193 const std::string& dds::core::TKeyedStringTopicType<DELEGATE>::value() const
194 {
195  return this->delegate().value();
196 }
197 
198 template <typename DELEGATE>
199 void dds::core::TKeyedStringTopicType<DELEGATE>::value(const std::string& value)
200 {
201  this->delegate().value(value);
202 }
203 
204 
205 #endif /* OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT */
206 
207 #endif /* OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_ */
void value(DDT &dd, uint32_t mid, const T &v)
dds::core::TKeyedBytesTopicType< org::opensplice::topic::KeyedBytesTopicTypeDelegate > KeyedBytesTopicType
dds::core::TBytesTopicType< org::opensplice::topic::BytesTopicTypeDelegate > BytesTopicType
This class is the base for various value-type dds objects.
Definition: Value.hpp:28
dds::core::TStringTopicType< org::opensplice::topic::StringTopicTypeDelegate > StringTopicType
Definition: array.hpp:23
dds::core::TKeyedStringTopicType< org::opensplice::topic::KeyedStringTopicTypeDelegate > KeyedStringTopicType
STL namespace.