OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
TopicInstanceImpl.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  */
21 #ifndef OSPL_DDS_TOPIC_TOPICINSTANCE_HPP_
22 #define OSPL_DDS_TOPIC_TOPICINSTANCE_HPP_
23 
28 /*
29  * OMG PSM class declaration
30  */
32 
33 // Implementation
34 
35 namespace dds
36 {
37 namespace topic
38 {
39 
40 template <typename T>
41 TopicInstance<T>::TopicInstance() : h_(dds::core::null) {}
42 
43 template <typename T>
44 TopicInstance<T>::TopicInstance(const ::dds::core::InstanceHandle& h)
45  : h_(h), sample_() {}
46 
47 template <typename T>
48 TopicInstance<T>::TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample)
49  : h_(h), sample_(sample) { }
50 
51 template <typename T>
52 TopicInstance<T>::operator const ::dds::core::InstanceHandle() const
53 {
54  return h_;
55 }
56 
57 template <typename T>
58 const ::dds::core::InstanceHandle TopicInstance<T>::handle() const
59 {
60  return h_;
61 }
62 
63 template <typename T>
64 void TopicInstance<T>::handle(const ::dds::core::InstanceHandle& h)
65 {
66  h_ = h;
67 }
68 
69 template <typename T>
70 const T& TopicInstance<T>::sample() const
71 {
72  return sample_;
73 }
74 
75 template <typename T>
77 {
78  return sample_;
79 }
80 
81 template <typename T>
83 {
84  sample_ = sample;
85 }
86 
87 }
88 }
89 
90 // End of implementation
91 
92 #endif /* OSPL_DDS_TOPIC_TOPICINSTANCE_HPP_ */
const ::dds::core::InstanceHandle handle() const
A TopicInstance encapsulates a dds::sub::Sample and its associated dds::core::InstanceHandle.
Definition: array.hpp:23