/* * Copyright(c) 2006 to 2021 ZettaScale Technology and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License * v. 1.0 which is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause */ #ifndef CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ #define CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ /** * @file */ /* * OMG PSM class declaration */ #include #include // Implementation namespace dds { namespace sub { namespace cond { template TQueryCondition::TQueryCondition( const dds::sub::Query& query, const dds::sub::status::DataState& status) { this->set_ref(new DELEGATE(query.data_reader(), query.expression(), query.delegate()->parameters(), status)); this->delegate()->init(this->impl_); } template template TQueryCondition::TQueryCondition( const dds::sub::Query& query, const dds::sub::status::DataState& status, FUN functor) { this->set_ref(new DELEGATE(query.data_reader(), query.expression(), query.delegate()->parameters(), status)); this->delegate()->set_handler(functor); this->delegate()->init(this->impl_); } template TQueryCondition::TQueryCondition( const dds::sub::AnyDataReader& dr, const std::string& expression, const std::vector& params, const dds::sub::status::DataState& status) { this->set_ref(new DELEGATE(dr, expression, params, status)); this->delegate()->init(this->impl_); } template TQueryCondition::TQueryCondition( const dds::sub::AnyDataReader& dr, const dds::sub::status::DataState& status) { this->set_ref(new DELEGATE(dr, status)); this->delegate()->init(this->impl_); } template template TQueryCondition::TQueryCondition( const dds::sub::AnyDataReader& dr, const std::string& expression, const std::vector& params, const dds::sub::status::DataState& status, FUN functor) { this->set_ref(new DELEGATE(dr, expression, params, status)); this->delegate()->set_handler(functor); this->delegate()->init(this->impl_); } template template void TQueryCondition::parameters(const FWIterator& begin, const FWIterator end) { std::vector params(begin, end); this->delegate()->parameters(params); } template void TQueryCondition::expression( const std::string& expr) { this->delegate()->expression(expr); } template const std::string& TQueryCondition::expression() { return this->delegate()->expression(); } template typename TQueryCondition::const_iterator TQueryCondition::begin() const { return this->delegate()->begin(); } template typename TQueryCondition::const_iterator TQueryCondition::end() const { return this->delegate()->end(); } template typename TQueryCondition::iterator TQueryCondition::begin() { return this->delegate()->begin(); } template typename TQueryCondition::iterator TQueryCondition::end() { return this->delegate()->end(); } template void TQueryCondition::add_parameter( const std::string& param) { this->delegate()->add_parameter(param); } template uint32_t TQueryCondition::parameters_length() const { return this->delegate()->parameters_length(); } template const AnyDataReader& TQueryCondition::data_reader() const { return this->delegate()->data_reader(); } } } namespace core { namespace cond { template TCondition::TCondition(const dds::sub::cond::TQueryCondition& h) { if (h.is_nil()) { /* We got a null object and are not really able to do a typecheck here. */ /* So, just set a null object. */ *this = dds::core::null; } else { this->::dds::core::Reference::impl_ = ::std::dynamic_pointer_cast(h.delegate()); if (h.delegate() != this->::dds::core::Reference::impl_) { throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); } } } template TCondition& TCondition::operator=(const dds::sub::cond::TQueryCondition& rhs) { if (this != static_cast(&rhs)) { if (rhs.is_nil()) { /* We got a null object and are not really able to do a typecheck here. */ /* So, just set a null object. */ *this = dds::core::null; } else { TCondition other(rhs); /* Dont have to copy when the delegate is the same. */ if (other.delegate() != this->::dds::core::Reference::impl_) { *this = other; } } } return *this; } } } } // End of implementation #endif /* CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ */