| 2324 | |
| 2325 | #ifndef OPENDDS_NO_CONTENT_FILTERED_TOPIC |
| 2326 | bool |
| 2327 | DataWriterImpl::filter_out(const DataSampleElement& elt, |
| 2328 | const OPENDDS_STRING& filterClassName, |
| 2329 | const FilterEvaluator& evaluator, |
| 2330 | const DDS::StringSeq& expression_params) const |
| 2331 | { |
| 2332 | if (!type_support_) { |
| 2333 | if (log_level >= LogLevel::Error) { |
| 2334 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: DataWriterImpl::filter_out: Could not cast type support, not filtering\n")); |
| 2335 | } |
| 2336 | return false; |
| 2337 | } |
| 2338 | |
| 2339 | if (filterClassName == "DDSSQL" || |
| 2340 | filterClassName == "OPENDDSSQL") { |
| 2341 | if (!elt.get_header().valid_data() && evaluator.has_non_key_fields(*type_support_)) { |
| 2342 | return true; |
| 2343 | } |
| 2344 | try { |
| 2345 | return !evaluator.eval(elt.get_sample()->cont(), encoding_mode_.encoding(), |
| 2346 | *type_support_, expression_params); |
| 2347 | } catch (const std::runtime_error&) { |
| 2348 | // if the eval fails, the throws will do the logging |
| 2349 | // return false here so that the sample is not filtered |
| 2350 | return false; |
| 2351 | } |
| 2352 | } else { |
| 2353 | return false; |
| 2354 | } |
| 2355 | } |
| 2356 | #endif |
| 2357 | |
| 2358 | bool |
no test coverage detected