1 #ifndef GUI_OBJUTILS___MACRO_ENGINE__HPP
2 #define GUI_OBJUTILS___MACRO_ENGINE__HPP
68 const string&
GetName()
const {
return m_MacroName; }
69 string GetLog()
const {
return m_Log; }
76 m_MacroName.assign(name);
81 if (!m_MacroName.empty()) {
88 if (!m_MacroName.empty()){
95 if (!errmsg.empty()) {
96 if (!m_ErrorLog.empty()) {
107 m_MacroName.resize(0);
109 m_ErrorLog.resize(0);
124 void AddToReport(
const string& report);
127 void AddToErrorReport(
const string&
error);
131 void GatherUnMatchedTableEntries(
const string& report,
const int count);
136 void AddDataChanged(
bool change);
138 void AddFunctionName(
const string& func_name);
145 void LogStart(
const string& macro_name);
155 void LogStop(
bool status,
const string& err_message);
169 size_t m_counter{ 0 };
172 bool m_DataUpdated{
false };
252 m_HugeFileMode(
false),
253 m_ErrorMessage(
"Not executed"),
255 m_Column(0) { x_InitSetOfBuiltInFunctions(lookup_synfile); }
259 m_HugeFileMode(huge_file_mode),
260 m_ErrorMessage(
"Not executed"),
262 m_Column(0) { x_InitSetOfBuiltInFunctions(lookup_synfile); }
281 bool ReadAndParseMacros(
const string& filename, vector<
CRef<CMacroRep>>& macro_list);
284 vector<string> GetSynonymFilenames(
const vector<
CRef<CMacroRep>>& macro_list)
const;
288 CMacroRep* Parse(
const string& macro_text);
324 virtual bool ExistRTVar(
const string& name);
328 virtual void AddTmpRTVarObject(
const string& name,
CObjectInfo& oi);
329 virtual bool GetTmpRTVarObject(
const string& name,
CObjectInfo& oi);
330 virtual void ResetTmpRTVarObjects();
332 void SetRemoteUpdater(
const shared_ptr<objects::edit::CRemoteUpdater>& updater) { m_RemoteUpdater = updater; }
333 void SetDOIUpdater(
const shared_ptr<CDoiLookupWithCache>& updater) { m_DOIUpdater = updater; }
334 void SetISOJTAUpdater(
const shared_ptr<CISOJTALookupWithCache>& updater) { m_ISOJTAUpdater = updater; }
354 void x_ResetStatus(
void);
357 void x_InitSetOfBuiltInFunctions(
bool lookup_synfile);
360 void x_InitStringConstraints(
bool lookup_synfile);
385 bool operator()(
const string& str1,
const string& str2)
const
Subclass of the IQueryParseUserObject which is held as the user-defined object in each CQueryParseNod...
The following asn-selectors are defined to be used in the FOR EACH statement:
Class provides macro language interface for bulk bio-editing.
Class for parsed macro representation.
CMacroStat - collecting statistics about a single macro.
Query tree and associated utility methods.
definition of a Culling tree
Base class for any user function that performs editing operations on ASN.1 data.
Interface class for resolving entities during function execution.
static const char * column
vector< CRef< CMacroRep > > TMacroLibrary
Uint4 GetErrorLine() const
Get error location in case previous command was unsuccessful.
CMacroStat & operator=(const CMacroStat &)
void SetName(const string &name)
shared_ptr< CISOJTALookupWithCache > m_ISOJTAUpdater
virtual bool Exec(const CMacroRep ¯o_rep, const CMacroBioData &data, CRef< CMacroCmdComposite > CmdComposite, bool throw_on_error=false, CNcbiOstream *ostream=nullptr)=0
Executes a macro.
CIRef< IMacroBioDataIter > m_DataIter
const set< string > & GetDOFunctionNames() const
const string & GetErrorLog() const
bool m_Status
execution status of most recent command
bool GetStatus() const
Get status of most recent command.
void SetRemoteUpdater(const shared_ptr< objects::edit::CRemoteUpdater > &updater)
long GetExecutionTime() const
bool HasDataUpdated() const
virtual bool ReadAndParseMacros(const string &filename, vector< CRef< CMacroRep >> ¯o_list)=0
Parses a file containing macros and stores them in a list.
void AppendError(const string &errmsg)
shared_ptr< objects::edit::CRemoteUpdater > m_RemoteUpdater
void SetISOJTAUpdater(const shared_ptr< CISOJTALookupWithCache > &updater)
string m_ErrorLog
Logging errors encountered during macro execution.
string m_ErrorMessage
error message
TBuiltInFunctionsMap m_BuiltInFunctions
Do section functions.
const string & GetName() const
shared_ptr< CHugeMacroContext > m_MacroContext
CRef< CMacroCmdComposite > m_CmdComposite
const CMacroRep * m_MacroRep
temporary data available while Exec is working. It is used by resolver.
virtual bool AppendToLibrary(const string &filename, CMacroLib::TMacroLibrary &lib)=0
Parses a file containing macros and appends the results to a map.
vector< CRef< IFunctionLog > > m_FunctionsLog
void BuildReport(const string &rep)
map< string, IEditMacroFunction *, SKey_Less > TBuiltInFunctionsMap
map< string, CRef< CMQueryNodeValue > > TRTVarsMap
Uint4 GetErrorColumn() const
CMacroStat(const CMacroStat &)
virtual const CMacroStat & GetStatistics() const =0
Gets the most recently executed macro statistics.
shared_ptr< CDoiLookupWithCache > m_DOIUpdater
map< string, CObjectInfo > TTempRTVarsMap
const vector< CRef< IFunctionLog > > & GetFunctionsLog() const
CMacroEngine(bool huge_file_mode, bool lookup_synfile=false)
bool operator()(const string &str1, const string &str2) const
void SetHugeContext(const shared_ptr< CHugeMacroContext > &context)
const CMacroStat & GetStatistics() const
Gets the most recently executed macro statistics.
string m_Log
Logging all activities during this macro.
TTempRTVarsMap m_TempRTVars
const vector< pair< string, int > > & GetUnmatchedTableEntries() const
size_t GetCounter() const
CMacroEngine(bool lookup_synfile=false)
Constructor.
bool m_EvalDo
Flag indicates if the work should be performed on the Do clause.
const CMacroLog & GetMacroReport() const
vector< pair< string, int > > m_UnmatchedList
void ClearAndBuildReport(const string &rep)
virtual CMacroRep * Parse(const string ¯o_text)=0
Parses macro script into its binary representation.
const string & GetErrorMessage() const
Get error message in case previous command was unsuccessful.
bool m_HugeFileMode
execution will take place in 'huge file mode'
set< string > m_FuncNames
string m_MacroName
name of macro
void SetDOIUpdater(const shared_ptr< CDoiLookupWithCache > &updater)
CMacroStat m_MacroStat
Most recent executed macro statistics.
uint32_t Uint4
4-byte (32-bit) unsigned 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 int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
#define NCBI_GUIOBJUTILS_EXPORT
Defines to provide correct exporting from DLLs in Windows.
Macro library for storing parsed macros.
static CS_CONTEXT * context