10 #ifndef __RD_QUERY_H__
11 #define __RD_QUERY_H__
14 #pragma warning (disable: 4800) // warning: converting things to bool
19 #include <boost/smart_ptr.hpp>
44 template <
class MatchFuncArgType,
class DataFuncArgType=MatchFuncArgType,
45 bool needsConversion=
false>
48 typedef boost::shared_ptr< Query<MatchFuncArgType, DataFuncArgType, needsConversion> >
CHILD_TYPE;
93 virtual bool Match(
const DataFuncArgType arg)
const{
97 else tRes =
static_cast<bool>(mfArg);
135 MatchFuncArgType mfArg;
146 MatchFuncArgType mfArg;
160 template <
class T1,
class T2>
161 int queryCmp(
const T1 v1,
const T2 v2,
const T1 tol) {
bool getNegation() const
returns whether or not we are negated
int queryCmp(const T1 v1, const T2 v2, const T1 tol)
CHILD_VECT_CI beginChildren() const
returns an iterator for the beginning of our child vector
const std::string & getDescription() const
returns our text description
void setNegation(bool what)
sets whether or not we are negated
virtual Query< MatchFuncArgType, DataFuncArgType, needsConversion > * copy() const
returns a copy of this Query
CHILD_VECT_CI endChildren() const
returns an iterator for the end of our child vector
boost::shared_ptr< Query< MatchFuncArgType, DataFuncArgType, needsConversion > > CHILD_TYPE
MatchFuncArgType TypeConvert(MatchFuncArgType what, Int2Type< false >) const
calls our dataFunc (if it's set) on what and returns the result, otherwise returns what ...
CHILD_VECT::iterator CHILD_VECT_I
MatchFuncArgType(*)(DataFuncArgType) getDataFunc() const
returns our data function:
void setMatchFunc(bool(*what)(MatchFuncArgType))
sets our match function
virtual bool Match(const DataFuncArgType arg) const
returns whether or not we match the argument
bool(* d_matchFunc)(MatchFuncArgType)
class to allow integer values to pick templates
void setDescription(const char *descr)
void addChild(CHILD_TYPE child)
adds a child to our list of children
MatchFuncArgType(* d_dataFunc)(DataFuncArgType)
std::vector< CHILD_TYPE > CHILD_VECT
bool(*)(MatchFuncArgType) getMatchFunc() const
returns our match function:
void setDataFunc(MatchFuncArgType(*what)(DataFuncArgType))
sets our data function
CHILD_VECT::const_iterator CHILD_VECT_CI
#define PRECONDITION(expr, mess)
virtual std::string getFullDescription() const
returns a fuller text description
std::string d_description
MatchFuncArgType TypeConvert(DataFuncArgType what, Int2Type< true >) const
calls our dataFunc (which must be set) on what and returns the result
Base class for all queries.
void setDescription(const std::string &descr)
sets our text description