OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
QueryImpl.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_QUERY_IMPL_HPP_
22 #define OSPL_DDS_SUB_DETAIL_QUERY_IMPL_HPP_
23 
28 // Implementation
29 #include <dds/sub/Query.hpp>
30 
31 
33  const dds::sub::AnyDataReader& dr,
34  const std::string& expression) :
35  dds::core::Reference(new DELEGATE(AnyDataReader(dr), expression))
36 {
37 }
38 
43 template<typename FWIterator>
45  const dds::sub::AnyDataReader& dr,
46  const std::string& expression,
47  const FWIterator& params_begin,
48  const FWIterator& params_end) :
50 {
51  ISOCPP_REPORT_STACK_DDS_BEGIN(dr);
52 
53  for (FWIterator it = params_begin; it != params_end; ++it) {
54  add_parameter(*it);
55  }
56 }
61  const dds::sub::AnyDataReader& dr,
62  const std::string& expression,
63  const std::vector<std::string>& params) :
64  dds::core::Reference(new DELEGATE(AnyDataReader(dr), expression, params))
65 {
66 
67 }
68 
69 
70 const std::string& dds::sub::Query::expression() const
71 {
72  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
73 
74  return this->delegate()->expression();
75 }
76 
77 
78 void dds::sub::Query::expression(const std::string& expr)
79 {
80  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
81 
82  this->delegate()->expression(expr);
83 }
84 
90 {
91  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
92 
93  return this->delegate()->begin();
94 }
95 
101 {
102  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
103 
104  return this->delegate()->end();
105 }
106 
112 {
113  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
114 
115  return this->delegate()->begin();
116 }
117 
123 {
124  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
125 
126  return this->delegate()->end();
127 }
128 
129 
130 template<typename FWIterator>
132  const FWIterator& begin,
133  const FWIterator end)
134 {
135  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
136 
137  this->delegate()->resize_parameters((uint32_t)std::distance(begin, end));
138  dds::sub::Query::iterator params_it;
139  const FWIterator it;
140  for (params_it = this->begin(), it = begin; it != end; ++params_it, ++it) {
141  *params_it = *it;
142  }
143  this->delegate()->set_query_parameters();
144 }
145 
146 
148  const std::string& param)
149 {
150  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
151 
152  this->delegate()->add_parameter(param);
153 }
154 
155 
157 {
158  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
159 
160  return this->delegate()->parameters_length();
161 }
162 
163 
166 {
167  ISOCPP_REPORT_STACK_DDS_BEGIN(*this);
168 
169  return this->delegate()->data_reader();
170 }
171 
172 
173 
174 
175 #endif /* OSPL_DDS_SUB_DETAIL_QUERY_IMPL_HPP_ */
const_iterator end() const
Definition: QueryImpl.hpp:100
Reference(dds::core::null_type &)
DELEGATE::const_iterator const_iterator
Definition: Query.hpp:75
void add_parameter(const std::string &param)
Definition: QueryImpl.hpp:147
void parameters(const FWIterator &begin, const FWIterator end)
Definition: QueryImpl.hpp:131
Query(const dds::sub::AnyDataReader &dr, const std::string &expression)
Definition: QueryImpl.hpp:32
Typeless base class for the typed DataReader.
const AnyDataReader & data_reader() const
Definition: QueryImpl.hpp:165
Definition: array.hpp:23
const std::string & expression() const
Definition: QueryImpl.hpp:70
const_iterator begin() const
Definition: QueryImpl.hpp:89
DELEGATE::iterator iterator
Definition: Query.hpp:70
Base class for reference-counted objects.
Definition: Reference.hpp:94
uint32_t parameters_length() const
Definition: QueryImpl.hpp:156