1 #ifndef GUI_OBJUTILS___MACRO_REP__HPP
2 #define GUI_OBJUTILS___MACRO_REP__HPP
60 IMacroVar(
const string& var_name) : m_VarName(var_name) {}
67 const string&
GetName()
const {
return m_VarName; }
75 os << m_VarName <<
" = <" <<
x_GetValue().AsString() <<
">" << endl;
99 const string&
AsString()
const {
return m_String; }
102 void Set(
const string&
str);
104 void Set(
double val);
120 case eValueTypeFloat:
124 m_String = (m_Bool) ?
"true" :
"false";
126 case eValueTypeString:
173 CMacroVarAsk(
const string& name,
const string& def_value);
193 void x_ParseString(
const string&
str,
bool new_value =
false);
223 const string* GetFirstChoice();
224 const string* GetNextChoice();
275 void SetName(
const string& name) { m_Name = name; }
277 void SetTitle(
const string& title) { m_Title = title; }
281 if (m_KeyWords.empty())
282 m_KeyWords = keyWords;
285 m_KeyWords += keyWords;
295 void SetVarInt(
const string& name,
Int8 value);
296 void SetVarFloat(
const string& name,
double value);
297 void SetVarBool(
const string& name,
bool value);
298 void SetVarString(
const string& name,
const string&
value);
300 void SetVarAsk(
const string& name,
const string&
value);
302 void SetVarChoiceName(
const string& name);
304 void SetVarChoiceFloat(
double value);
305 void SetVarChoiceBool(
bool value);
306 void SetVarChoiceString(
const string&
value);
333 void SetSource (
const string& source_text) { m_SourceText = source_text; }
334 const string&
GetSource()
const {
return m_SourceText; }
339 bool FindVar(
const string& name)
const;
341 IMacroVar* GetVar(
const string& name)
const;
354 const string&
GetName()
const {
return m_Name; }
376 bool HasIdentifier(
const string& ident)
const;
391 const string& separator)
const;
394 IMacroVar* x_FindVar(
const string& name)
const;
397 TVariables& x_GetOrCreateLastBlock();
413 string m_NrThreads{
"1" };
Class for parsed macro representation.
Class for "ask" variable representation (i.e.
Class for "choice" variable representation (i.e.
derived classes for representation of specific variable types.
Query execution environment holds the function registry and the execution context.
Query tree and associated utility methods.
definition of a Culling tree
Abstract interface for variable representation.
class IQueryMacroUserObject
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char * str(char *buf, int n)
CMacroVarSimple(const string &name, const string &value)
virtual bool IsGUIResolvable() const
Returns true is the variable can be resolved via GUI.
string m_VarName
Name of variable.
void AddChoiceFloat(double value)
void SetName(const string &name)
Set the name of the macro.
virtual ~CMacroVarSimple()
Destructor.
virtual bool IsGUIResolvable() const
Returns true is the variable can be resolved via GUI.
void x_WriteAsString(void)
const string & GetName() const
Get the name of stored variable.
void SetForEachItem(const string &name)
Set "for each" asn selector.
CMacroVarSimple(const string &name, Int8 value)
CMacroVarChoice(const string &name)
Constructor.
const string & GetForEachString() const
Return "for each" string.
TVarBlocks m_VarBlocks
Variables.
vector< SValue > m_Choices
Storage for "choice" variable values.
virtual ~CMacroVarAsk()
Destructor.
string m_Title
Macro title.
void SetNamedAnnot(const string &name)
Set named annotation.
virtual bool IsGUIResolvable() const =0
Returns true is the variable can be resolved via GUI.
static const string m_TopFuncName
Name for top level function.
Int4 m_NumOfVarBlocks
Number of blocks of variables.
virtual SValue x_GetValue() const =0
Gets the variable value from derived classes.
const string & GetDefaultValue() const
Get default value.
CMacroVarSimple(const string &name, double value)
vector< CQueryParseTree * > GetAssignmentWhereClauses() const
string m_Foreach
For each string.
bool GetNodeValue(IQueryMacroUserObject &v) const
Fill in IQueryMacroUserObject-derived node Return true if successful.
virtual bool IsGUIResolvable() const
Returns true is the variable can be resolved via GUI.
size_t m_ReturnedChoice
Internal state for get choices functions.
const TSeqRange & GetSeqRange() const
Return sequence range.
unique_ptr< CQueryParseTree > m_DoTree
Parsed function calls.
SValue m_DefaultValue
Default value of "ask" variable.
virtual void Print(CNcbiOstream &os) const
Prints variable.
const string & GetNamedAnnot() const
Return "from" named annotation.
void SetNewVarBlock()
Set the new variable block.
TVarBlocks::iterator m_BlockIter
string m_NamedAnnot
Named annotation.
vector< CQueryParseTree * > m_FuncWhereClauses
Vector of parsed function Where clauses.
SValue m_NewValue
User defined value of "ask" variable.
const string & GetName() const
Return macro name.
list< TVariables > TVarBlocks
Typedef vector of blocks of variables.
virtual ~CMacroVarChoice()
Destructor.
const string & GetMetaKeywords() const
size_t m_Selection
User defined selection of choice value.
void AddMetaKeywords(const string &keyWords)
void SetTitle(const string &title)
Set the title of the macro.
virtual bool SetGUIResolvedValue(const string &new_value)
Sets GUI resolved value.
TVariables::iterator m_VarIter
const string & GetTitle() const
Return macro description.
bool AreThereGUIResolvableVars() const
Return true if there are any GUI variables.
string m_KeyWords
Meta keywords for search.
CMacroVarSimple(const string &name, bool value)
Int4 GetBlocksCount() const
Get number of variable blocks.
CMacroRep(const CMacroRep &)
Prohibit copy constructor and assignment operator.
void SetSeqRange(const TSeqRange &range)
Set the sequence range.
virtual SValue x_GetValue() const
Gets the variable value.
unique_ptr< CQueryParseTree > m_WhereTree
Parsed Where-clause.
EValueType
Type of stored value (not the type of variable)
CQueryParseTree * GetDoTree() const
Return "do" clause.
void AddChoiceString(const string &value)
virtual SValue x_GetValue() const
Gets the variable value.
void AddChoiceBool(bool value)
IMacroVar(const string &var_name)
Constructor & destructor.
const string & AsString() const
SValue m_Value
Value of the variable.
CMacroRep & operator=(const CMacroRep &)
CQueryParseTree::TNode * m_ActiveNode
Active tree node in where clause.
CQueryParseTree * GetWhereClause() const
Return "where" clause.
void SetThreadCount(const string &threads)
Set number of threads.
void SetSource(const string &source_text)
Work with macro source text.
void AddChoiceInt(Int8 value)
string m_SourceText
Macro source text.
TSeqRange m_SeqRange
Sequence range.
virtual bool SetGUIResolvedValue(const string &new_value)=0
Sets GUI resolved value.
const string & GetSource() const
bool m_GUIResolvable
True if there is at least one GUI resolvable var.
string GetGUIResolvedValue()
const string & GetThreadCount() const
Return number of threads.
list< IMacroVar * > TVariables
Typedef vector of variables.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
#define NCBI_GUIOBJUTILS_EXPORT
Defines to provide correct exporting from DLLs in Windows.
static void x_PrintTree(const TPhyTreeNode *tree, int level, vector< SAlignEntry > &aligns)
range(_Ty, _Ty) -> range< _Ty >
const GenericPointer< typename T::ValueType > T2 value
static const char * x_GetValue(const char *svc, size_t svclen, const char *param, char *value, size_t value_size, const char *def_value, int *generic, FStrNCmp strncompar)
The NCBI C++/STL use hints.
Query parser execution implementations.
Source location (points to the position in the original src) All positions are 0 based.
Variable value storage structure.