diff options
-rw-r--r-- | project2/common/iHaveSubTasks.cpp | 2 | ||||
-rw-r--r-- | project2/common/iHaveSubTasks.h | 7 | ||||
-rw-r--r-- | project2/common/noOutputExecute.cpp | 17 | ||||
-rw-r--r-- | project2/common/noOutputExecute.h | 23 | ||||
-rw-r--r-- | project2/common/task.cpp | 8 | ||||
-rw-r--r-- | project2/common/task.h | 5 | ||||
-rw-r--r-- | project2/common/taskHost.cpp | 1 | ||||
-rw-r--r-- | project2/common/taskHost.h | 3 | ||||
-rw-r--r-- | project2/files/writeStream.cpp | 1 | ||||
-rw-r--r-- | project2/sql/sqlMergeTask.cpp | 6 | ||||
-rw-r--r-- | project2/sql/sqlTask.cpp | 8 | ||||
-rw-r--r-- | project2/sql/sqlTask.h | 7 |
12 files changed, 26 insertions, 62 deletions
diff --git a/project2/common/iHaveSubTasks.cpp b/project2/common/iHaveSubTasks.cpp index 6371475..578601f 100644 --- a/project2/common/iHaveSubTasks.cpp +++ b/project2/common/iHaveSubTasks.cpp @@ -3,7 +3,7 @@ IHaveSubTasks::IHaveSubTasks(ScriptNodePtr e) : SourceObject(e), - NoOutputExecute(e) + Task(e) { } diff --git a/project2/common/iHaveSubTasks.h b/project2/common/iHaveSubTasks.h index 3e7d16c..1fd5041 100644 --- a/project2/common/iHaveSubTasks.h +++ b/project2/common/iHaveSubTasks.h @@ -1,12 +1,13 @@ #ifndef HASSUBTASKS_H #define HASSUBTASKS_H -#include "noOutputExecute.h" +#include "task.h" +#include "scriptStorage.h" /// Base class for Project2 compoments that perform actions, but product no output -class IHaveSubTasks : public NoOutputExecute { +class IHaveSubTasks : public Task { public: - typedef ANONORDEREDSTORAGEOF(NoOutputExecute) Tasks; + typedef ANONORDEREDSTORAGEOF(Task) Tasks; IHaveSubTasks(ScriptNodePtr p); virtual ~IHaveSubTasks(); diff --git a/project2/common/noOutputExecute.cpp b/project2/common/noOutputExecute.cpp deleted file mode 100644 index bed7bf0..0000000 --- a/project2/common/noOutputExecute.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include <pch.hpp> -#include "noOutputExecute.h" - -NoOutputExecute::NoOutputExecute(ScriptNodePtr p) : - SourceObject(p) -{ -} - -NoOutputExecute::NoOutputExecute(const std::string & n) : - SourceObject(n) -{ -} - -NoOutputExecute::~NoOutputExecute() -{ -} - diff --git a/project2/common/noOutputExecute.h b/project2/common/noOutputExecute.h deleted file mode 100644 index 61d03b5..0000000 --- a/project2/common/noOutputExecute.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef NOOUTPUTEXECUTE_H -#define NOOUTPUTEXECUTE_H - -#include "sourceObject.h" -#include "scriptStorage.h" - -class NoOutputExecute; -class ExecContext; -typedef boost::intrusive_ptr<NoOutputExecute> NoOutputExecutePtr; - -/// Base class for Project2 compoments that perform actions, but product no output -class NoOutputExecute : public virtual SourceObject { - public: - NoOutputExecute(ScriptNodePtr p); - NoOutputExecute(const std::string & n); - - virtual ~NoOutputExecute(); - - virtual void execute(ExecContext *) const = 0; -}; - -#endif - diff --git a/project2/common/task.cpp b/project2/common/task.cpp index 2cfe761..bee3767 100644 --- a/project2/common/task.cpp +++ b/project2/common/task.cpp @@ -2,8 +2,12 @@ #include "task.h" Task::Task(ScriptNodePtr p) : - SourceObject(p), - NoOutputExecute(p) + SourceObject(p) +{ +} + +Task::Task(const std::string & n) : + SourceObject(n) { } diff --git a/project2/common/task.h b/project2/common/task.h index 15ccfbd..d29b533 100644 --- a/project2/common/task.h +++ b/project2/common/task.h @@ -2,12 +2,13 @@ #define TASK_H #include "sourceObject.h" -#include "noOutputExecute.h" +#include "execContext.h" /// Base class for Project2 components that perform some specific task -class Task : public NoOutputExecute { +class Task : public virtual SourceObject { public: Task(ScriptNodePtr p); + Task(const std::string & name); virtual ~Task(); virtual void execute(ExecContext *) const = 0; }; diff --git a/project2/common/taskHost.cpp b/project2/common/taskHost.cpp index 035e701..23b75fe 100644 --- a/project2/common/taskHost.cpp +++ b/project2/common/taskHost.cpp @@ -1,6 +1,5 @@ #include <pch.hpp> #include "taskHost.h" -#include "noOutputExecute.h" #include "dataSource.h" #include <scopeExit.h> #include "scriptLoader.h" diff --git a/project2/common/taskHost.h b/project2/common/taskHost.h index e4b8b3a..84c04c9 100644 --- a/project2/common/taskHost.h +++ b/project2/common/taskHost.h @@ -6,9 +6,6 @@ #include "iHaveSubTasks.h" #include "commonObjects.h" -class NoOutputExecute; -class DataSource; - class TaskHost : public IHaveSubTasks, virtual public CheckHost, virtual public CommonObjects { protected: TaskHost(ScriptNodePtr script); diff --git a/project2/files/writeStream.cpp b/project2/files/writeStream.cpp index 954ec8b..9946ec6 100644 --- a/project2/files/writeStream.cpp +++ b/project2/files/writeStream.cpp @@ -2,6 +2,7 @@ #include "task.h" #include "stream.h" #include "variables.h" +#include <scriptStorage.h> #include <fstream> SimpleMessageException(OpenTargetFile); diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp index b6c504f..ea334eb 100644 --- a/project2/sql/sqlMergeTask.cpp +++ b/project2/sql/sqlMergeTask.cpp @@ -46,7 +46,7 @@ DECLARE_LOADER("sqlmergeinsert", SqlMergeInsert); // Conversion logic SqlMergeTask::SqlMergeTask(const std::string & datasource, const std::string & target) : SourceObject(__PRETTY_FUNCTION__), - Task(NULL), + Task(__PRETTY_FUNCTION__), insteadOfDelete(NULL), updateWhere(NULL), patchOrder(NULL), @@ -265,11 +265,11 @@ SqlMergeTask::insertCommand() const return destdb->newModifyCommand(ins); } -class Populate : public NoOutputExecute { +class Populate : public Task { public: Populate(DB::ModifyCommand * c) : SourceObject(__FUNCTION__), - NoOutputExecute(__FUNCTION__), + Task(__FUNCTION__), cmd(c) { } diff --git a/project2/sql/sqlTask.cpp b/project2/sql/sqlTask.cpp index a98748f..94f5102 100644 --- a/project2/sql/sqlTask.cpp +++ b/project2/sql/sqlTask.cpp @@ -17,8 +17,8 @@ SqlTask::SqlTask(ScriptNodePtr p) : sqlCommand(p->child("sql")), db(NULL) { - p->script->loader.addLoadTargetSub(p, "changes", false, Storer::into<ElementLoader>(&changesNOEs)); - p->script->loader.addLoadTargetSub(p, "nochanges", false, Storer::into<ElementLoader>(&noChangesNOEs)); + p->script->loader.addLoadTargetSub(p, "changes", false, Storer::into<ElementLoader>(&changesTasks)); + p->script->loader.addLoadTargetSub(p, "nochanges", false, Storer::into<ElementLoader>(&noChangesTasks)); } SqlTask::~SqlTask() @@ -40,12 +40,12 @@ SqlTask::execute(ExecContext * ec) const unsigned int offset = 0; sqlCommand.bindParams(ec, modify.get(), offset); if (modify->execute() == 0) { - for (const SubNOEs::value_type & sq : noChangesNOEs) { + for (const auto & sq : noChangesTasks) { sq->execute(ec); } } else { - for (const SubNOEs::value_type & sq : changesNOEs) { + for (const auto & sq : changesTasks) { sq->execute(ec); } } diff --git a/project2/sql/sqlTask.h b/project2/sql/sqlTask.h index 94901a9..20f7415 100644 --- a/project2/sql/sqlTask.h +++ b/project2/sql/sqlTask.h @@ -6,6 +6,7 @@ #include "task.h" #include "variables.h" #include "sqlWriter.h" +#include <scriptStorage.h> namespace DB { class ModifyCommand; } class RdbmsDataSource; @@ -21,9 +22,9 @@ class SqlTask : public Task { const Variable dataSource; const Variable filter; - typedef ANONORDEREDSTORAGEOF(NoOutputExecute) SubNOEs; - SubNOEs changesNOEs; - SubNOEs noChangesNOEs; + typedef ANONORDEREDSTORAGEOF(Task) SubTasks; + SubTasks changesTasks; + SubTasks noChangesTasks; protected: const DynamicSql::SqlCommand sqlCommand; |