OpenDDS  Snapshot(2023/04/28-20:55)
MultiTopicImpl.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_MULTITOPICIMPL_H
9 #define OPENDDS_DCPS_MULTITOPICIMPL_H
10 
11 #ifndef OPENDDS_NO_MULTI_TOPIC
12 
13 #include "TopicDescriptionImpl.h"
14 #include "FilterEvaluator.h"
15 
16 #include "PoolAllocator.h"
17 #include <utility>
18 
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 
24 
25 namespace OpenDDS {
26 namespace DCPS {
27 
29  : public virtual OpenDDS::DCPS::LocalObject<DDS::MultiTopic>
30  , public virtual TopicDescriptionImpl {
31 public:
32  MultiTopicImpl(const char* name, const char* type_name,
33  const char* subscription_expression,
34  const DDS::StringSeq& expression_parameters,
35  DomainParticipantImpl* participant);
36 
37  virtual ~MultiTopicImpl();
38 
39  char* get_subscription_expression();
40 
41  DDS::ReturnCode_t get_expression_parameters(DDS::StringSeq& parameters);
42 
43  DDS::ReturnCode_t set_expression_parameters(const DDS::StringSeq& parameters);
44 
48 
49  explicit SubjectFieldSpec(const OPENDDS_STRING& inc,
50  const OPENDDS_STRING& res = "")
51  : incoming_name_(inc)
52  , resulting_name_(res == "" ? inc : res)
53  {}
54  };
55 
56  const std::vector<SubjectFieldSpec>& get_aggregation() const
57  {
58  return aggregation_;
59  }
60 
61  const std::vector<OPENDDS_STRING>& get_selection() const
62  {
63  return selection_;
64  }
65 
66  template<typename Sample>
67  bool filter(const Sample& s) const
68  {
69  if (!filter_eval_) return true;
71  return filter_eval_->eval(s, expression_parameters_);
72  }
73 
74 private:
78 
79  std::vector<SubjectFieldSpec> aggregation_;
80  std::vector<OPENDDS_STRING> selection_;
81 
82  /// Concurrent access to expression_parameters_
84 };
85 
86 } // namespace DCPS
87 } // namespace OpenDDS
88 
90 
91 #endif // OPENDDS_NO_MULTI_TOPIC
92 
93 #endif
Implements the OpenDDS::DCPS::DomainParticipant interfaces.
unique_ptr< FilterEvaluator > filter_eval_
const std::vector< OPENDDS_STRING > & get_selection() const
ACE_Recursive_Thread_Mutex lock_
Concurrent access to expression_parameters_.
bool filter(const Sample &s) const
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
const std::vector< SubjectFieldSpec > & get_aggregation() const
DDS::StringSeq expression_parameters_
ACE_Guard< ACE_Thread_Mutex > lock_
std::vector< SubjectFieldSpec > aggregation_
OPENDDS_STRING subscription_expression_
#define OPENDDS_STRING
SubjectFieldSpec(const OPENDDS_STRING &inc, const OPENDDS_STRING &res="")
std::vector< OPENDDS_STRING > selection_
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
const char *const name
Definition: debug.cpp:60
Implements the DDS::TopicDescription interface.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
sequence< string > StringSeq
Definition: DdsDcpsCore.idl:50