14#ifndef RTI_ROUTING_PROCESSOR_QUERY_HPP_
15#define RTI_ROUTING_PROCESSOR_QUERY_HPP_
17#include "routingservice/routingservice_processor.h"
19#include <dds/core/Reference.hpp>
20#include <rti/core/detail/SelfReference.hpp>
23namespace rti {
namespace routing {
namespace processor {
27class QueryHolder :
public rti::core::detail::RetainableType<QueryHolder>{
30 QueryHolder() : input_(NULL), query_data_(NULL)
34 QueryHolder(RTI_RoutingServiceInput *input,
const dds::topic::Filter& the_filter)
43 if (query_data_ != NULL) {
48 (void) RTI_RoutingServiceInput_delete_content_query(
54 void filter(
const dds::topic::Filter& filter)
56 RTI_RoutingServiceSelectorContent content =
57 RTI_RoutingServiceSelectorContent_INITIALIZER;
58 content.expression = (
char *) filter.expression().c_str();
59 rti::core::native_conversions::to_native(
60 content.expression_parameters,
61 filter->parameters());
62 query_data_ = RTI_RoutingServiceInput_create_content_query(
66 DDS_StringSeq_finalize(&content.expression_parameters);
67 if (query_data_ == NULL) {
68 throw dds::core::Error(
"error creating content query from native input");
72 RTI_RoutingServiceInput *input_;
92class Query :
public dds::core::Reference<rti::routing::processor::QueryHolder> {
94 typedef dds::core::Reference<QueryHolder> Base;
95 OMG_DDS_REF_TYPE_NOTYPENAME(
98 rti::routing::processor::QueryHolder);
100 explicit Query(Base::DELEGATE_REF_T reference) : Base(reference)
102 if (this->delegate()) {
103 this->delegate()->remember_reference(this->delegate());
116 Query(RTI_RoutingServiceInput *input,
const dds::topic::Filter&
filter)
117 : Base(new QueryHolder(input,
filter))
119 this->delegate()->remember_reference(this->delegate());
132 this->delegate()->filter(
filter);
Encapsulates a content query to select data from a rti::routing::adapter::StreamReader.
Definition: Query.hpp:92
void filter(const dds::topic::Filter &filter)
Updates the current Query content filter.
Definition: Query.hpp:130
Query(RTI_RoutingServiceInput *input, const dds::topic::Filter &filter)
Creates a Query described by a filter on an input.
Definition: Query.hpp:116