init
This commit is contained in:
42
unitree_SDK/include/ddscxx/dds/sub/cond/QueryCondition.hpp
Normal file
42
unitree_SDK/include/ddscxx/dds/sub/cond/QueryCondition.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef OMG_DDS_SUB_COND_QUERY_CONDITION_HPP_
|
||||
#define OMG_DDS_SUB_COND_QUERY_CONDITION_HPP_
|
||||
|
||||
|
||||
/* Copyright 2010, Object Management Group, Inc.
|
||||
* Copyright 2010, PrismTech, Corp.
|
||||
* Copyright 2010, Real-Time Innovations, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <dds/sub/cond/detail/QueryCondition.hpp>
|
||||
#include <dds/sub/Query.hpp>
|
||||
#include <dds/sub/cond/detail/TQueryConditionImpl.hpp>
|
||||
|
||||
#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
typedef dds::sub::cond::detail::QueryCondition QueryCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
|
||||
|
||||
#endif /* OMG_DDS_SUB_COND_QUERY_CONDITION_HPP_ */
|
37
unitree_SDK/include/ddscxx/dds/sub/cond/ReadCondition.hpp
Normal file
37
unitree_SDK/include/ddscxx/dds/sub/cond/ReadCondition.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef OMG_DDS_SUB_COND_READ_CONDITION_HPP_
|
||||
#define OMG_DDS_SUB_COND_READ_CONDITION_HPP_
|
||||
|
||||
|
||||
/* Copyright 2010, Object Management Group, Inc.
|
||||
* Copyright 2010, PrismTech, Corp.
|
||||
* Copyright 2010, Real-Time Innovations, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <dds/sub/cond/detail/ReadCondition.hpp>
|
||||
#include <dds/sub/cond/detail/TReadConditionImpl.hpp>
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
typedef dds::sub::cond::detail::ReadCondition ReadCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* OMG_DDS_SUB_COND_READ_CONDITION_HPP_ */
|
301
unitree_SDK/include/ddscxx/dds/sub/cond/TQueryCondition.hpp
Normal file
301
unitree_SDK/include/ddscxx/dds/sub/cond/TQueryCondition.hpp
Normal file
@@ -0,0 +1,301 @@
|
||||
#ifndef OMG_DDS_SUB_TQUERY_CONDITION_HPP_
|
||||
#define OMG_DDS_SUB_TQUERY_CONDITION_HPP_
|
||||
|
||||
/* Copyright 2010, Object Management Group, Inc.
|
||||
* Copyright 2010, PrismTech, Corp.
|
||||
* Copyright 2010, Real-Time Innovations, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <dds/core/detail/conformance.hpp>
|
||||
#include <dds/sub/cond/detail/QueryCondition.hpp>
|
||||
#include <dds/sub/cond/TReadCondition.hpp>
|
||||
|
||||
|
||||
#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
template <typename DELEGATE>
|
||||
class TQueryCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* QueryCondition objects are specialized ReadCondition objects that allow
|
||||
* the application to also specify a filter on the locally available data.
|
||||
*
|
||||
* The query (query_expression) is similar to an SQL WHERE clause can be
|
||||
* parameterized by arguments. See dds::sub::Query for more query information.
|
||||
*
|
||||
* See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for some examples.<br>
|
||||
* Although the WaitSet examples use the StatusCondition, the basic usage of this Condition
|
||||
* with a WaitSet is the same.
|
||||
*
|
||||
* @see dds::sub::Query
|
||||
* @see dds::core::cond::Condition
|
||||
* @see dds::sub::cond::ReadCondition
|
||||
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept"
|
||||
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "Subscription concept"
|
||||
* @see for more information: @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
* @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples"
|
||||
*/
|
||||
template <typename DELEGATE>
|
||||
class dds::sub::cond::TQueryCondition :
|
||||
public dds::sub::cond::TReadCondition<DELEGATE>,
|
||||
public dds::sub::TQuery<DELEGATE>
|
||||
{
|
||||
public:
|
||||
OMG_DDS_REF_TYPE_PROTECTED_DC(TQueryCondition, dds::sub::cond::TReadCondition, DELEGATE)
|
||||
OMG_DDS_IMPLICIT_REF_BASE(TQueryCondition)
|
||||
|
||||
public:
|
||||
// Random access iterators
|
||||
/**
|
||||
* Iterator for the query expression parameters.
|
||||
*/
|
||||
typedef typename DELEGATE::iterator iterator;
|
||||
|
||||
/**
|
||||
* Iterator for the query expression parameters.
|
||||
*/
|
||||
typedef typename DELEGATE::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a QueryCondition instance.
|
||||
*
|
||||
* This will create an QueryCondition that is associated with a dds::sub::Query,
|
||||
* which is again associated with a dds::sub::DataReader.
|
||||
*
|
||||
*
|
||||
* @param query The query to filter on the locally available data.
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
TQueryCondition(const dds::sub::Query& query,
|
||||
const dds::sub::status::DataState& status);
|
||||
|
||||
/**
|
||||
* Creates a QueryCondition instance.
|
||||
*
|
||||
* This will create an QueryCondition that is associated with a dds::sub::Query,
|
||||
* which is again associated with a dds::sub::DataReader.
|
||||
*
|
||||
* The supplied functor will be called when this QueryCondition is triggered
|
||||
* and either the inherited dds::core::cond::Condition::dispatch() is called or the
|
||||
* dds::core::cond::WaitSet::dispatch() on the WaitSet to which this QueryCondition is
|
||||
* attached to.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info" <br>
|
||||
* See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition.
|
||||
*
|
||||
* @param query The query to filter on the locally available data.
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @param functor The functor to be called when the QueryCondition triggers.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
template <typename FUN>
|
||||
TQueryCondition(const dds::sub::Query& query,
|
||||
const dds::sub::status::DataState& status, FUN functor);
|
||||
|
||||
/**
|
||||
* Creates a QueryCondition instance.
|
||||
*
|
||||
* This will create an QueryCondition that is associated with an dds::sub::AnyDataReader,
|
||||
* with parameters that essentially represent a query.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info" <br>
|
||||
* See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition.
|
||||
*
|
||||
* @param dr Query associated DataReader.
|
||||
* @param expression for more information: @ref anchor_dds_sub_query_expression "Query expression"
|
||||
* @param params for more information: @ref anchor_dds_sub_query_expression "Query expression parameters"
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
TQueryCondition(const dds::sub::AnyDataReader& dr,
|
||||
const std::string& expression,
|
||||
const std::vector<std::string>& params,
|
||||
const dds::sub::status::DataState& status);
|
||||
|
||||
/**
|
||||
* Creates a QueryCondition instance.
|
||||
*
|
||||
* This will create an QueryCondition that is associated with an dds::sub::AnyDataReader,
|
||||
* with parameters that essentially represent a query.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info" <br>
|
||||
* See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition.
|
||||
*
|
||||
* @param dr Query associated DataReader.
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
TQueryCondition(const dds::sub::AnyDataReader& dr,
|
||||
const dds::sub::status::DataState& status);
|
||||
/**
|
||||
* Creates a QueryCondition instance.
|
||||
*
|
||||
* This will create an QueryCondition that is associated with an dds::sub::AnyDataReader,
|
||||
* with parameters that essentially represent a query.
|
||||
*
|
||||
* The supplied functor will be called when this QueryCondition is triggered
|
||||
* and either the inherited dds::core::cond::Condition::dispatch() is called or the
|
||||
* dds::core::cond::WaitSet::dispatch() on the WaitSet to which this QueryCondition is
|
||||
* attached to.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info" <br>
|
||||
* See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition.
|
||||
*
|
||||
* @param dr Query associated DataReader.
|
||||
* @param expression for more information: @ref anchor_dds_sub_query_expression "Query expression"
|
||||
* @param params for more information: @ref anchor_dds_sub_query_expression "Query expression parameters"
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
template <typename FUN>
|
||||
TQueryCondition(const dds::sub::AnyDataReader& dr,
|
||||
const std::string& expression,
|
||||
const std::vector<std::string>& params,
|
||||
const dds::sub::status::DataState& status,
|
||||
FUN functor);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Set the Query expression.
|
||||
*
|
||||
* @param expr for more information: @ref anchor_dds_sub_query_expression "SQL expression"
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
void expression(const std::string& expr);
|
||||
|
||||
/**
|
||||
* Get the Query expression.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @return std::string The query expression
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
const std::string& expression();
|
||||
|
||||
/**
|
||||
* Provides the beginning iterator of the query parameter list.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @return dds::sub::cond::TQueryCondition::const_iterator
|
||||
* The beginning iterator
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
const_iterator begin() const;
|
||||
|
||||
/**
|
||||
* Provides the end iterator of the query parameter list.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @return dds::sub::cond::TQueryCondition::const_iterator
|
||||
* The end iterator
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
const_iterator end() const;
|
||||
|
||||
/**
|
||||
* Provides the beginning iterator of the query parameter list.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @return dds::sub::cond::TQueryCondition::iterator
|
||||
* The beginning iterator
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
iterator begin();
|
||||
|
||||
/**
|
||||
* Provides the end iterator of the query parameter list.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @return dds::sub::cond::TQueryCondition::iterator
|
||||
* The end iterator
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
iterator end();
|
||||
|
||||
/**
|
||||
* Sets the query parameters.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @param begin Iterator pointing to the beginning of the parameters to set
|
||||
* @param end Iterator pointing to the end of the parameters to set
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
template<typename FWIterator>
|
||||
void parameters(const FWIterator& begin, const FWIterator end);
|
||||
|
||||
/**
|
||||
* Adds a parameter to the query.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @param param The parameter to add
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
void add_parameter(const std::string& param);
|
||||
|
||||
/**
|
||||
* Gets the number of parameters in the query.
|
||||
*
|
||||
* See @ref anchor_dds_sub_query_expression "SQL expression info"
|
||||
*
|
||||
* @return uint32_t The number of parameters in the query
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
uint32_t parameters_length() const;
|
||||
|
||||
/**
|
||||
* This operation returns the DataReader associated with the QueryCondition.
|
||||
*
|
||||
* Note that there is exactly one DataReader associated with each QueryCondition.
|
||||
*
|
||||
* @cond
|
||||
* Note also that since QueryCondition overrides this call since it inherits
|
||||
* two different implementations from its two different parents. Not offering
|
||||
* an implementation here would results in an ambiguity.
|
||||
* @endcond
|
||||
*
|
||||
* @return dds::sub::AnyDataReader The associated DataReader
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
const dds::sub::AnyDataReader& data_reader() const;
|
||||
};
|
||||
|
||||
#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
|
||||
|
||||
#endif /* OMG_DDS_SUB_TQUERY_CONDITION_HPP_ */
|
143
unitree_SDK/include/ddscxx/dds/sub/cond/TReadCondition.hpp
Normal file
143
unitree_SDK/include/ddscxx/dds/sub/cond/TReadCondition.hpp
Normal file
@@ -0,0 +1,143 @@
|
||||
#ifndef OMG_DDS_SUB_TCOND_READ_CONDITION_HPP_
|
||||
#define OMG_DDS_SUB_TCOND_READ_CONDITION_HPP_
|
||||
|
||||
|
||||
/* Copyright 2010, Object Management Group, Inc.
|
||||
* Copyright 2010, PrismTech, Corp.
|
||||
* Copyright 2010, Real-Time Innovations, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <dds/core/cond/TCondition.hpp>
|
||||
#include <dds/sub/DataReader.hpp>
|
||||
#include <dds/sub/AnyDataReader.hpp>
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
template <typename DELEGATE>
|
||||
class TReadCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* ReadCondition objects are conditions specifically dedicated
|
||||
* to read operations and attached to one DataReader.
|
||||
*
|
||||
* ReadCondition objects allow an application to specify the data samples
|
||||
* it is interested in (by specifying the desired sample states, view states,
|
||||
* and instance states). (See the parameter definitions for DataReader's
|
||||
* read/take operations.) This allows the middle-ware to enable the condition
|
||||
* only when suitable information is available. They are to be used in
|
||||
* conjunction with a WaitSet as normal conditions. More than one
|
||||
* ReadCondition may be attached to the same DataReader.
|
||||
*
|
||||
* See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for some examples.<br>
|
||||
* Although the WaitSet examples use the StatusCondition, the basic usage of this Condition
|
||||
* with a WaitSet is the same.
|
||||
*
|
||||
* @see dds::core::cond::Condition
|
||||
* @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept"
|
||||
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept"
|
||||
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "Subscription concept"
|
||||
* @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples"
|
||||
*/
|
||||
template <typename DELEGATE>
|
||||
class dds::sub::cond::TReadCondition : public dds::core::cond::TCondition<DELEGATE>
|
||||
{
|
||||
public:
|
||||
OMG_DDS_REF_TYPE_PROTECTED_DC(TReadCondition, dds::core::cond::TCondition, DELEGATE)
|
||||
OMG_DDS_IMPLICIT_REF_BASE(TReadCondition)
|
||||
|
||||
public:
|
||||
/**
|
||||
* Create a dds::sub::cond::ReadCondition associated with a DataReader.
|
||||
*
|
||||
* The ReadCondition can then be added to a dds::core::cond::WaitSet so that the
|
||||
* application can wait for specific status changes that affect the Entity.
|
||||
*
|
||||
* @anchor anchor_dds_sub_cond_readcondition_state_mask
|
||||
* State Masks.<br>
|
||||
* The result of the ReadCondition depends on the selection of samples determined by
|
||||
* three masks:
|
||||
* - DataState::sample_state() is the mask, which selects only those samples with the desired
|
||||
* sample states SampleState::read(), SampleState::not_read() or SampleState::any().
|
||||
* - DataState::view_state() is the mask, which selects only those samples with the desired
|
||||
* view states ViewState::new_view(), ViewState::not_new_view() or ViewState::any().
|
||||
* - DataState::instance_state() is the mask, which selects only those samples with the desired
|
||||
* view states InstanceState::alive(), InstanceState::not_alive_disposed(),
|
||||
* InstanceState::not_alive_no_writers(), InstanceState::not_alive_mask() or InstanceState::any().
|
||||
* See also @ref DCPS_Modules_Infrastructure_Status "Status Concept".
|
||||
*
|
||||
* @param dr The DataReader to associate with the ReadCondition.
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
TReadCondition(const dds::sub::AnyDataReader& dr, const dds::sub::status::DataState& status);
|
||||
|
||||
/**
|
||||
* Create a dds::sub::cond::ReadCondition associated with a DataReader.
|
||||
*
|
||||
* The ReadCondition can then be added to a dds::core::cond::WaitSet so that the
|
||||
* application can wait for specific status changes that affect the Entity.
|
||||
*
|
||||
* The supplied functor will be called when this ReadCondition is triggered
|
||||
* and either the inherited dds::core::cond::Condition::dispatch() is called or the
|
||||
* dds::core::cond::WaitSet::dispatch() on the WaitSet to which this ReadCondition is
|
||||
* attached to.
|
||||
*
|
||||
* See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info".
|
||||
*
|
||||
* @param dr The DataReader to associate with the ReadCondition.
|
||||
* @param status A mask, which selects only those samples with the desired
|
||||
* sample/view/instance states.
|
||||
* @param functor The functor to be called when the ReadCondition triggers.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
template <typename FUN>
|
||||
TReadCondition(const dds::sub::AnyDataReader& dr, const dds::sub::status::DataState& status, FUN functor);
|
||||
|
||||
public:
|
||||
/**
|
||||
* This operation returns the set of data-states that are taken into
|
||||
* account to determine the trigger_value of the ReadCondition.
|
||||
*
|
||||
* These are data-states specified when the ReadCondition was created.
|
||||
*
|
||||
* @return dds::sub::status::DataState The data state.
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
const dds::sub::status::DataState state_filter() const;
|
||||
|
||||
/**
|
||||
* This operation returns the DataReader associated with the ReadCondition.
|
||||
*
|
||||
* Note that there is exactly one DataReader associated with each ReadCondition.
|
||||
*
|
||||
* @return dds::sub::AnyDataReader The associated DataReader
|
||||
* @throw dds::core::Exception
|
||||
*/
|
||||
const dds::sub::AnyDataReader& data_reader() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* OMG_DDS_SUB_TCOND_READ_CONDITION_HPP_ */
|
@@ -0,0 +1,57 @@
|
||||
#ifndef OMG_DDS_SUB_DETAIL_QUERY_CONDITION_HPP_
|
||||
#define OMG_DDS_SUB_DETAIL_QUERY_CONDITION_HPP_
|
||||
|
||||
/* Copyright 2010, Object Management Group, Inc.
|
||||
* Copyright 2010, PrismTech, Corp.
|
||||
* Copyright 2010, Real-Time Innovations, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
class QueryConditionDelegate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
|
||||
template <typename DELEGATE>
|
||||
class TQueryCondition;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
typedef dds::sub::cond::TQueryCondition<org::eclipse::cyclonedds::sub::cond::QueryConditionDelegate> QueryCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* OMG_DDS_SUB_DETAIL_QUERY_CONDITION_HPP_ */
|
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright(c) 2006 to 2020 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 OMG_DDS_SUB_DETAIL_READ_CONDITION_HPP_
|
||||
#define OMG_DDS_SUB_DETAIL_READ_CONDITION_HPP_
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
class ReadConditionDelegate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
|
||||
template <typename DELEGATE>
|
||||
class TReadCondition;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
typedef dds::sub::cond::TReadCondition<org::eclipse::cyclonedds::sub::cond::ReadConditionDelegate> ReadCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* OMG_DDS_SUB_DETAIL_READ_CONDITION_HPP_ */
|
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* 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 <dds/sub/cond/TQueryCondition.hpp>
|
||||
#include <org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp>
|
||||
|
||||
// Implementation
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
|
||||
template <typename DELEGATE>
|
||||
TQueryCondition<DELEGATE>::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 <typename DELEGATE>
|
||||
template <typename FUN>
|
||||
TQueryCondition<DELEGATE>::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 <typename DELEGATE>
|
||||
TQueryCondition<DELEGATE>::TQueryCondition(
|
||||
const dds::sub::AnyDataReader& dr,
|
||||
const std::string& expression,
|
||||
const std::vector<std::string>& params,
|
||||
const dds::sub::status::DataState& status)
|
||||
{
|
||||
this->set_ref(new DELEGATE(dr, expression, params, status));
|
||||
this->delegate()->init(this->impl_);
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
TQueryCondition<DELEGATE>::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 <typename DELEGATE>
|
||||
template <typename FUN>
|
||||
TQueryCondition<DELEGATE>::TQueryCondition(
|
||||
const dds::sub::AnyDataReader& dr,
|
||||
const std::string& expression,
|
||||
const std::vector<std::string>& 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 <typename DELEGATE>
|
||||
template<typename FWIterator>
|
||||
void TQueryCondition<DELEGATE>::parameters(const FWIterator& begin, const FWIterator end)
|
||||
{
|
||||
std::vector<std::string> params(begin, end);
|
||||
this->delegate()->parameters(params);
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
void TQueryCondition<DELEGATE>::expression(
|
||||
const std::string& expr)
|
||||
{
|
||||
this->delegate()->expression(expr);
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
const std::string& TQueryCondition<DELEGATE>::expression()
|
||||
{
|
||||
return this->delegate()->expression();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
typename TQueryCondition<DELEGATE>::const_iterator TQueryCondition<DELEGATE>::begin() const
|
||||
{
|
||||
return this->delegate()->begin();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
typename TQueryCondition<DELEGATE>::const_iterator TQueryCondition<DELEGATE>::end() const
|
||||
{
|
||||
return this->delegate()->end();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
typename TQueryCondition<DELEGATE>::iterator TQueryCondition<DELEGATE>::begin()
|
||||
{
|
||||
return this->delegate()->begin();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
typename TQueryCondition<DELEGATE>::iterator TQueryCondition<DELEGATE>::end()
|
||||
{
|
||||
return this->delegate()->end();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
void TQueryCondition<DELEGATE>::add_parameter(
|
||||
const std::string& param)
|
||||
{
|
||||
this->delegate()->add_parameter(param);
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
uint32_t TQueryCondition<DELEGATE>::parameters_length() const
|
||||
{
|
||||
return this->delegate()->parameters_length();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
const AnyDataReader& TQueryCondition<DELEGATE>::data_reader() const
|
||||
{
|
||||
return this->delegate()->data_reader();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace core
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
template <typename DELEGATE>
|
||||
TCondition<DELEGATE>::TCondition(const dds::sub::cond::TQueryCondition<org::eclipse::cyclonedds::sub::cond::QueryConditionDelegate>& 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<DELEGATE>::impl_ = ::std::dynamic_pointer_cast<DELEGATE_T>(h.delegate());
|
||||
if (h.delegate() != this->::dds::core::Reference<DELEGATE>::impl_) {
|
||||
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
TCondition<DELEGATE>&
|
||||
TCondition<DELEGATE>::operator=(const dds::sub::cond::TQueryCondition<org::eclipse::cyclonedds::sub::cond::QueryConditionDelegate>& rhs)
|
||||
{
|
||||
if (this != static_cast<TCondition*>(&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<DELEGATE>::impl_) {
|
||||
*this = other;
|
||||
}
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of implementation
|
||||
|
||||
#endif /* CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ */
|
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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_CORE_COND_TREADCONDITION_IMPL_HPP_
|
||||
#define CYCLONEDDS_DDS_CORE_COND_TREADCONDITION_IMPL_HPP_
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/*
|
||||
* OMG PSM class declaration
|
||||
*/
|
||||
#include <dds/sub/cond/TReadCondition.hpp>
|
||||
#include <org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp>
|
||||
|
||||
// Implementation
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace sub
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
|
||||
template <typename DELEGATE>
|
||||
TReadCondition<DELEGATE>::TReadCondition(
|
||||
const dds::sub::AnyDataReader& dr,
|
||||
const dds::sub::status::DataState& status)
|
||||
{
|
||||
this->set_ref(new DELEGATE(dr, status));
|
||||
this->delegate()->init(this->impl_);
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
template <typename FUN>
|
||||
TReadCondition<DELEGATE>::TReadCondition(
|
||||
const dds::sub::AnyDataReader& dr,
|
||||
const dds::sub::status::DataState& status,
|
||||
FUN functor)
|
||||
{
|
||||
this->set_ref(new DELEGATE(dr, status));
|
||||
this->delegate()->init(this->impl_);
|
||||
this->delegate()->set_handler(functor);
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
const dds::sub::status::DataState TReadCondition<DELEGATE>::state_filter() const
|
||||
{
|
||||
return this->delegate()->state_filter();
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
const AnyDataReader& TReadCondition<DELEGATE>::data_reader() const
|
||||
{
|
||||
return this->delegate()->data_reader();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
namespace core
|
||||
{
|
||||
namespace cond
|
||||
{
|
||||
template <typename DELEGATE>
|
||||
TCondition<DELEGATE>::TCondition(const dds::sub::cond::TReadCondition<org::eclipse::cyclonedds::sub::cond::ReadConditionDelegate>& 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<DELEGATE>::impl_ = ::std::dynamic_pointer_cast<DELEGATE_T>(h.delegate());
|
||||
if (h.delegate() != this->::dds::core::Reference<DELEGATE>::impl_) {
|
||||
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename DELEGATE>
|
||||
TCondition<DELEGATE>&
|
||||
TCondition<DELEGATE>::operator=(const dds::sub::cond::TReadCondition<org::eclipse::cyclonedds::sub::cond::ReadConditionDelegate>& rhs)
|
||||
{
|
||||
const TCondition<DELEGATE> &t = rhs;
|
||||
if (this != &t) {
|
||||
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<DELEGATE>::impl_) {
|
||||
*this = other;
|
||||
}
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of implementation
|
||||
|
||||
#endif /* CYCLONEDDS_DDS_CORE_COND_TREADCONDITION_IMPL_HPP_ */
|
Reference in New Issue
Block a user