|
| 1 | +// Copyright 2021 Real-Time Innovations, Inc. (RTI) |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | +#ifndef RMW_CONNEXTDDS__CUSTOM_SQL_FILTER_HPP_ |
| 15 | +#define RMW_CONNEXTDDS__CUSTOM_SQL_FILTER_HPP_ |
| 16 | + |
| 17 | +#include "rmw_connextdds/dds_api.hpp" |
| 18 | + |
| 19 | +#if RMW_CONNEXT_DDS_API == RMW_CONNEXT_DDS_API_PRO |
| 20 | + |
| 21 | +namespace rti_connext_dds_custom_sql_filter |
| 22 | +{ |
| 23 | + |
| 24 | +struct CustomSqlFilterData |
| 25 | +{ |
| 26 | + DDS_SqlFilterGeneratorQos base; |
| 27 | + |
| 28 | + CustomSqlFilterData(); |
| 29 | + |
| 30 | + DDS_ReturnCode_t |
| 31 | + set_memory_management_property( |
| 32 | + const DDS_DomainParticipantQos & dp_qos); |
| 33 | +}; |
| 34 | + |
| 35 | +RMW_CONNEXTDDS_PUBLIC |
| 36 | +DDS_ReturnCode_t |
| 37 | +register_content_filter( |
| 38 | + DDS_DomainParticipant * const participant, |
| 39 | + CustomSqlFilterData * const filter_data); |
| 40 | + |
| 41 | +RMW_CONNEXTDDS_PUBLIC |
| 42 | +extern const char * const PLUGIN_NAME; |
| 43 | + |
| 44 | +} // namespace rti_connext_dds_custom_sql_filter |
| 45 | + |
| 46 | +#if !RMW_CONNEXT_BUILTIN_CFT_COMPATIBILITY_MODE |
| 47 | +extern "C" { |
| 48 | +// This is an internal function from RTI Connext DDS which allows a filter to |
| 49 | +// be registered as "built-in". We need this because we want this custom filter |
| 50 | +// to be a replacement for the built-in SQL-like filter. |
| 51 | +RMW_CONNEXTDDS_PUBLIC |
| 52 | +DDS_ReturnCode_t |
| 53 | +DDS_ContentFilter_register_filter( |
| 54 | + DDS_DomainParticipant * participant, |
| 55 | + const char * name, |
| 56 | + const struct DDS_ContentFilter * filter, |
| 57 | + const DDS_ContentFilterEvaluateFunction evaluateOnSerialized, |
| 58 | + const DDS_ContentFilterWriterEvaluateFunction writerEvaluateOnSerialized, |
| 59 | + const DDS_ContentFilterQueryFunction query, |
| 60 | + DDS_Boolean isBuiltin); |
| 61 | +} |
| 62 | +#endif // RMW_CONNEXT_BUILTIN_CFT_COMPATIBILITY_MODE |
| 63 | + |
| 64 | +#endif // RMW_CONNEXT_DDS_API == RMW_CONNEXT_DDS_API_PRO |
| 65 | + |
| 66 | +#endif // RMW_CONNEXTDDS__CUSTOM_SQL_FILTER_HPP_ |
0 commit comments