OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
SharedSamples.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_SUB_DETAIL_SHARED_SAMPLES_HPP_
22 #define OSPL_DDS_SUB_DETAIL_SHARED_SAMPLES_HPP_
23 
30 
31 // Implementation
32 
33 namespace dds
34 {
35 namespace sub
36 {
37 namespace detail
38 {
39 
40 template <typename T>
41 class SharedSamples
42 {
43 public:
44  typedef typename std::vector< dds::sub::Sample<T, Sample> >::iterator iterator;
45  typedef typename std::vector< dds::sub::Sample<T, Sample> >::const_iterator const_iterator;
46 
47 public:
48  SharedSamples() { }
49 
50  SharedSamples(dds::sub::LoanedSamples<T> ls) : samples_(ls) { }
51 
52  ~SharedSamples()
53  {
54 
55  }
56 
57 public:
58 
59  iterator mbegin()
60  {
61  return samples_->begin();
62  }
63 
64  const_iterator begin() const
65  {
66  return samples_.begin();
67  }
68 
69  const_iterator end() const
70  {
71  return samples_.end();
72  }
73 
74  uint32_t length() const
75  {
77  return static_cast<uint32_t>(samples_.length());
78  }
79 
80  void resize(uint32_t s)
81  {
82  samples_.resize(s);
83  }
84 
85 private:
87 };
88 
89 }
90 }
91 }
92 
95 // End of implementation
96 
97 #endif /* OSPL_DDS_SUB_DETAIL_SHARED_SAMPLES_HPP_ */
Definition: array.hpp:23
This class encapsulates and automates the management of loaned samples.