QueryConditionImpl.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_QUERYCONDITIONIMPL_H
00009 #define OPENDDS_DCPS_QUERYCONDITIONIMPL_H
00010 
00011 #ifndef OPENDDS_NO_QUERY_CONDITION
00012 
00013 #include "dds/DdsDcpsSubscriptionC.h"
00014 #include "dds/DCPS/ReadConditionImpl.h"
00015 #include "dds/DCPS/FilterEvaluator.h"
00016 #include "dds/DCPS/PoolAllocator.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 #pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 
00022 #include <vector>
00023 
00024 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 namespace OpenDDS {
00027 namespace DCPS {
00028 
00029 class DataReaderImpl;
00030 
00031 class OpenDDS_Dcps_Export QueryConditionImpl
00032   : public virtual OpenDDS::DCPS::LocalObject<DDS::QueryCondition>
00033   , public virtual ReadConditionImpl {
00034 public:
00035   QueryConditionImpl(DataReaderImpl* dr, DDS::SampleStateMask sample_states,
00036                      DDS::ViewStateMask view_states, DDS::InstanceStateMask instance_states,
00037                      const char* query_expression);
00038 
00039   virtual ~QueryConditionImpl() {}
00040 
00041   char* get_query_expression();
00042 
00043   DDS::ReturnCode_t get_query_parameters(DDS::StringSeq& query_parameters);
00044 
00045   DDS::ReturnCode_t set_query_parameters(
00046     const DDS::StringSeq& query_parameters);
00047 
00048   CORBA::Boolean get_trigger_value();
00049 
00050   std::vector<OPENDDS_STRING> getOrderBys() const;
00051 
00052   bool hasFilter() const;
00053 
00054   template<typename Sample>
00055   bool filter(const Sample& s) const
00056   {
00057     ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, guard, lock_, false);
00058     return evaluator_.eval(s, query_parameters_);
00059   }
00060 
00061 private:
00062   CORBA::String_var query_expression_;
00063   DDS::StringSeq query_parameters_;
00064   FilterEvaluator evaluator_;
00065   /// Concurrent access to query_parameters_
00066   mutable ACE_Recursive_Thread_Mutex lock_;
00067 };
00068 
00069 } // namespace DCPS
00070 } // namespace OpenDDS
00071 
00072 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00073 
00074 #endif // OPENDDS_NO_QUERY_CONDITION
00075 
00076 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1