NCBI C++ ToolKit
|
Search Toolkit Book for CQueryNodeValue
class CQueryNodeValue More...
#include <gui/objutils/query_node_value.hpp>
Public Types | |
typedef CQueryExec::TFieldID | TFieldIDType |
Public Types inherited from CObject | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
Public Member Functions | |
CQueryNodeValue () | |
CQueryNodeValue (CQueryParseTree::TNode *n) | |
virtual void | Reset () |
Reset user object (for reuse without reallocation) More... | |
virtual string | GetVisibleValue () const |
String value for debuging. More... | |
bool | GetValue () const |
Set boolean result value (result of (sub)expression). More... | |
void | SetValue (int v) |
void | SetBranchDepth (int bd) |
Set/Get number of branches between node and root. More... | |
int | GetBranchDepth () const |
void | SetMaxChildBranchDepth (int cbd) |
Set/Get number of branches between node and most distant child. More... | |
int | GetMaxChildBranchDepth () const |
void | PromoteTo (QueryValueType::EBaseType pt) |
Convert current value to the type 'pt'. Does not update m_DataType. More... | |
CQueryParseTree::TNode * | GetQueryNode () |
Get corresponding query node. More... | |
void | SetDataType (QueryValueType::EBaseType dt) |
Set/get underlying data type. More... | |
QueryValueType::EBaseType | GetDataType () const |
void | SetIsDataField (bool b) |
Set/Get to indicate if this is a field from the data source or simple string. More... | |
bool | IsDataField () const |
void | SetFieldID (TFieldIDType fid) |
TFieldIDType | GetFieldID () const |
void | SetScope (objects::CScope *s) |
Set/Get CScope used for comparing seq-ids. More... | |
objects::CScope * | GetScope () |
vector< CPromoteRule > & | GetPromoteRules () |
Return promotion rule(s) defined for this operator. More... | |
QueryValueType::EBaseType | GetPromoteType (size_t arg_idx) |
Get the promotion type for a specific argument pair, or eUndefined if no rule is available. More... | |
bool | HasPromoteType (size_t arg_idx, QueryValueType::EBaseType t1, QueryValueType::EBaseType t2) |
Return true if there is a promote entry defined for the specified argument pair at 'idx' only if the types for the rule match t1 and t2. More... | |
void | AddPromotedType (const CPromoteRule &pr) |
Append a new promote rule. More... | |
void | Dereference () |
virtual void | SetString (const string &data) |
Set/get underlying data type. More... | |
virtual void | SetBool (bool data) |
virtual void | SetDouble (double data) |
virtual void | SetInt (Int8 data) |
void | SetRef (CRef< CQueryNodeValue > node) |
bool | AssignToRef (const CQueryNodeValue &source) |
virtual const string & | GetString () const |
virtual bool | GetBool () const |
virtual double | GetDouble () const |
virtual Int8 | GetInt () const |
Public Member Functions inherited from CObject | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
Public Member Functions inherited from CDebugDumpable | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
Public Attributes | |
string | m_String |
String data, if data came from a string or data field in the tree. More... | |
bool | m_Bool |
Bool data, if data base a constant boolean or converted into one. More... | |
Int8 | m_Int |
Int data, if data was an integer or converted into one. More... | |
double | m_Double |
Floating point data, if data was a double or converted into one. More... | |
CRef< CQueryNodeValue > | m_Ref |
Reference to similar object. More... | |
Protected Attributes | |
CQueryParseTree::TNode * | m_Node |
Node from parsed query tree. More... | |
QueryValueType::EBaseType | m_DataType |
Data type, including source of the data (const, string field, or tree) More... | |
bool | m_IsField |
True if the data comes from field in the tree. More... | |
TFieldIDType | m_FieldID |
If it is a field, this is the ID to look it up (efficiently) More... | |
objects::CScope * | m_Scope |
Used for comparing seq-ids. More... | |
vector< CPromoteRule > | m_PromoteRules |
The promote rules defined for the current operator. More... | |
bool | m_Value |
Boolean result of the (sub)expression attached to the corresponding query node. More... | |
int | m_NodeBranchDepth |
Mechanism to pass current position of node within the tree in terms of the number of branches between the node and the parent and between the node and it's most distant (by branch count) child. More... | |
int | m_NodeMaxChildBranchDepth |
Additional Inherited Members | |
Static Public Member Functions inherited from CObject | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
Static Public Member Functions inherited from CDebugDumpable | |
static void | EnableDebugDump (bool on) |
Static Public Attributes inherited from CObject | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
Protected Member Functions inherited from CObject | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
class CQueryNodeValue
Subclass of the IQueryParseUserObject which is held as the user-defined object in each CQueryParseNode. Holds a boolean value that tells us if the subexpression evaluted to true or not, so that value can be passed up the tree. Also keeps track of whether that value has been set.
This class also holds data similar to CQueryParseNode, but with more information about the type (includes both the underlying type and source of the data). More than one data element may be valid, e.g. if the data is an integer parsed from a string (eStringInt), both the string and integer fields will be set.
Definition at line 206 of file query_node_value.hpp.
Definition at line 209 of file query_node_value.hpp.
|
inline |
Definition at line 212 of file query_node_value.hpp.
|
inline |
Definition at line 222 of file query_node_value.hpp.
|
inline |
Append a new promote rule.
Definition at line 285 of file query_node_value.hpp.
References m_PromoteRules.
Referenced by CQueryFuncPromoteBase::PreProcess().
bool CQueryNodeValue::AssignToRef | ( | const CQueryNodeValue & | source | ) |
Definition at line 280 of file query_node_value.cpp.
References QueryValueType::eRef, m_DataType, m_Ref, and rapidjson::source.
Referenced by CQueryFuncAssignment::Evaluate().
void CQueryNodeValue::Dereference | ( | ) |
Definition at line 272 of file query_node_value.cpp.
References QueryValueType::eRef, m_DataType, and m_Ref.
Referenced by PromoteTo().
|
inlinevirtual |
Implements IQueryMacroUserObject.
Definition at line 313 of file query_node_value.hpp.
References m_Bool.
|
inline |
Definition at line 243 of file query_node_value.hpp.
References m_NodeBranchDepth.
|
inline |
Definition at line 257 of file query_node_value.hpp.
References m_DataType.
Referenced by CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteBase::PreProcess(), CQueryFuncPromoteBase::ResolveAndPromote(), CQueryFuncPromoteBase::ResolveFieldValue(), and CQueryFuncPromoteBase::SetCompareType().
|
inlinevirtual |
Implements IQueryMacroUserObject.
Definition at line 314 of file query_node_value.hpp.
References m_Double.
|
inline |
Definition at line 268 of file query_node_value.hpp.
References m_FieldID.
Referenced by CQueryFuncPromoteLogic::Evaluate(), and CQueryFuncPromoteBase::ResolveFieldValue().
|
inlinevirtual |
Implements IQueryMacroUserObject.
Definition at line 315 of file query_node_value.hpp.
References m_Int.
|
inline |
Definition at line 247 of file query_node_value.hpp.
References m_NodeMaxChildBranchDepth.
|
inline |
Return promotion rule(s) defined for this operator.
Definition at line 275 of file query_node_value.hpp.
References m_PromoteRules.
QueryValueType::EBaseType CQueryNodeValue::GetPromoteType | ( | size_t | arg_idx | ) |
Get the promotion type for a specific argument pair, or eUndefined if no rule is available.
Definition at line 220 of file query_node_value.cpp.
References QueryValueType::eUndefined, and m_PromoteRules.
Referenced by CQueryFuncPromoteBase::ResolveAndPromote().
|
inline |
Get corresponding query node.
Definition at line 253 of file query_node_value.hpp.
References m_Node.
Referenced by CQueryFuncPromoteBase::PreProcess().
|
inline |
Definition at line 272 of file query_node_value.hpp.
References m_Scope.
Referenced by CQueryFuncPromoteEq::Evaluate(), and CQueryFuncPromoteIn::Evaluate().
Implements IQueryMacroUserObject.
Definition at line 312 of file query_node_value.hpp.
References m_String.
|
inline |
Set boolean result value (result of (sub)expression).
Definition at line 238 of file query_node_value.hpp.
References m_Value.
Referenced by CTableQueryExec::EvalNext(), CTreeQueryExec::EvalNext(), CQueryFuncPromoteAndOr::Evaluate(), CQueryFuncPromoteLogic::Evaluate(), CQueryFuncPromoteEq::Evaluate(), CQueryFuncLike::Evaluate(), and GetVisibleValue().
|
virtual |
String value for debuging.
Reimplemented from IQueryParseUserObject.
Definition at line 86 of file query_node_value.cpp.
References QueryValueType::GetTypeAsString(), GetValue(), IsDataField(), m_DataType, str(), and string.
bool CQueryNodeValue::HasPromoteType | ( | size_t | arg_idx, |
QueryValueType::EBaseType | t1, | ||
QueryValueType::EBaseType | t2 | ||
) |
Return true if there is a promote entry defined for the specified argument pair at 'idx' only if the types for the rule match t1 and t2.
Definition at line 226 of file query_node_value.cpp.
References m_PromoteRules.
Referenced by CQueryFuncPromoteBase::ResolveAndPromote().
|
inline |
Definition at line 263 of file query_node_value.hpp.
References m_IsField.
Referenced by CQueryFuncPromoteLogic::Evaluate(), CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteIn::Evaluate(), GetVisibleValue(), CQueryHighlightFunction::operator()(), CQueryFuncPromoteBase::PreProcess(), CQueryFuncPromoteBase::ResolveAndPromote(), CQueryFuncPromoteBase::ResolveFieldValue(), and CQueryFuncPromoteBase::SetCompareType().
void CQueryNodeValue::PromoteTo | ( | QueryValueType::EBaseType | pt | ) |
Convert current value to the type 'pt'. Does not update m_DataType.
Definition at line 95 of file query_node_value.cpp.
References Dereference(), NStr::DoubleToString(), QueryValueType::eBool, QueryValueType::eBoolResult, QueryValueType::eFieldBool, QueryValueType::eFieldFloat, QueryValueType::eFieldInt, QueryValueType::eFieldString, QueryValueType::eFloat, QueryValueType::eInt, QueryValueType::eRef, QueryValueType::eSeqID, QueryValueType::eString, QueryValueType::eStringBool, QueryValueType::eStringFloat, QueryValueType::eStringInt, QueryValueType::GetTypeAsString(), int, NStr::Int8ToString(), m_Bool, m_DataType, m_Double, m_Int, m_String, and NCBI_THROW.
Referenced by CQueryFuncPromoteLogic::Evaluate(), CQueryFuncPromoteBase::PreProcess(), and CQueryFuncPromoteBase::ResolveAndPromote().
|
inlinevirtual |
Reset user object (for reuse without reallocation)
Implements IQueryParseUserObject.
Definition at line 234 of file query_node_value.hpp.
References m_Value.
Referenced by CQueryFuncPromoteValue::Evaluate(), and CQueryFuncPromoteIdentifier::Evaluate().
|
virtual |
Implements IQueryMacroUserObject.
Definition at line 244 of file query_node_value.cpp.
References data, QueryValueType::eBool, QueryValueType::eUndefined, m_Bool, and m_DataType.
|
inline |
Set/Get number of branches between node and root.
Definition at line 242 of file query_node_value.hpp.
References m_NodeBranchDepth.
Referenced by CTreeQueryExec::CallFunction().
|
inline |
Set/get underlying data type.
Definition at line 256 of file query_node_value.hpp.
References m_DataType.
Referenced by CQueryFuncAssignment::Evaluate(), CQueryFuncPromoteBase::PreProcess(), and CQueryFuncPromoteBase::SetCompareType().
|
virtual |
Implements IQueryMacroUserObject.
Definition at line 251 of file query_node_value.cpp.
References data, QueryValueType::eFloat, QueryValueType::eUndefined, m_DataType, and m_Double.
|
inline |
Definition at line 267 of file query_node_value.hpp.
References m_FieldID.
Referenced by CQueryFuncPromoteBase::PreProcess().
|
virtual |
Implements IQueryMacroUserObject.
Definition at line 258 of file query_node_value.cpp.
References data, QueryValueType::eInt, QueryValueType::eUndefined, m_DataType, and m_Int.
|
inline |
Set/Get to indicate if this is a field from the data source or simple string.
The type of field may not yet be avialable (if it has to be determined for each separate data element)
Definition at line 262 of file query_node_value.hpp.
Referenced by CQueryFuncPromoteBase::PreProcess().
|
inline |
Set/Get number of branches between node and most distant child.
Definition at line 246 of file query_node_value.hpp.
References m_NodeMaxChildBranchDepth.
Referenced by CTreeQueryExec::CallFunction().
void CQueryNodeValue::SetRef | ( | CRef< CQueryNodeValue > | node | ) |
Definition at line 265 of file query_node_value.cpp.
References QueryValueType::eRef, m_DataType, and m_Ref.
Referenced by CQueryFuncRTVar::Evaluate(), and CMacroQueryExec::ResolveRTVar().
|
inline |
Set/Get CScope used for comparing seq-ids.
Definition at line 271 of file query_node_value.hpp.
References m_Scope.
Referenced by CQueryFuncPromoteBase::PreProcess().
Set/get underlying data type.
Implements IQueryMacroUserObject.
Definition at line 237 of file query_node_value.cpp.
References data, QueryValueType::eString, QueryValueType::eUndefined, m_DataType, and m_String.
|
inline |
Definition at line 239 of file query_node_value.hpp.
References m_Value.
Referenced by CQueryFuncPromoteAndOr::Evaluate(), CQueryFuncPromoteLogic::Evaluate(), CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteIn::Evaluate(), CQueryFuncLike::Evaluate(), CQueryFuncPromoteGtLt::Evaluate(), CQueryFuncPromoteBetween::Evaluate(), and CQueryFuncPromoteBase::ResolveAndPromote().
bool CQueryNodeValue::m_Bool |
Bool data, if data base a constant boolean or converted into one.
Definition at line 293 of file query_node_value.hpp.
Referenced by CQueryFuncPromoteLogic::Evaluate(), CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteIn::Evaluate(), CQueryFuncPromoteGtLt::Evaluate(), GetBool(), CQueryFuncPromoteBase::PreProcess(), PromoteTo(), CQueryFuncPromoteBase::ResolveFieldValue(), SetBool(), and CQueryFuncPromoteBase::SetCompareType().
|
protected |
Data type, including source of the data (const, string field, or tree)
Definition at line 322 of file query_node_value.hpp.
Referenced by AssignToRef(), Dereference(), GetDataType(), GetVisibleValue(), PromoteTo(), SetBool(), SetDataType(), SetDouble(), SetInt(), SetRef(), and SetString().
double CQueryNodeValue::m_Double |
Floating point data, if data was a double or converted into one.
Definition at line 299 of file query_node_value.hpp.
Referenced by CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteIn::Evaluate(), CQueryFuncPromoteGtLt::Evaluate(), CQueryFuncPromoteBetween::Evaluate(), GetDouble(), CQueryFuncPromoteBase::PreProcess(), PromoteTo(), CQueryFuncPromoteBase::ResolveFieldValue(), CQueryFuncPromoteBase::SetCompareType(), and SetDouble().
|
protected |
If it is a field, this is the ID to look it up (efficiently)
Definition at line 328 of file query_node_value.hpp.
Referenced by GetFieldID(), and SetFieldID().
Int8 CQueryNodeValue::m_Int |
Int data, if data was an integer or converted into one.
Definition at line 296 of file query_node_value.hpp.
Referenced by CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteIn::Evaluate(), CQueryFuncPromoteGtLt::Evaluate(), CQueryFuncPromoteBetween::Evaluate(), GetInt(), CQueryFuncPromoteBase::PreProcess(), PromoteTo(), CQueryFuncPromoteBase::ResolveFieldValue(), CQueryFuncPromoteBase::SetCompareType(), and SetInt().
|
protected |
True if the data comes from field in the tree.
Definition at line 325 of file query_node_value.hpp.
Referenced by IsDataField(), and SetIsDataField().
|
protected |
Node from parsed query tree.
Definition at line 319 of file query_node_value.hpp.
Referenced by GetQueryNode().
|
protected |
Mechanism to pass current position of node within the tree in terms of the number of branches between the node and the parent and between the node and it's most distant (by branch count) child.
Definition at line 348 of file query_node_value.hpp.
Referenced by GetBranchDepth(), and SetBranchDepth().
|
protected |
Definition at line 349 of file query_node_value.hpp.
Referenced by GetMaxChildBranchDepth(), and SetMaxChildBranchDepth().
|
protected |
The promote rules defined for the current operator.
This will be empty for atomic types. For operator type query nodes (e.g. ==, <, etc) this will have the comparison (promotion) type for each pair of operands. If one or more types will be defined at runtime, e.g. an untyped field from the data source, this will be empty
Definition at line 338 of file query_node_value.hpp.
Referenced by AddPromotedType(), GetPromoteRules(), GetPromoteType(), and HasPromoteType().
CRef<CQueryNodeValue> CQueryNodeValue::m_Ref |
Reference to similar object.
Definition at line 302 of file query_node_value.hpp.
Referenced by AssignToRef(), Dereference(), and SetRef().
|
protected |
Used for comparing seq-ids.
Definition at line 331 of file query_node_value.hpp.
Referenced by GetScope(), and SetScope().
string CQueryNodeValue::m_String |
String data, if data came from a string or data field in the tree.
Definition at line 290 of file query_node_value.hpp.
Referenced by CQueryFuncPromoteEq::Evaluate(), CQueryFuncPromoteIn::Evaluate(), CQueryFuncLike::Evaluate(), CQueryFuncPromoteGtLt::Evaluate(), CQueryFuncPromoteBetween::Evaluate(), GetString(), CQueryFuncPromoteBase::PreProcess(), PromoteTo(), CQueryFuncPromoteBase::ResolveFieldValue(), CQueryFuncPromoteBase::SetCompareType(), and SetString().
|
protected |
Boolean result of the (sub)expression attached to the corresponding query node.
Definition at line 342 of file query_node_value.hpp.
Referenced by GetValue(), Reset(), and SetValue().