macro::CMacroParser::TFunctionNamesList where_funcs, do_funcs;
120 stringname = (*cit).first;
123 switch(p_func->GetFuncScope()) {
124 caseITreeMacroFunction::eDo:
125do_funcs.push_back(name);
127 caseITreeMacroFunction::eWhere:
128where_funcs.push_back(name);
131do_funcs.push_back(name);
132where_funcs.push_back(name);
140parser.SetFunctionNames(where_funcs, do_funcs);
150 for(it = fd.
begin(); it != fd.
end(); ++it) {
152(*it).second.c_str());
204 stringfeature_value;
206GetFeatureValue(
id, feature_value);
226 stringfeature_value;
228GetFeatureValue(
id, feature_value);
247 stringfeature_value;
249GetFeatureValue(
id, feature_value);
306 "Error - function \""+ name +
"\" not implemented", &node);
308 if((
m_EvalDo&& func->GetFuncScope() == ITreeMacroFunction::eWhere) ||
309(!
m_EvalDo&& func->GetFuncScope() == ITreeMacroFunction::eDo))
311 "Error - function \""+ name +
"\" is used in the wrong do/where clause scope", &node);
315 "Error - tree pointer was not set", &node);
322func->SetNestedState(ITreeMacroFunction::eNested);
325func->SetNestedState(ITreeMacroFunction::eNotNested);
338 catch(
constmacro::CMacroDataException &err) {
339 stringmessage(
"Function ");
341message +=
" failed";
344 catch(macro::CMacroExecException &
error) {
388 boolselected =
false;
396top_node->
GetValue().GetUserObject());
408 LOG_POST(
"Query parse error during execution: "<< pe.
GetMsg());
427 boolselected =
false;
440top_node->
GetValue().GetUserObject());
457qtree = m.GetDoTree();
460 NCBI_THROW(macro::CMacroExecException, eInternalError,
"Error - no functions found in the do section");
473 f.GetPrevFeatures() = node->GetBioTreeFeatureList();
487 f.GetFeatures() = node->GetBioTreeFeatureList();
488 boolnode_updated =
false;
489 if(
f.GetPrevFeatures().GetFeatureList().size() !=
f.GetFeatures().GetFeatureList().size()) {
490node_updated =
true;
493 for(
size_t i= 0;
i<
f.GetFeatures().GetFeatureList().
size(); ++
i) {
494 if(
f.GetFeatures().GetFeatureList()[
i].id !=
f.GetPrevFeatures().GetFeatureList()[
i].id ||
495 f.GetFeatures().GetFeatureList()[
i].value !=
f.GetPrevFeatures().GetFeatureList()[
i].value) {
496node_updated =
true;
522 LOG_POST(
"Query parse error during execution: "<< pe.
GetMsg());
@ eBoth
Both preliminary and traceback stages.
implements special composite command, which does not call to its internal commands when run the very ...
CMacroFunction_AddToSelectionSet.
CMacroFunction_BranchDepth Returns the number of branches between the current node and the root node.
CMacroFunction_CollapseNode Collapses the current node.
CMacroFunction_Date Takes a date/time string as a parameter and returns it as an integer number of se...
CMacroFunction_DeleteNode Deletes the current node.
CMacroFunction_ExpandNode Expands the current node.
CMacroFunction_IsLeaf Returns true if child is a leaf, so you can do queries that exclude non-leaf no...
CMacroFunction_IsNull Returns true of the passed in property is not set at all for the current node.
CMacroFunction_MaxChildBranchDepth Returns the number of branches between the current node and its mo...
CMacroFunction_NumChildren Returns the number of children of the current node so that you can search ...
CMacroFunction_SetBounding Takes one parameter (string) and sets that as the $NODE_BOUNDED property f...
CMacroFunction_SetColor Takes one string parameter and uses it to sets the color for the node to that...
CMacroFunction_SetMarker Takes one parameter (string) and sets that as the marker property for the no...
CMacroFunction_SetProperty Takes a property name (string) and property value (string) and sets or upd...
CMacroFunction_SetSize Takes one integer parameter and uses it to sets the radius for the node to tha...
CMacroFunction_SubtreeSum Calculates the sum of node property (single parameter) of all the nodes tha...
virtual ~CMacroFunction_TopLevel2()
virtual void TheFunction()
CMacroFunction_TopLevel2(EScopeEnum func_scope, CPhyloTree *tree)
void SetMacroRep(macro::CMacroRep *mr)
bool IsUnused() const
Return true the index 'idx' in the array is not currently part of the tree.
Tree subclass also has functions and data needed for rendering and selection.
CPhyloSelectionSetMgr & GetSelectionSets()
TTreeIdx FindNodeById(TID id) const
Return index of the node with the given id or Null().
CBioTreeFeatureDictionary & GetFeatureDict()
Return feature dictionary.
class CQueryExecException
void SetBranchDepth(int bd)
Set/Get number of branches between node and root.
bool GetValue() const
Set boolean result value (result of (sub)expression).
void SetMaxChildBranchDepth(int cbd)
Set/Get number of branches between node and most distant child.
Query tree and associated utility methods.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
TNodeList_CI SubNodeEnd() const
Return const iterator to end of subnode list.
TData & GetValue()
Return the value object for the node.
bool IsLeaf() const
Report whether this is a leaf node.
TNodeType & GetNode(TTreeIdx idx)
Return a reference to the node at the given index.
TNodeType & GetRoot()
Return a reference to the root node of the tree.
TTreeIdx GetRootIdx() const
Return the index of the root node.
definition of a Culling tree
ITreeMacroFunction * x_ResolveFunctionName(const string &name) const
Locates function by name.
virtual bool EvalNext(CQueryParseTree &qtree)
Move to the next row for eval, return false if table size < m_EvalRow+1.
std::stack< PhyloTreePointer > m_NodeStack
stack of visited nodes up the tree
void SetTree(CPhyloTree *t)
Set current node for query execution.
const CBioTreeFeatureDictionary * m_Dictionary
Dictionary of 'features' for the tree.
std::vector< TTreeIdx > m_Selected
current set of selected nodes from the query
TBuiltInFunctionsMap m_BuiltInFunctions
functions
virtual bool HasIdentifier(const std::string &identifier)
Search for 'identifier' in dictionary and return true if it exists.
int m_NodeMaxChildBranchDepth
Number of branches between the current node and it's most distant (by branch count) child.
virtual void GetFunctionNames(macro::CMacroParser &parser) const
void x_EvalAdvance()
Moves to next node for 'EvalNext' functions.
virtual ~CTreeQueryExec()
virtual void CallFunction(const string &name, CQueryParseTree::TNode &node)
Extend this function to look up and invoke functions that appear in the query.
int m_NodeBranchDepth
Depth in tree as an integer - number of branches between current node and root.
bool m_TopologyChange
If true topology changed (e.g. a node was deleted)
bool m_EvalDo
Flag indicates if the work should be performed on the Do clause.
CRef< CSelectionSetEdit > m_SelectionSetEdit
Undo-redo buffer for selection sets (which are stored in biotreecontainer user data)
virtual bool ResolveIdentifier(const std::string &identifier, bool &value)
If query has an identifier, this will resolve it in an application-specific way.
virtual void EvalStart()
Move to the first row for eval, return false if table empty.
TTreeIdx m_EvalNode
Node currently being evaluated.
bool m_DisableUndo
To disable use of undo buffer (m_FeatureEdit)
CRef< CFeatureEdit > m_FeatureEdit
The undo/redo buffer for node properties.
virtual bool EvalComplete()
void x_ClearBuiltInFunctions()
Deletes function objects.
CRef< CMacroCmdComposite > m_CmdComposite
TBioTreeFeatureId GetFeatureIdNoCase(const string &feature_name, const CBioTreeFeatureDictionary *dict) const
Returns id of a registred tree feature based on case-insensitive compare or -1 if feature does not ex...
virtual TFieldID GetIdentifier(const std::string &identifier)
Get biotree feature ID for identifier or return TFieldID(-1)
Base class for functions which can be called from the WHERE or DO clauses of macros/queries using the...
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
void ThrowCMacroExecException(const CDiagCompileInfo &info, CMacroExecException::EErrCode code, const string &message, const CQueryParseTree::TNode *treeNode, const CException *previous=nullptr)
Throws CMacroExecException with the specified message and error location from the TNode.
void Reset(void)
Reset reference object.
TObjectType & GetObject(void)
Get object.
int64_t Int8
8-byte (64-bit) signed integer
unsigned pos
Position in the src line.
const TNode * GetQueryTree() const
unsigned line
Src line number.
virtual void Evaluate(CQueryParseTree &qtree)
Run query tree evaluation.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool StringToBool(const CTempString str)
Convert string to bool.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static string & ToUpper(string &str)
Convert string to upper case â string& version.
unsigned int TBioTreeFeatureId
Feature Id.
const TValue & GetValue(void) const
Return node's value.
const TFeatureDict & GetFeatureDict() const
Get reference on the internal map.
const TTreeType * GetParent(void) const
Get node's parent.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Edits for one or more nodes.
vector< CUpdatedFeature > & GetUpdated()
Source location (points to the position in the original src) All positions are 0 based.
Edits for one or more nodes.
CPhyloSelectionSetMgr & GetPrevSet()
for iterating through the node tree without recursion
TNodeType::TNodeList_I m_Iterator
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4