#include <MultiTopicImpl.h>
Inheritance diagram for OpenDDS::DCPS::MultiTopicImpl:
Public Member Functions | |
MultiTopicImpl (const char *name, const char *type_name, const char *subscription_expression, const DDS::StringSeq &expression_parameters, DomainParticipantImpl *participant) | |
virtual | ~MultiTopicImpl () |
char * | get_subscription_expression () |
DDS::ReturnCode_t | get_expression_parameters (DDS::StringSeq ¶meters) |
DDS::ReturnCode_t | set_expression_parameters (const DDS::StringSeq ¶meters) |
const std::vector< SubjectFieldSpec > & | get_aggregation () const |
const std::vector< OPENDDS_STRING > & | get_selection () const |
template<typename Sample> | |
bool | filter (const Sample &s) const |
Private Attributes | |
OPENDDS_STRING | subscription_expression_ |
DDS::StringSeq | expression_parameters_ |
FilterEvaluator * | filter_eval_ |
std::vector< SubjectFieldSpec > | aggregation_ |
std::vector< OPENDDS_STRING > | selection_ |
ACE_Recursive_Thread_Mutex | lock_ |
concurrent access to expression_parameters_ | |
Classes | |
struct | SubjectFieldSpec |
Definition at line 26 of file MultiTopicImpl.h.
OpenDDS::DCPS::MultiTopicImpl::MultiTopicImpl | ( | const char * | name, | |
const char * | type_name, | |||
const char * | subscription_expression, | |||
const DDS::StringSeq & | expression_parameters, | |||
DomainParticipantImpl * | participant | |||
) |
Definition at line 37 of file MultiTopicImpl.cpp.
References aggregation_, filter_eval_, FACE::TS::parser, OpenDDS::DCPS::reportErrors(), selection_, and OpenDDS::DCPS::toString().
00041 : TopicDescriptionImpl(name, type_name, 00042 findTypeSupport(participant, type_name), 00043 participant) 00044 , subscription_expression_(subscription_expression) 00045 , expression_parameters_(expression_parameters) 00046 , filter_eval_(NULL) 00047 { 00048 const char* out = subscription_expression 00049 + std::strlen(subscription_expression); 00050 yard::SimpleTextParser parser(subscription_expression, out); 00051 if (!parser.Parse<TopicExpressionGrammar::TopicCompleteInput>()) { 00052 reportErrors(parser, subscription_expression); 00053 } 00054 00055 for (AstNode* iter = parser.GetAstRoot()->GetFirstChild(); iter; 00056 iter = iter->GetSibling()) { 00057 if (iter->TypeMatches<TopicExpressionGrammar::SubjectFieldSpec>()) { 00058 AstNode* fieldName = iter->GetFirstChild(); 00059 aggregation_.push_back(SubjectFieldSpec(toString(fieldName), 00060 toString(fieldName->GetSibling()))); 00061 } else if (iter->TypeMatches<TopicExpressionGrammar::TopicName>()) { 00062 selection_.push_back(toString(iter)); 00063 } else { 00064 filter_eval_ = new FilterEvaluator(iter); 00065 } 00066 } 00067 }
OpenDDS::DCPS::MultiTopicImpl::~MultiTopicImpl | ( | ) | [virtual] |
Definition at line 69 of file MultiTopicImpl.cpp.
References filter_eval_.
00070 { 00071 delete filter_eval_; 00072 }
bool OpenDDS::DCPS::MultiTopicImpl::filter | ( | const Sample & | s | ) | const [inline] |
Definition at line 65 of file MultiTopicImpl.h.
00066 { 00067 if (!filter_eval_) return true; 00068 ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, lock_, false); 00069 return filter_eval_->eval(s, expression_parameters_); 00070 }
const std::vector<SubjectFieldSpec>& OpenDDS::DCPS::MultiTopicImpl::get_aggregation | ( | ) | const [inline] |
Definition at line 54 of file MultiTopicImpl.h.
Referenced by OpenDDS::DCPS::MultiTopicDataReaderBase::init().
00055 { 00056 return aggregation_; 00057 }
DDS::ReturnCode_t OpenDDS::DCPS::MultiTopicImpl::get_expression_parameters | ( | DDS::StringSeq & | parameters | ) |
Definition at line 80 of file MultiTopicImpl.cpp.
References expression_parameters_, lock_, DDS::RETCODE_OK, and DDS::RETCODE_OUT_OF_RESOURCES.
00081 { 00082 ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, lock_, 00083 DDS::RETCODE_OUT_OF_RESOURCES); 00084 params = expression_parameters_; 00085 return DDS::RETCODE_OK; 00086 }
const std::vector<OPENDDS_STRING>& OpenDDS::DCPS::MultiTopicImpl::get_selection | ( | ) | const [inline] |
Definition at line 59 of file MultiTopicImpl.h.
Referenced by OpenDDS::DCPS::MultiTopicDataReaderBase::init().
00060 { 00061 return selection_; 00062 }
char * OpenDDS::DCPS::MultiTopicImpl::get_subscription_expression | ( | ) |
Implements DDS::MultiTopic.
Definition at line 74 of file MultiTopicImpl.cpp.
References CORBA::string_dup(), and subscription_expression_.
00075 { 00076 return CORBA::string_dup(subscription_expression_.c_str()); 00077 }
DDS::ReturnCode_t OpenDDS::DCPS::MultiTopicImpl::set_expression_parameters | ( | const DDS::StringSeq & | parameters | ) |
Definition at line 89 of file MultiTopicImpl.cpp.
References expression_parameters_, lock_, DDS::RETCODE_OK, and DDS::RETCODE_OUT_OF_RESOURCES.
00090 { 00091 ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, lock_, 00092 DDS::RETCODE_OUT_OF_RESOURCES); 00093 expression_parameters_ = p; 00094 return DDS::RETCODE_OK; 00095 }
std::vector<SubjectFieldSpec> OpenDDS::DCPS::MultiTopicImpl::aggregation_ [private] |
Definition at line 74 of file MultiTopicImpl.h.
Referenced by get_expression_parameters(), and set_expression_parameters().
Definition at line 75 of file MultiTopicImpl.h.
Referenced by MultiTopicImpl(), and ~MultiTopicImpl().
ACE_Recursive_Thread_Mutex OpenDDS::DCPS::MultiTopicImpl::lock_ [mutable, private] |
concurrent access to expression_parameters_
Definition at line 81 of file MultiTopicImpl.h.
Referenced by get_expression_parameters(), and set_expression_parameters().
std::vector<OPENDDS_STRING> OpenDDS::DCPS::MultiTopicImpl::selection_ [private] |
OPENDDS_STRING OpenDDS::DCPS::MultiTopicImpl::subscription_expression_ [private] |