Files
WFR-lib/include/wfr/common/macros/lwdmacros.h
T
2017-04-11 15:49:21 +02:00

837 lines
24 KiB
C++
Executable File

#pragma once
#include <sstream>
#include <wfr/common/utils/utils.h>
/*******************
* LWD Type Macros *
*******************/
#define WFR_PORT_STRUCT(name, id, members) \
struct name : public wfr::lwd::_wfr_lwd { \
name() : _wfr_lwd(id, sizeof(name)) {} \
members \
};
#define WFR_PORT_MEMBER(name, type) \
wfr::lwd::_lwd_member_type<type> name;
#define WFR_PORT_MEMBER_IWIRINT(name) \
wfr::lwd::iwir_int name;
#define WFR_PORT_MEMBER_IWIRDOUBLE(name) \
wfr::lwd::iwir_double name;
#define WFR_PORT_MEMBER_IWIRBOOL(name) \
wfr::lwd::iwir_bool name;
#define WFR_PORT_MEMBER_IWIRSTRING(name) \
wfr::lwd::iwir_string name;
#define WFR_PORT_MEMBER_IWIRFILE(name) \
wfr::lwd::iwir_file name;
#define WFR_PORT_MEMBER_IWIRCOLLECTION(name, type, level) \
wfr::lwd::iwir_collection<type, level> name;
#define WFR_PORT_MEMBER_LOOPPORT(name, type) \
wfr::lwd::_lwd_loop_port<type> name;
/*********************
* LWD Access Macros *
*********************/
//// Outbuffer ////
#define WFR_SELF_OUTBUFFER_INIT(name, type) \
type* name = (type*)instance.getOutputData(); \
if (name == nullptr) { \
name = new type(); \
instance.setOutputData(name); \
}
#define WFR_SELF_OUTBUFFER_GET(name, type) \
type* name = (type*)instance.getOutputData();
#define WFR_INSTANCE_OUTBUFFER_INIT(name, type, instance) \
type* name = nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(instance)->setOutputData(name); \
} \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot initialise the outbuffer of a non-existing instance."); \
}
#define WFR_INSTANCE_OUTBUFFER_TRYINIT(name, type, instance) \
type* name nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(instance)->setOutputData(name); \
} \
}
#define WFR_INSTANCE_OUTBUFFER_GET(name, type, instance) \
type* name = nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getOutputData(); \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot get the outbuffer of a non-existing instance."); \
}
#define WFR_INSTANCE_OUTBUFFER_TRYGET(name, type, instance) \
type* name = nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getOutputData(); \
}
#define WFR_PARENT_OUTBUFFER_INIT(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(parentname)->setOutputData(name); \
} \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot initialise the outbuffer of a non-existing parent."); \
}
#define WFR_PARENT_OUTBUFFER_TRYINIT(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(parentname)->setOutputData(name); \
} \
}
#define WFR_PARENT_OUTBUFFER_GET(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getOutputData(); \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot get the outbuffer of a non-existing parent."); \
}
#define WFR_PARENT_OUTBUFFER_TRYGET(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getOutputData(); \
}
#define WFR_CHILD_OUTBUFFER_INIT(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(childname)->setOutputData(name); \
} \
} else { \
std::stringstream ss; \
ss << "Cannot initialise the outbuffer of non-existing child with activityID=" << childActivityID; \
ss << " and iterationID=" << childIterationID << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_CHILD_OUTBUFFER_TRYINIT(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(childname)->setOutputData(name); \
} \
}
#define WFR_CHILD_OUTBUFFER_GET(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getOutputData(); \
} else { \
std::stringstream ss; \
ss << "Cannot get the outbuffer of non-existing child with activityID=" << childActivityID; \
ss << " and iterationID=" << childIterationID << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_CHILD_OUTBUFFER_TRYGET(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getOutputData(); \
}
#define WFR_PRED_OUTBUFFER_INIT(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(predname)->setOutputData(name); \
} \
} else { \
std::stringstream ss; \
ss << "Cannot initialise the inbuffer of non-existing predecessor with index=" << predIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_PRED_OUTBUFFER_TRYINIT(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(predname)->setOutputData(name); \
} \
}
#define WFR_PRED_OUTBUFFER_GET(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getOutputData(); \
} else { \
std::stringstream ss; \
ss << "Cannot get the inbuffer of non-existing predecessor with index=" << predIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_PRED_OUTBUFFER_TRYGET(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getOutputData(); \
}
#define WFR_SUCC_OUTBUFFER_INIT(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(succname)->setOutputData(name); \
} \
} else { \
std::stringstream ss; \
ss << "Cannot initialise the inbuffer of non-existing successor with index=" << succIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_SUCC_OUTBUFFER_TRYINIT(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getOutputData(); \
if (name == nullptr) { \
name = new type(); \
(succname)->setOutputData(name); \
} \
}
#define WFR_SUCC_OUTBUFFER_GET(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getOutputData(); \
} else { \
std::stringstream ss; \
ss << "Cannot get the inbuffer of non-existing successor with index=" << succIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_SUCC_OUTBUFFER_TRYGET(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getOutputData(); \
}
//// Inbuffer ////
#define WFR_SELF_INBUFFER_INIT(name, type) \
type* name = (type*)instance.getInputData(); \
if (name == nullptr) { \
name = new type(); \
instance.setInputData(name); \
}
#define WFR_SELF_INBUFFER_GET(name, type) \
type* name = (type*)instance.getInputData();
#define WFR_INSTANCE_INBUFFER_INIT(name, type, instance) \
type* name = nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(instance)->setInputData(name); \
} \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot initialise the inbuffer of a non-existing instance."); \
}
#define WFR_INSTANCE_INBUFFER_TRYINIT(name, type, instance) \
type* name nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(instance)->setInputData(name); \
} \
}
#define WFR_INSTANCE_INBUFFER_GET(name, type, instance) \
type* name = nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getInputData(); \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot get the inbuffer of a non-existing instance."); \
}
#define WFR_INSTANCE_INBUFFER_TRYGET(name, type, instance) \
type* name = nullptr; \
if (instance != nullptr) { \
name = (type*)(instance)->getInputData(); \
}
#define WFR_PARENT_INBUFFER_INIT(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(parentname)->setInputData(name); \
} \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot initialise the inbuffer of a non-existing parent."); \
}
#define WFR_PARENT_INBUFFER_TRYINIT(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(parentname)->setInputData(name); \
} \
}
#define WFR_PARENT_INBUFFER_GET(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getInputData(); \
} else { \
throw wfr::exception::wfr_missing_instance("Cannot get the inbuffer of a non-existing parent."); \
}
#define WFR_PARENT_INBUFFER_TRYGET(name, type, parentname) \
auto parentname = instance.getParentActivity(); \
type* name = nullptr; \
if (parentname != nullptr) { \
name = (type*)(parentname)->getInputData(); \
}
#define WFR_CHILD_INBUFFER_INIT(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(childname)->setInputData(name); \
} \
} else { \
std::stringstream ss; \
ss << "Cannot initialise the inbuffer of non-existing child with activityID=" << childActivityID; \
ss << " and iterationID=" << childIterationID << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_CHILD_INBUFFER_TRYINIT(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(childname)->setInputData(name); \
} \
}
#define WFR_CHILD_INBUFFER_GET(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getInputData(); \
} else { \
std::stringstream ss; \
ss << "Cannot get the inbuffer of non-existing child with activityID=" << childActivityID; \
ss << " and iterationID=" << childIterationID << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_CHILD_INBUFFER_TRYGET(name, type, childname, childActivityID, childIterationID) \
auto childname = WFR_SELF_GETCHILDBYID(childActivityID, childIterationID); \
type* name = nullptr; \
if (childname != nullptr) { \
name = (type*)(childname)->getInputData(); \
}
#define WFR_PRED_INBUFFER_INIT(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(predname)->setInputData(name); \
} \
} else { \
std::stringstream ss; \
ss << "Cannot initialise the inbuffer of non-existing predecessor with index=" << predIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_PRED_INBUFFER_TRYINIT(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(predname)->setInputData(name); \
} \
}
#define WFR_PRED_INBUFFER_GET(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getInputData(); \
} else { \
std::stringstream ss; \
ss << "Cannot get the inbuffer of non-existing predecessor with index=" << predIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_PRED_INBUFFER_TRYGET(name, type, predname, predIndex) \
auto predname = instance.getPredecessor(predIndex); \
type* name = nullptr; \
if (predname != nullptr) { \
name = (type*)(predname)->getInputData(); \
}
#define WFR_SUCC_INBUFFER_INIT(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(succname)->setInputData(name); \
} \
} else { \
std::stringstream ss; \
ss << "Cannot initialise the inbuffer of non-existing successor with index=" << succIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_SUCC_INBUFFER_TRYINIT(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getInputData(); \
if (name == nullptr) { \
name = new type(); \
(succname)->setInputData(name); \
} \
}
#define WFR_SUCC_INBUFFER_GET(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getInputData(); \
} else { \
std::stringstream ss; \
ss << "Cannot get the inbuffer of non-existing successor with index=" << succIndex << "."; \
throw wfr::exception::wfr_missing_instance(ss.str()); \
}
#define WFR_SUCC_INBUFFER_TRYGET(name, type, succname, succIndex) \
auto succname = instance.getSuccessors()[succIndex]; \
type* name = nullptr; \
if (succname != nullptr) { \
name = (type*)(succname)->getInputData(); \
}
#define WFR_LOOP_FINALIZE_COLLECTION(collection, member) \
if (instance.as<wfr::wfs::LoopActivityInstance>().isFinalised() && !collection->member.isFinalised() \
&& instance.as<wfr::wfs::LoopActivityInstance>().getIterationCount() == collection->member.getSize()) { \
collection->member.setFinalised(true); \
}
#define WFR_FINALIZE_COLLECTION(collection, member) \
if (!collection->member.isFinalised() && collection->member.getSize() > 0 \
&& collection->member.getSize() == collection->member.getReadyCount()) { \
collection->member.setFinalised(true); \
}
#define WFR_LOOP_FINALIZE() \
instance.as<wfr::wfs::LoopActivityInstance>().setFinalised(true);
#define WFR_FORLOOP_GET_COUNTER_VALUE(forloop, member) \
if (forloop->as<wfr::wfs::ForLoopActivityInstance>().isLoopCounterValueAvailable()) { \
member.setValue(forloop->as<wfr::wfs::ForLoopActivityInstance>().getLoopCounterValue(instance.iterationID)); \
}
#define WRF_PRED_ISFINISHED(predIndex) \
wfr_pred_isfinished(instance, predIndex)
#define WRF_PRED_ISREADY(predIndex) \
wfr_pred_isready(instance, predIndex)
#define WRF_PARENT_ISFINISHED() \
wfr_parent_isfinished(instance)
#define WRF_PARENT_ISREADY() \
wfr_parent_isReady(instance)
#define WFR_PARENT_ISPREVITERFINISHED() \
wfr_previter_isfinished(*instance.getParentActivity(), instance.iterationID)
/*
*
*/
#define WFR_SELF_CHECK_AREALLINPUTSAVAILABLE(condition) \
if (condition) { \
instance.setAllInputsAvailable(true); \
}
#define WFR_SELF_CHECK_AREALLOUTPUTSAVAILABLE(condition) \
if (condition) { \
instance.setAllOutputsAvailable(true); \
}
#define WFR_SELF_CHECK_ISREADYFOREXECUTION(condition) \
if (condition && instance.getInstanceStatus() < wfr::wfs::ActivityInstanceStatus::ReadyForExecution) { \
instance.setInstanceStatus(wfr::wfs::ActivityInstanceStatus::ReadyForExecution); \
}
#define WFR_SELF_CHECK_ISREADYFOREXECUTION2(condition1, condition2) \
if (condition1 && condition2 && instance.getInstanceStatus() < wfr::wfs::ActivityInstanceStatus::ReadyForExecution ) { \
instance.setInstanceStatus(wfr::wfs::ActivityInstanceStatus::ReadyForExecution); \
} else if (condition1 && instance.getInstanceStatus() < wfr::wfs::ActivityInstanceStatus::ReadyForExecution) { \
instance.setInstanceStatus(wfr::wfs::ActivityInstanceStatus::WaitingForDependency); \
}
/*
*
*
*/
#define WFR_INIT_FORLOOPCOUNTER(start, step, stop) \
if (!instance.as<wfr::wfs::LoopActivityInstance>().isFinalised()) { \
instance.setLoopCounter(start, step, stop); \
instance.setInstanceStatus(wfr::wfs::ActivityInstanceStatus::ReadyForExecution); \
instance.as<wfr::wfs::LoopActivityInstance>().setFinalised(true); \
retval = true; \
}
#define WFR_INIT_FORLOOPCOUNTER2(start, step, stop) \
if (!instance.as<wfr::wfs::LoopActivityInstance>().isFinalised()) { \
instance.setLoopCounter(start, step, stop); \
instance.as<wfr::wfs::LoopActivityInstance>().setFinalised(true); \
retval = true; \
}
#define WFR_COLLECT_OUTVALUES_FROM_CHILDREN(collection, type, member, childID) \
for (wfr_size_t t = 0; t < WFR_SELF_GETITERATIONCOUNT(); t++) { \
WFR_CHILD_OUTBUFFER_GET(chout, type, ch, childID, t); \
if (chout != nullptr /*&& collection.getSize() > t*/) { \
WFR_HOOK_SET_RETVAL(wfr::portbuffer_copy(collection, chout->member, t)); \
} \
}
#define WFR_COLLECT_OUTVALUES_FROM_CHILDREN_FLATTEN(collection, flatten, type, member, childID) \
{ \
bool doFinalize = false; \
wfr_size_t index = 0; \
for (wfr_size_t t = 0; t < WFR_SELF_GETITERATIONCOUNT(); t++) { \
WFR_CHILD_OUTBUFFER_GET(chout, type, ch, childID, t); \
if (chout != nullptr) { \
wfr_size_t ecount = wfr::portbuffer_copy_flatten<flatten>(collection, chout->member, index); \
if (ecount == 0) { \
doFinalize = false; \
break; \
} else { \
index += ecount; \
doFinalize = true; \
} \
} \
} \
if (doFinalize) { \
collection.setFinalised(true); \
} \
}
#define WFR_PORT_INIT_COLLECTION(collection) \
if (!collection.isFinalised() ) { \
collection.init(0); \
}
#define WFR_PORT_INIT_COLLECTION_LOOP(collection) \
if (!collection.isFinalised() ) { \
collection.init(WFR_SELF_GETITERATIONCOUNT()); \
if (instance.as<wfr::wfs::LoopActivityInstance>().isFinalised()) { \
collection.setFinalised(true); \
} \
}
#define WFR_LOOPPORT_COPY_LAST(dest, srcmember, type, childID) \
if (instance.as<wfr::wfs::LoopActivityInstance>().isFinalised()) { \
WFR_CHILD_OUTBUFFER_GET(chout, type, ch, childID, WFR_SELF_GETITERATIONCOUNT()-1); \
if (chout != nullptr) { \
WFR_HOOK_SET_RETVAL(wfr::portbuffer_copy(dest, chout->srcmember)); \
} \
}
#define WFR_PORT_SETVALUE(var, val) \
if (!var.isReady()) { \
var.setValue(val); \
retval = true; \
}
#define WFR_PORT_SETVALUE2(var, val) \
if (!var.isReady()) { \
var.setValue(val); \
}
#define WFR_SELF_GETCHILDBYID(activityID, iterationID) \
instance.as<wfr::wfs::CompositeActivityInstance>().getChild(activityID, iterationID)
#define WFR_SELF_GETPREDECESSORBYINDEX(index) \
(instance).getPredecessor(index)
#define WFR_SELF_GETITERATIONCOUNT() \
instance.as<wfr::wfs::LoopActivityInstance>().getIterationCount()
#define WFR_SELF_GETITERATIONID() \
instance.as<wfr::wfs::LoopActivityInstance>().iterationID
#define WFR_INSTANCE_GETITERATIONCOUNT(instance) \
instance.as<wfr::wfs::LoopActivityInstance>().getIterationCount()
#define WFR_SELF_SETITERATIONCOUNT(count) \
instance.as<wfr::wfs::LoopActivityInstance>().setIterationCount(count);
#define WFR_SELF_SETFORLOOPCOUNTERVALUES(start, step, max) \
instance.as<wfr::wfs::ForLoopActivityInstance>().setLoopCounter(start, step, max);
#define WFR_SELF_GETCONDBRANCHID() \
instance.as<wfr::wfs::ConditionalActivityInstance>().getExecutionBranchID()
#define WFR_SELF_SETCONDBRANCHID(value) \
instance.as<wfr::wfs::ConditionalActivityInstance>().setExecutionBranchID(value)
#define WFR_SELF_GETHANDLEDITERATIONCOUNT() \
instance.as<wfr::wfs::LoopActivityInstance>().getHandledIterationCount()
#define WFR_ACTIVITY_IMPLEMENTATIONS(name, label, ...) \
auto name = wfr::wfs::AtomicActivityType::create(label, { \
__VA_ARGS__ \
});
#define WFR_WORKFLOW(name, label, actTableName, topLevelID, ...) \
std::unique_ptr<wfr::wfs::WorkflowTemplate> name(new wfr::wfs::WorkflowTemplate(label, topLevelID, { \
__VA_ARGS__ \
}));
/*
* WRF Hook Function Macros
*/
#define WFR_INPUT_HOOK(name) \
bool name(wfr::wfs::ActivityInstance& instance)
#define WFR_OUTPUT_HOOK(name) \
bool name(wfr::wfs::ActivityInstance& instance)
#define WFR_EXEC_HOOK(name) \
bool name(wfr::wfs::ActivityInstance& instance)
#define WFR_BRANCHCONDITION_HOOK(name) \
bool name(wfr::wfs::ConditionalActivityInstance& instance)
#define WFR_LOOPITERATION_HOOK(name) \
bool name(wfr::wfs::LoopActivityInstance& instance)
#define WFR_WHILECONDITION_HOOK(name) \
bool name(wfr::wfs::WhileLoopActivityInstance& instance)
#define WFR_FORCOUNTER_HOOK(name) \
bool name(wfr::wfs::ForLoopActivityInstance& instance)
/*
*
*/
#define WFR_HOOK_SET_RETVAL(func) \
if (func) { \
retval = true; \
}
/*
* Simulation Mode
*/
#define EXECUTE_SIMULATION_MODE instance.executeSimMode();
/*********************************
* Hook Function Prologs/Epilogs *
*********************************/
#define WFR_INPUT_HOOK_PROLOG \
bool retval = false;
#define WFR_INPUT_HOOK_EPILOG \
return retval;
#define WFR_OUTPUT_HOOK_PROLOG \
bool retval = false;
#define WFR_OUTPUT_HOOK_EPILOG \
return retval;
#define WFR_EXEC_HOOK_PROLOG \
bool retval = false;
#define WFR_EXEC_HOOK_EPILOG \
return retval;
#define WFR_BRANCHCONDITION_HOOK_PROLOG \
bool retval = false;
#define WFR_BRANCHCONDITION_HOOK_EPILOG \
return retval;
#define WFR_LOOPITERATION_HOOK_PROLOG \
bool retval = false;
#define WFR_LOOPITERATION_HOOK_EPILOG \
return retval;
#define WFR_WHILECONDITION_HOOK_PROLOG \
bool retval = false;
#define WFR_WHILECONDITION_HOOK_EPILOG \
return retval;
#define WFR_FORCOUNTER_HOOK_PROLOG \
bool retval = false;
#define WFR_FORCOUNTER_HOOK_EPILOG \
return retval;