add_library(locomotiv SHARED ${SOURCES})
target_include_directories(locomotiv PUBLIC include)
+target_include_directories(locomotiv PRIVATE src)
target_link_libraries(locomotiv PUBLIC loco)
target_link_libraries(locomotiv PUBLIC angkor)
# Let's apply nncc common compile options
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "NodeExecution.h"
+
+#include <stdexcept>
+
+namespace locomotiv
+{
+
+void NodeExecution::execute(loco::Push *)
+{
+ // to be filled
+ throw std::runtime_error("NYI");
+}
+
+} // namespace locomotiv
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "NodeExecution.h"
+
+#include <stdexcept>
+
+namespace locomotiv
+{
+
+// TODO Use visitor pattern of loco when available
+void NodeExecution::run(loco::Node *node)
+{
+ if (as<loco::Push>(node))
+ {
+ execute(as<loco::Push>(node));
+ }
+ else
+ {
+ throw std::runtime_error("Not supported loco::Node type");
+ }
+}
+
+} // namespace locomotiv
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LOCOMOTIV_NODEEXECUTION_H_
+#define _LOCOMOTIV_NODEEXECUTION_H_
+
+#include <loco.h>
+
+namespace locomotiv
+{
+
+/**
+ * @brief Helper class for Session, responsible to process one node calculation.
+ */
+class NodeExecution
+{
+public:
+ /// @brief Run calculation for one unspecified Node
+ void run(loco::Node *node);
+
+ static NodeExecution &get()
+ {
+ static NodeExecution me;
+ return me;
+ }
+
+private:
+ NodeExecution() {}
+
+ template <typename Derived> Derived *as(loco::Node *node)
+ {
+ return dynamic_cast<Derived *>(node);
+ }
+
+ /**
+ * @brief Calculate for one specified node and update its result as NodeData.
+ * Abort program when its ingredients are not ready or not supported.
+ *
+ * @note Definitions of overloaded execute() are in 'Node/' directory
+ */
+ void execute(loco::Push *);
+};
+
+} // namespace locomotiv
+
+#endif // _LOCOMOTIV_NODEEXECUTION_H_