NCBI C++ ToolKit
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
CQueryNodeValue Class Reference

Search Toolkit Book for CQueryNodeValue

class CQueryNodeValue More...

#include <gui/objutils/query_node_value.hpp>

+ Inheritance diagram for CQueryNodeValue:
+ Collaboration diagram for CQueryNodeValue:

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< Uint8TCounter
 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::TNodeGetQueryNode ()
 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 stringGetString () 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...
 
CObjectoperator= (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< CQueryNodeValuem_Ref
 Reference to similar object. More...
 

Protected Attributes

CQueryParseTree::TNodem_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< CPromoteRulem_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...
 

Detailed Description

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.

Member Typedef Documentation

◆ TFieldIDType

Definition at line 209 of file query_node_value.hpp.

Constructor & Destructor Documentation

◆ CQueryNodeValue() [1/2]

CQueryNodeValue::CQueryNodeValue ( )
inline

Definition at line 212 of file query_node_value.hpp.

◆ CQueryNodeValue() [2/2]

CQueryNodeValue::CQueryNodeValue ( CQueryParseTree::TNode n)
inline

Definition at line 222 of file query_node_value.hpp.

Member Function Documentation

◆ AddPromotedType()

void CQueryNodeValue::AddPromotedType ( const CPromoteRule pr)
inline

Append a new promote rule.

Definition at line 285 of file query_node_value.hpp.

References m_PromoteRules.

Referenced by CQueryFuncPromoteBase::PreProcess().

◆ AssignToRef()

bool CQueryNodeValue::AssignToRef ( const CQueryNodeValue source)

◆ Dereference()

void CQueryNodeValue::Dereference ( )

Definition at line 272 of file query_node_value.cpp.

References QueryValueType::eRef, m_DataType, and m_Ref.

Referenced by PromoteTo().

◆ GetBool()

virtual bool CQueryNodeValue::GetBool ( void  ) const
inlinevirtual

Implements IQueryMacroUserObject.

Definition at line 313 of file query_node_value.hpp.

References m_Bool.

◆ GetBranchDepth()

int CQueryNodeValue::GetBranchDepth ( ) const
inline

Definition at line 243 of file query_node_value.hpp.

References m_NodeBranchDepth.

◆ GetDataType()

QueryValueType::EBaseType CQueryNodeValue::GetDataType ( ) const
inline

◆ GetDouble()

virtual double CQueryNodeValue::GetDouble ( void  ) const
inlinevirtual

Implements IQueryMacroUserObject.

Definition at line 314 of file query_node_value.hpp.

References m_Double.

◆ GetFieldID()

TFieldIDType CQueryNodeValue::GetFieldID ( ) const
inline

◆ GetInt()

virtual Int8 CQueryNodeValue::GetInt ( void  ) const
inlinevirtual

Implements IQueryMacroUserObject.

Definition at line 315 of file query_node_value.hpp.

References m_Int.

◆ GetMaxChildBranchDepth()

int CQueryNodeValue::GetMaxChildBranchDepth ( ) const
inline

Definition at line 247 of file query_node_value.hpp.

References m_NodeMaxChildBranchDepth.

◆ GetPromoteRules()

vector<CPromoteRule>& CQueryNodeValue::GetPromoteRules ( )
inline

Return promotion rule(s) defined for this operator.

Definition at line 275 of file query_node_value.hpp.

References m_PromoteRules.

◆ GetPromoteType()

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().

◆ GetQueryNode()

CQueryParseTree::TNode* CQueryNodeValue::GetQueryNode ( )
inline

Get corresponding query node.

Definition at line 253 of file query_node_value.hpp.

References m_Node.

Referenced by CQueryFuncPromoteBase::PreProcess().

◆ GetScope()

objects::CScope* CQueryNodeValue::GetScope ( void  )
inline

Definition at line 272 of file query_node_value.hpp.

References m_Scope.

Referenced by CQueryFuncPromoteEq::Evaluate(), and CQueryFuncPromoteIn::Evaluate().

◆ GetString()

virtual const string& CQueryNodeValue::GetString ( void  ) const
inlinevirtual

Implements IQueryMacroUserObject.

Definition at line 312 of file query_node_value.hpp.

References m_String.

◆ GetValue()

bool CQueryNodeValue::GetValue ( void  ) const
inline

◆ GetVisibleValue()

string CQueryNodeValue::GetVisibleValue ( ) const
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.

◆ HasPromoteType()

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().

◆ IsDataField()

bool CQueryNodeValue::IsDataField ( ) const
inline

◆ PromoteTo()

void CQueryNodeValue::PromoteTo ( QueryValueType::EBaseType  pt)

◆ Reset()

virtual void CQueryNodeValue::Reset ( )
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().

◆ SetBool()

void CQueryNodeValue::SetBool ( bool  data)
virtual

◆ SetBranchDepth()

void CQueryNodeValue::SetBranchDepth ( int  bd)
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().

◆ SetDataType()

void CQueryNodeValue::SetDataType ( QueryValueType::EBaseType  dt)
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().

◆ SetDouble()

void CQueryNodeValue::SetDouble ( double  data)
virtual

◆ SetFieldID()

void CQueryNodeValue::SetFieldID ( TFieldIDType  fid)
inline

Definition at line 267 of file query_node_value.hpp.

References m_FieldID.

Referenced by CQueryFuncPromoteBase::PreProcess().

◆ SetInt()

void CQueryNodeValue::SetInt ( Int8  data)
virtual

◆ SetIsDataField()

void CQueryNodeValue::SetIsDataField ( bool  b)
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.

References b, and m_IsField.

Referenced by CQueryFuncPromoteBase::PreProcess().

◆ SetMaxChildBranchDepth()

void CQueryNodeValue::SetMaxChildBranchDepth ( int  cbd)
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().

◆ SetRef()

void CQueryNodeValue::SetRef ( CRef< CQueryNodeValue node)

◆ SetScope()

void CQueryNodeValue::SetScope ( objects::CScope *  s)
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().

◆ SetString()

void CQueryNodeValue::SetString ( const string data)
virtual

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.

◆ SetValue()

void CQueryNodeValue::SetValue ( int  v)
inline

Member Data Documentation

◆ m_Bool

bool CQueryNodeValue::m_Bool

◆ m_DataType

QueryValueType::EBaseType CQueryNodeValue::m_DataType
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().

◆ m_Double

double CQueryNodeValue::m_Double

◆ m_FieldID

TFieldIDType CQueryNodeValue::m_FieldID
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().

◆ m_Int

Int8 CQueryNodeValue::m_Int

◆ m_IsField

bool CQueryNodeValue::m_IsField
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().

◆ m_Node

CQueryParseTree::TNode* CQueryNodeValue::m_Node
protected

Node from parsed query tree.

Definition at line 319 of file query_node_value.hpp.

Referenced by GetQueryNode().

◆ m_NodeBranchDepth

int CQueryNodeValue::m_NodeBranchDepth
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().

◆ m_NodeMaxChildBranchDepth

int CQueryNodeValue::m_NodeMaxChildBranchDepth
protected

Definition at line 349 of file query_node_value.hpp.

Referenced by GetMaxChildBranchDepth(), and SetMaxChildBranchDepth().

◆ m_PromoteRules

vector<CPromoteRule> CQueryNodeValue::m_PromoteRules
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().

◆ m_Ref

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().

◆ m_Scope

objects::CScope* CQueryNodeValue::m_Scope
protected

Used for comparing seq-ids.

Definition at line 331 of file query_node_value.hpp.

Referenced by GetScope(), and SetScope().

◆ m_String

string CQueryNodeValue::m_String

◆ m_Value

bool CQueryNodeValue::m_Value
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().


The documentation for this class was generated from the following files:
Modified on Mon May 27 04:38:18 2024 by modify_doxy.py rev. 669887