26 #include "../../GOPPRR/Graph.h"
27 #include "../../GOPPRR/Project.h"
28 #include "../../GOPPRR/Object.h"
29 #include "../../GOPPRR/Port.h"
48 m_FBMap[
"Subtraction"] =
"CSubstraction";
49 m_FBMap[
"Division"] =
"CDivision";
50 m_FBMap[
"Multiplication"] =
"CMultiplication";
51 m_FBMap[
"DoubleEqual"] =
"CDoubleEqual";
52 m_FBMap[
"IntEqual"] =
"CIntEqual";
53 m_FBMap[
"StringEqual"] =
"CStringEqual";
54 m_FBMap[
"DoubleEqualOrGreater"] =
"CDoubleEqualOrGreater";
55 m_FBMap[
"DoubleGreater"] =
"CDoubleGreater";
56 m_FBMap[
"IntGreater"] =
"CIntGreater";
57 m_FBMap[
"DoubleArrayAccessor"] =
"CDoubleArrayAccessor";
58 m_FBMap[
"VariableStorage"] =
"CStorage";
59 m_FBMap[
"Odometer"] =
"COdometer";
60 m_FBMap[
"ServiceBrake"] =
"CServiceBrake";
61 m_FBMap[
"EmergencyBrake"] =
"CEmergencyBrake";
62 m_FBMap[
"BrakingToTargetSpeed"] =
"CBrakingToTargetSpeed";
63 m_FBMap[
"CeelingSpeedControl"] =
"CCeelingSpeedControl";
64 m_FBMap[
"CommunicationReader"] =
"CComBlockIn";
65 m_FBMap[
"CommunicationSender"] =
"CComBlockOut";
66 m_FBMap[
"BoolGate"] =
"CBoolGate";
67 m_FBMap[
"DoubleGate"] =
"CDoubleGate";
68 m_FBMap[
"StringGate"] =
"CStringGate";
69 m_FBMap[
"BoolSwitch"] =
"CBoolSwitch";
70 m_FBMap[
"DoubleSwitch"] =
"CDoubleSwitch";
71 m_FBMap[
"StringSwitch"] =
"CStringSwitch";
72 m_FBMap[
"ModeGuard"] =
"CEVCCondition";
73 m_FBMap[
"ApplicationLevelType"] =
"CLevelCondition";
74 m_FBMap[
"DMIOutput"] =
"CDMIOutput";
75 m_FBMap[
"DMIInput"] =
"CDMIInput";
76 m_FBMap[
"EnteredTrigger"] =
"CEnteredTrigger";
77 m_FBMap[
"EmbeddedStateMachine"] =
"CControlFlow";
78 m_FBMap[
"StateGuard"] =
"CCondition";
81 m_FBMMap[
"StringEqual::IsEqual"] =
"Equal";
82 m_FBMMap[
"IntEqual::IsEqual"] =
"Equal";
83 m_FBMMap[
"IntEqual::Input1"] =
"iInput1";
84 m_FBMMap[
"IntEqual::Input2"] =
"iInput2";
85 m_FBMMap[
"DoubleEqual::IsEqual"] =
"Equal";
86 m_FBMMap[
"DoubleEqual::Input1"] =
"dInput1";
87 m_FBMMap[
"DoubleEqual::Input2"] =
"dInput2";
88 m_FBMMap[
"Sum::Addend1"] =
"dAddend1";
89 m_FBMMap[
"Sum::Addend2"] =
"dAddend2";
90 m_FBMMap[
"Sum::Addend3"] =
"dAddend3";
91 m_FBMMap[
"Subtraction::Minuend"] =
"dMinuend";
92 m_FBMMap[
"Subtraction::Subtrahend"] =
"dSubtrahend";
93 m_FBMMap[
"BrakingToTargetSpeed::AdhesionFactor"] =
"dAdhesionFactor";
94 m_FBMMap[
"EmbeddedStateMachine::Start"] =
"bStart";
95 m_FBMMap[
"DMIInput::PredefinedString"] =
"PreStringMessage";
96 m_FBMMap[
"DMIInput::PredefinedDouble"] =
"dPreDoubleMessage";
97 m_FBMMap[
"DMIInput::DataEntered"] =
"EnteredData";
98 m_FBMMap[
"DMIInput::Visibility"] =
"bVisible";
99 m_FBMMap[
"DMIOutput::IntMessage"] =
"iIntMessage";
100 m_FBMMap[
"DMIOutput::DoubleMessage"] =
"dDoubleMessage";
101 m_FBMMap[
"DMIOutput::BoolMessage"] =
"bBoolMessage";
102 m_FBMMap[
"DMIOutput::Visibility"] =
"bVisible";
103 m_FBMMap[
"StateGuard::Guard"] =
"bGuard";
105 m_FBMMap[
"NOT::NotResult"] =
"Result";
108 m_FBMMap[
"OR::OrResult"] =
"Result";
109 m_FBMMap[
"AND::AndResult"] =
"Result";
110 m_FBMMap[
"AND::Input1"] =
"bInput1";
111 m_FBMMap[
"AND::Input2"] =
"bInput2";
112 m_FBMMap[
"DoubleGreater::GreaterValue"] =
"dInput1";
113 m_FBMMap[
"DoubleGreater::LessValue"] =
"dInput2";
114 m_FBMMap[
"DoubleGreater::IsGreater"] =
"Greater";
115 m_FBMMap[
"IntGreater::GreaterValue"] =
"iInput1";
116 m_FBMMap[
"IntGreater::LessValue"] =
"iInput2";
117 m_FBMMap[
"IntGreater::IsGreater"] =
"Greater";
118 m_FBMMap[
"DoubleEqualOrGreater::GreaterValue"] =
"dInput1";
119 m_FBMMap[
"DoubleEqualOrGreater::LessValue"] =
"dInput2";
120 m_FBMMap[
"DoubleEqualOrGreater::IsGreaterOrEqual"] =
"EqualOrGreater";
121 m_FBMMap[
"DoubleGate::GateInput"] =
"dGateInput";
122 m_FBMMap[
"DoubleGate::Open"] =
"bOpen";
123 m_FBMMap[
"BoolGate::GateInput"] =
"bGateInput";
124 m_FBMMap[
"BoolGate::Open"] =
"bOpen";
125 m_FBMMap[
"StringGate::Open"] =
"bOpen";
126 m_FBMMap[
"ServiceBrake::BrakeIntensity"] =
"dBrakeIntensity";
127 m_FBMMap[
"EmergencyBrake::Active"] =
"bActivation";
128 m_FBMMap[
"BrakingToTargetSpeed::PermittedVelocity"] =
"dPermittedVelocity";
129 m_FBMMap[
"BrakingToTargetSpeed::DistanceOfPermittedVelocity"] =
"dDistanceOfPermittedVelocity";
130 m_FBMMap[
"BrakingToTargetSpeed::CurrentVelocity"] =
"dCurrentVelocity";
131 m_FBMMap[
"BrakingToTargetSpeed::CurrentAbsoluteDistance"] =
"dCurrentAbsoluteDistance";
132 m_FBMMap[
"CeelingSpeedControl::PermittedVelocity"] =
"dPermittedVelocity";
133 m_FBMMap[
"CeelingSpeedControl::DistanceOfPermittedVelocity"] =
"dDistanceOfPermittedVelocity";
134 m_FBMMap[
"CeelingSpeedControl::CurrentVelocity"] =
"dCurrentVelocity";
135 m_FBMMap[
"CeelingSpeedControl::CurrentAbsoluteDistance"] =
"dCurrentAbsoluteDistance";
136 m_FBMMap[
"CeelingSpeedControl::AdhesionFactor"] =
"dAdhesionFactor";
137 m_FBMMap[
"DoubleArrayAccessor::DoubleArray"] =
"Array";
138 m_FBMMap[
"DoubleArrayAccessor::ArrayIndex"] =
"iIndex";
139 m_FBMMap[
"DoubleArrayAccessor::ArrayValue"] =
"Value";
140 m_FBMMap[
"CommunicationReader::TelegramReceived"] =
"Received";
141 m_FBMMap[
"ModeGuard::Guard"] =
"bGuard";
142 m_FBMMap[
"ApplicationLevelType::LevelSwitch"] =
"bLevelSwitch";
143 m_FBMMap[
"DoubleSwitch::Input1"] =
"dInput1";
144 m_FBMMap[
"DoubleSwitch::Input2"] =
"dInput2";
145 m_FBMMap[
"DoubleSwitch::UseInput1"] =
"bUseInput1";
167 bool bRootFound(
false);
171 decltype (pProject->
m_GraphSet.begin()) Graph;
188 for (Graph = pProject->
m_GraphSet.begin(); Graph != pProject->
m_GraphSet.end() && !bRootFound; Graph++)
191 if (Graph->second.m_Type == EVCSTATEMACHINE)
194 pRootGraph = &Graph->second;
213 m_GeneratedControlFlows.clear();
214 m_GeneratedEVCTransitions.clear();
215 m_GeneratedTransitions.clear();
221 this->GenerateRootGraph(pRootGraph, pProject, OutStream);
223 catch (const ::oETCS::GEN::Error::CException&)
232 this->GenerateFooter(OutStream);
243 decltype (pProject->m_GraphSet.begin()) GGraph;
244 decltype (pProject->m_GraphSet) GGraphs;
246 decltype (pProject->m_ObjectSet.begin()) GObject;
247 decltype (pRootGraph->m_ObjectSet.begin()) Object;
248 decltype (pRootGraph->m_ObjectSet) Objects;
249 decltype (pRootGraph->m_PortSet.begin()) Port;
253 ::std::string CurrentType;
254 ::std::string DMIDataType;
255 ::std::string ValueType;
256 ::std::string AllowedValue;
257 ::std::string InitialApplicationLevel;
263 const ::std::string APPLICATION_LEVEL_OBJECT(
"ApplicationLevelType");
264 const ::std::string DMI_INPUT_OBJECT(
"DMIInput");
265 const ::std::string DMI_OUTPUT_OBJECT(
"DMIOutput");
266 const ::std::string BALISE_IN_DEVICE(
"BaliseReader");
267 const ::std::string BALISE_OUT_DEVICE(
"BaliseSender");
268 const ::std::string COM_IN_OBJECT(
"CommunicationReader");
269 const ::std::string COM_OUT_OBJECT(
"CommunicationSender");
270 const ::std::string COM_READER_GRAPH(
"CommunicationReader");
271 const ::std::string COM_SENDER_GRAPH(
"CommunicationSender");
272 bool bSimulation(
false);
278 bSimulation = pRootGraph->Properties(
"Simulation").begin()->second->m_Value ==
"T" ?
true :
false;
287 OutStream <<
"// EVC state machine object\n";
288 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CEVCStateMachine" <<
"EVC;\n\n\n\n";
293 for (Object = pRootGraph->m_ObjectSet.begin(); Object != pRootGraph->m_ObjectSet.end(); Object++)
296 if (Object->second->m_Type == EVCSTATE_OBJECT)
299 OutStream <<
"// EVC state [" << Object->second->m_ID <<
"] with OID " << Object->second->m_OID <<
"\n";
300 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CEVCState" <<
"EVCState_" << Object->second->m_OID <<
"(&EVC);\n";
308 OutStream <<
"\n\n\n\n";
312 this->GenerateLanguage(pProject, OutStream);
316 OutStream <<
"\n\n\n\n";
320 this->GenerateFunctionBlockElements(pProject, OutStream);
324 OutStream <<
"\n\n\n\n";
328 for (GGraph = pProject->m_GraphSet.begin(); GGraph != pProject->m_GraphSet.end(); GGraph++)
331 if (GGraph->second.m_Type == SUBFB_GRAPH)
334 OutStream <<
"// Sub Function Block Graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
337 this->GenerateFunctionBlock(&(GGraph->second), pProject, OutStream);
340 OutStream <<
"\n\n\n\n";
348 for (GGraph = pProject->m_GraphSet.begin(); GGraph != pProject->m_GraphSet.end(); GGraph++)
351 if (GGraph->second.m_Type == COM_READER_GRAPH || GGraph->second.m_Type == COM_SENDER_GRAPH)
354 OutStream <<
"// Communication Graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
357 this->GenerateCommunication(&(GGraph->second), pProject, OutStream);
360 OutStream <<
"\n\n\n\n";
369 for (Object = pRootGraph->m_ObjectSet.begin(); Object != pRootGraph->m_ObjectSet.end(); Object++)
372 if (Object->second->m_Type == EVCSTATE_OBJECT)
375 for (Graph = Object->second->m_Explosions.begin(); Graph != Object->second->m_Explosions.end(); Graph++)
378 OutStream <<
"// Main Function Block Graph [" << Graph->second->m_ID <<
"] with OID " << Graph->second->m_OID <<
"\n";
381 this->GenerateFunctionBlock(Graph->second, pProject, OutStream);
384 OutStream <<
"\n\n\n\n";
387 this->GenerateDMI(Graph->second, pRootGraph, Object->second, OutStream);
390 OutStream <<
"\n\n\n\n";
393 this->GenerateDataFlow(Graph->second, pRootGraph, Object->second, OutStream);
396 OutStream <<
"\n\n\n\n";
399 for (Explosion = Object->second->m_Explosions.begin(); Explosion != Object->second->m_Explosions.end(); Explosion++)
402 this->GenerateEVCTransitions(Explosion->second, Object->second, pRootGraph, OutStream);
407 OutStream <<
"\n\n\n\n";
413 if (Object->second->Properties(
"IsInitial").begin()->second->m_Value ==
"T")
416 pInitialState = Object->second;
419 InitialApplicationLevel = pInitialState->
Properties(
"InitialLevel").begin()->second->m_Value;
430 this->GenerateControlFlows(pProject, OutStream);
435 this->GenerateTransitions(pRootGraph, OutStream);
439 OutStream <<
"\n\n\n\n";
443 if (pInitialState != 0)
448 OutStream <<
"// get D-Bus session bus once in main thread before all others\n";
449 OutStream <<
"QDBusConnection::sessionBus();\n\n";
452 OutStream <<
"// start EVC state machine non-blocking and wait for any key to finish\n";
453 OutStream <<
"EVC.Start(&EVCState_" << pInitialState->
m_OID
454 <<
", ::std::string(\"" << InitialApplicationLevel <<
"\")"
458 OutStream <<
"// create Qt observer implementation and register it with the EVC\n";
459 OutStream <<
"::oETCS::DF::CDMIQWidget DMI(&EVC";
465 OutStream <<
", 0, " << (bSimulation ?
"true" :
"false");
471 OutStream <<
"DMI.setWindowTitle(\"EVC Driver Machine Interface\");\n\n";
472 OutStream <<
"DMI.resize(600, 400);\n\n";
473 OutStream <<
"DMI.show();\n\n";
476 OutStream <<
"Application.exec();\n\n";
479 OutStream <<
"EVC.Stop();\n\n";
495 decltype (pProject->m_ObjectSet.begin()) GObject;
504 ::std::string CurrentType;
505 ::std::string DMIDataType;
506 ::std::string InitialType;
507 ::std::string InitialValue;
508 ::std::string ValueType;
509 ::std::string AllowedValue;
514 const ::std::string APPLICATION_LEVEL_OBJECT(
"ApplicationLevelType");
515 const ::std::string DMI_INPUT_OBJECT(
"DMIInput");
516 const ::std::string DMI_OUTPUT_OBJECT(
"DMIOutput");
517 const ::std::string BALISE_IN_DEVICE(
"BaliseReader");
518 const ::std::string BALISE_OUT_DEVICE(
"BaliseSender");
519 const ::std::string COM_IN_OBJECT(
"CommunicationReader");
520 const ::std::string COM_OUT_OBJECT(
"CommunicationSender");
521 const ::std::string STORAGE_OBJECT(
"VariableStorage");
522 const ::std::string SERVICE_BRAKE_OBJECT(
"ServiceBrake");
523 const ::std::string EMERGENCY_BRAKE_OBJECT(
"EmergencyBrake");
524 const ::std::string ODOMETER_BRAKE_OBJECT(
"Odometer");
531 for (GObject = pProject->m_ObjectSet.begin(); GObject != pProject->m_ObjectSet.end(); GObject++)
534 if (m_FBMap.find(GObject->second.m_Type) != m_FBMap.end())
537 OutStream <<
"// Function Block type " << GObject->second.m_Type <<
" [" << GObject->second.m_ID <<
"] with OID " << GObject->second.m_OID <<
"\n";
538 OutStream <<
"::oETCS::DF::" << ::std::left << ::std::setw(25) << m_FBMap[GObject->second.m_Type] <<
"FBO_" << GObject->second.m_OID <<
"(&EVC";
541 if (GObject->second.m_Type == APPLICATION_LEVEL_OBJECT)
544 OutStream <<
", \"" << GObject->second.Properties(
"ApplicationLevelName").begin()->second->m_Value <<
"\"";
550 else if (GObject->second.m_Type == DMI_INPUT_OBJECT)
553 DMIDataType = GObject->second.Properties(
"DataType").begin()->second->m_Value;
556 if (DMIDataType ==
"double")
559 OutStream <<
", ::oETCS::DF::DOUBLE";
562 else if (DMIDataType ==
"doubleArray")
565 OutStream <<
", ::oETCS::DF::DOUBLE_ARRAY";
568 else if (DMIDataType ==
"bool")
571 OutStream <<
", ::oETCS::DF::BOOL";
574 else if (DMIDataType ==
"int")
577 OutStream <<
", ::oETCS::DF::INT";
580 else if (DMIDataType ==
"string")
583 OutStream <<
", ::oETCS::DF::STRING";
588 OutStream <<
", \"" << GObject->second.m_ID <<
"\"";
591 if (not GObject->second.Properties(
"InitialVisible").empty())
594 if (GObject->second.Properties(
"InitialVisible").begin()->second->m_Value ==
"T")
597 OutStream <<
", true";
603 OutStream <<
", false";
613 if (not GObject->second.Properties(
"AllowedValues").empty())
616 if (not GObject->second.Properties(
"AllowedValues").begin()->second->NonProperties(
"Value").empty())
619 Values = GObject->second.Properties(
"AllowedValues").begin()->second->NonProperties(
"Value");
622 for (Value = Values.begin(); Value != Values.end(); Value++)
625 ValueType = Value->second->Properties(
"ValueType").begin()->second->m_Value;
628 AllowedValue = Value->second->Properties(
"Value").begin()->second->m_Value;
631 if (ValueType ==
"bool")
634 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_AllowedBoolInputs.push_back(" << AllowedValue <<
");\n";
637 else if (ValueType ==
"double")
640 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_AllowedDoubleInputs.push_back(" << AllowedValue <<
");\n";
643 else if (ValueType ==
"integer")
646 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_AllowedIntInputs.push_back(" << AllowedValue <<
");\n";
649 else if (ValueType ==
"string")
652 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_AllowedStringInputs.push_back(\"" << AllowedValue <<
"\");\n";
664 if (not GObject->second.Properties(
"InitialVisible").empty())
667 if (GObject->second.Properties(
"InitialVisible").begin()->second->m_Value ==
"T")
670 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_bVisible = true;\n";
676 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_bVisible = false;\n";
683 else if (GObject->second.m_Type == DMI_OUTPUT_OBJECT)
686 DMIDataType = GObject->second.Properties(
"DataType").begin()->second->m_Value;
689 if (DMIDataType ==
"double")
692 OutStream <<
", ::oETCS::DF::DOUBLE";
695 else if (DMIDataType ==
"doubleArray")
698 OutStream <<
", ::oETCS::DF::DOUBLE_ARRAY";
701 else if (DMIDataType ==
"bool")
704 OutStream <<
", ::oETCS::DF::BOOL";
707 else if (DMIDataType ==
"int")
710 OutStream <<
", ::oETCS::DF::INT";
713 else if (DMIDataType ==
"string")
716 OutStream <<
", ::oETCS::DF::STRING";
721 OutStream <<
", \"" << GObject->second.m_ID <<
"\"";
724 if (not GObject->second.Properties(
"InitialVisible").empty())
727 if (GObject->second.Properties(
"InitialVisible").begin()->second->m_Value ==
"T")
730 OutStream <<
", true";
736 OutStream <<
", false";
746 else if (GObject->second.m_Type == COM_IN_OBJECT)
749 if (GObject->second.m_pDecomposition != 0)
752 OutStream <<
", INDEVICES_" << GObject->second.m_pDecomposition->m_OID;
755 OutStream <<
", PACKIDVEC_" << GObject->second.m_pDecomposition->m_OID;
763 else if (GObject->second.m_Type == COM_OUT_OBJECT)
766 if (GObject->second.m_pDecomposition != 0)
769 OutStream <<
", OUTDEVICES_" << GObject->second.m_pDecomposition->m_OID;
777 else if (GObject->second.m_Type == STORAGE_OBJECT)
780 if (GObject->second.Properties(
"DebugOutput").begin()->second->m_Value ==
"T")
783 OutStream <<
", true, \"" << GObject->second.Properties(
"Name").begin()->second->m_Value <<
"\"";
792 InitialValues = GObject->second.Properties(
"InitialValue").begin()->second->m_NonProperties;
795 if (not InitialValues.empty())
798 pInitialValue =
static_cast< ::
GOPPRR::CObject*
>(InitialValues.begin()->second);
801 InitialValue = pInitialValue->
Properties(
"Value").begin()->second->m_Value;
804 InitialType = pInitialValue->
Properties(
"ValueType").begin()->second->m_Value;
807 if (InitialType ==
"bool")
810 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_bBoolInput = " << InitialValue <<
";\n";
813 if (InitialType ==
"double")
816 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_dDoubleInput = " << InitialValue <<
";\n";
819 if (InitialType ==
"integer")
822 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_iIntInput = " << InitialValue <<
";\n";
825 if (InitialType ==
"string")
828 OutStream <<
"FBO_" << GObject->second.m_OID <<
".m_StringInput = \"" << InitialValue <<
"\";\n";
835 else if (GObject->second.m_Type == SERVICE_BRAKE_OBJECT || GObject->second.m_Type == EMERGENCY_BRAKE_OBJECT || GObject->second.m_Type == ODOMETER_BRAKE_OBJECT)
838 OutStream <<
", " << (GObject->second.Properties(
"IsExternal").begin()->second->m_Value ==
"F" ?
"false" :
"true");
880 ::std::string InputPortName;
881 ::std::string OutputPortName;
882 ::std::string FlowType;
883 const ::std::string VARIABLE_INSTANCE_OBJECT(
"VariableInstance");
884 const ::std::string VARIABLE_STORAGE_OBJECT(
"VariableStorage");
885 const ::std::string VARIABLE_TYPE_RESOLUTION(
"VariableResolution");
886 const ::std::string VARIABLE_TYPE_RESOLUTION_UNIT(
"Unit");
887 const ::std::string VARIABLE_TYPE_SIZE(
"Size");
888 const ::std::string VALUEMAP_OBJECT(
"ValueMap");
889 const ::std::string TELEGRAM_OBJECT(
"Telegram");
890 const ::std::string DATAFLOW_RELATIONSHIP(
"DataFlow");
891 const ::std::string DATAINPUT_ROLE(
"DataInput");
892 const ::std::string DATAOUTPUT_ROLE(
"DataOutput");
897 for (Object = pFunctionBlock->m_ObjectSet.begin(); Object !=pFunctionBlock->m_ObjectSet.end(); Object++)
900 if (m_FBMap.find(Object->second->m_Type) != m_FBMap.end())
903 Ports = pFunctionBlock->Ports(Object->second,
"Output",
true,
false);
906 if (Ports.size() > 0)
909 for (Port = Ports.begin(); Port != Ports.end(); Port++)
912 OutputPortName = Port->second->m_ID;
915 FlowType = TypeFromPort(Port->second);
918 while (OutputPortName.find(
"Get") != OutputPortName.npos)
921 OutputPortName.erase(OutputPortName.find(
"Get"), 3);
926 if (m_FBMMap.find(Object->second->m_Type + ::std::string(
"::") + OutputPortName) != m_FBMMap.end())
929 OutputPortName = m_FBMMap[Object->second->m_Type + ::std::string(
"::") + OutputPortName];
934 OutputRoles = pFunctionBlock->Roles(Object->second, Port->second,
"DataOutput",
false,
false);
937 for (Role = OutputRoles.begin(); Role != OutputRoles.end(); Role++)
940 Relationships = pFunctionBlock->Relationships(Role->second,
"DataFlow");
943 Relationship = Relationships.begin();
946 InputRoles = pFunctionBlock->Roles(Role->second,
"DataInput");
949 InputPorts = pFunctionBlock->Ports(InputRoles.begin()->second,
false);
952 if (InputPorts.size() > 0)
955 InputPortName = InputPorts.begin()->second->m_ID;
958 while (InputPortName.find(
"Set") != InputPortName.npos)
961 InputPortName.erase(InputPortName.find(
"Set"), 3);
966 InputObjects = pFunctionBlock->Objects(InputPorts.begin()->second, InputRoles.begin()->second,
false);
969 if (m_FBMMap.find(InputObjects.begin()->second->m_Type + ::std::string(
"::") + InputPortName) != m_FBMMap.end())
972 InputPortName = m_FBMMap[InputObjects.begin()->second->m_Type + ::std::string(
"::") + InputPortName];
977 OutStream <<
"// appending object [" << InputObjects.begin()->second->m_ID <<
"] of type "
978 << InputObjects.begin()->second->m_Type <<
" to output of object [" << Object->second->m_ID <<
"] of type " << Object->second->m_Type
979 <<
" with flow object "<< Relationship->second->m_OID <<
"\n";
981 OutStream <<
"::oETCS::DF::CFlow< " << FlowType << ::std::left << std::setw(38) <<
" >" <<
"FLOW_" << Relationship->second->m_OID <<
"(&(FBO_"
982 << InputObjects.begin()->second->m_OID <<
".m_" << InputPortName <<
"), &EVC);\n";
984 OutStream <<
"FBO_" << Object->second->m_OID <<
".m_" << OutputPortName <<
".push_back(&FLOW_"
985 << Relationship->second->m_OID <<
");\n";
991 InputObjects = pFunctionBlock->Objects(InputRoles.begin()->second);
994 InputPortName = Port->second->m_Type +
"Input";
997 InputPortName.erase(InputPortName.find(
"Output"), 6);
1000 InputPortName[0] = InputPortName[0] +
'A' -
'a';
1006 OutStream <<
"// appending object [" << InputObjects.begin()->second->m_ID <<
"] of type "
1007 << InputObjects.begin()->second->m_Type <<
" to output of object [" << Object->second->m_ID <<
"] of type " << Object->second->m_Type
1008 <<
" with flow object "<< Relationship->second->m_OID <<
"\n";
1010 OutStream <<
"::oETCS::DF::CFlow< " << FlowType << ::std::left << std::setw(38) <<
" >" <<
"FLOW_" << Relationship->second->m_OID <<
"(&(FBO_"
1011 << InputObjects.begin()->second->m_OID <<
".m_" << InputPortName <<
"), &EVC);\n";
1013 OutStream <<
"FBO_" << Object->second->m_OID <<
".m_" << OutputPortName <<
".push_back(&FLOW_"
1014 << Relationship->second->m_OID <<
");\n";
1026 OutputRoles = pFunctionBlock->Roles(Object->second,
"DataOutput",
false,
false);
1029 for (Role = OutputRoles.begin(); Role != OutputRoles.end(); Role++)
1032 Relationships = pFunctionBlock->Relationships(Role->second,
"DataFlow");
1035 Relationship = Relationships.begin();
1038 InputRoles = pFunctionBlock->Roles(Role->second,
"DataInput",
false,
false);
1041 InputPorts = pFunctionBlock->Ports(InputRoles.begin()->second,
false);
1044 if (InputPorts.size() > 0)
1047 InputPortName = InputPorts.begin()->second->m_ID;
1050 FlowType = TypeFromPort(InputPorts.begin()->second);
1053 while (InputPortName.find(
"Set") != InputPortName.npos)
1056 InputPortName.erase(InputPortName.find(
"Set"), 3);
1061 InputObjects = pFunctionBlock->Objects(InputPorts.begin()->second, InputRoles.begin()->second,
false);
1064 if (m_FBMMap.find(InputObjects.begin()->second->m_Type + ::std::string(
"::") + InputPortName) != m_FBMMap.end())
1067 InputPortName = m_FBMMap[InputObjects.begin()->second->m_Type + ::std::string(
"::") + InputPortName];
1072 OutputPortName = InputPorts.begin()->second->m_Type +
"Value";
1075 OutputPortName.erase(OutputPortName.find(
"Input"), 5);
1078 OutputPortName[0] = OutputPortName[0] +
'A' -
'a';
1081 OutStream <<
"// appending object [" << InputObjects.begin()->second->m_ID <<
"] of type "
1082 << InputObjects.begin()->second->m_Type <<
" to output of object [" << Object->second->m_ID <<
"] of type " << Object->second->m_Type
1083 <<
" with flow object "<< Relationship->second->m_OID <<
"\n";
1085 OutStream <<
"::oETCS::DF::CFlow< " << FlowType << ::std::left << std::setw(38) <<
" >" <<
"FLOW_" << Relationship->second->m_OID <<
"(&(FBO_"
1086 << InputObjects.begin()->second->m_OID <<
".m_" << InputPortName <<
"), &EVC);\n";
1089 OutStream <<
"FBO_" << Object->second->m_OID <<
".m_" << OutputPortName <<
".push_back(&FLOW_"
1090 << Relationship->second->m_OID <<
");\n";
1096 InputObjects = pFunctionBlock->Objects(InputRoles.begin()->second,
false);
1099 OutStream <<
"// appending object [" << InputObjects.begin()->second->m_ID <<
"] of type "
1100 << InputObjects.begin()->second->m_Type <<
" to output of object [" << Object->second->m_ID <<
"] of type " << Object->second->m_Type
1101 <<
" with flow object "<< Relationship->second->m_OID <<
"\n";
1103 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CBitFlow" <<
"FLOW_" << Relationship->second->m_OID <<
"(&(FBO_"
1104 << InputObjects.begin()->second->m_OID <<
"), &EVC);\n";
1106 OutStream <<
"FBO_" << Object->second->m_OID <<
".m_BitValue.push_back(&FLOW_"
1107 << Relationship->second->m_OID <<
");\n";
1142 ::std::string InputPortName;
1143 ::std::string OutputPortName;
1144 ::std::string FlowType;
1149 const ::std::string VARIABLE_INSTANCE_OBJECT(
"VariableInstance");
1150 const ::std::string VARIABLE_STORAGE_OBJECT(
"VariableStorage");
1151 const ::std::string VARIABLE_TYPE_RESOLUTION(
"VariableResolution");
1152 const ::std::string VARIABLE_TYPE_RESOLUTION_UNIT(
"Unit");
1153 const ::std::string VARIABLE_TYPE_SIZE(
"Size");
1154 const ::std::string VALUEMAP_OBJECT(
"ValueMap");
1155 const ::std::string TELEGRAM_OBJECT(
"Telegram");
1156 const ::std::string DATAFLOW_RELATIONSHIP(
"DataFlow");
1157 const ::std::string DATAINPUT_ROLE(
"DataInput");
1158 const ::std::string DATAOUTPUT_ROLE(
"DataOutput");
1164 if (pCommunication->m_Type ==
"CommunicationReader")
1167 Variables = pCommunication->Objects(VARIABLE_INSTANCE_OBJECT,
false,
false);
1170 for (Variable = Variables.begin(); Variable != Variables.end(); Variable++)
1173 OutRoles = pCommunication->Roles(Variable->second, DATAOUTPUT_ROLE,
false,
false);
1176 for (OutRole = OutRoles.begin(); OutRole != OutRoles.end(); OutRole++)
1179 pDataFlow = pCommunication->Relationships(OutRole->second, DATAFLOW_RELATIONSHIP,
false,
true).begin()->second;
1182 pDataInput = pCommunication->Roles(pDataFlow, DATAINPUT_ROLE,
false,
true).begin()->second;
1185 pVariableStorage = pCommunication->Objects(pDataInput,
true).begin()->second;
1188 OutStream <<
"// appending variable storage object [" << pVariableStorage->
m_ID <<
"] to output of variable instance ["
1189 << Variable->second->m_ID <<
"] with flow object "<< pDataFlow->
m_OID <<
"\n";
1191 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CBitFlow" <<
"FLOW_" << pDataFlow->
m_OID <<
"(&(FBO_"
1192 << pVariableStorage->
m_OID <<
"), &EVC);\n";
1194 OutStream <<
"VAR_" << Variable->second->m_OID <<
".m_BitValues.push_back(&FLOW_"
1195 << pDataFlow->
m_OID <<
");\n";
1204 else if (pCommunication->m_Type ==
"CommunicationSender")
1207 Variables = pCommunication->Objects(VARIABLE_INSTANCE_OBJECT,
false,
false);
1210 for (Variable = Variables.begin(); Variable != Variables.end(); Variable++)
1213 InputRoles = pCommunication->Roles(Variable->second, DATAINPUT_ROLE,
false,
false);
1216 for (InputRole = InputRoles.begin(); InputRole != InputRoles.end(); InputRole++)
1219 pDataFlow = pCommunication->Relationships(OutRole->second, DATAFLOW_RELATIONSHIP,
false,
true).begin()->second;
1222 pDataOutput = pCommunication->Roles(pDataFlow, DATAOUTPUT_ROLE,
false,
true).begin()->second;
1225 pVariableStorage = pCommunication->Objects(pDataOutput,
true).begin()->second;
1228 OutStream <<
"// appending variable storage object [" << pVariableStorage->
m_ID <<
"] to input of variable instance ["
1229 << Variable->second->m_ID <<
"] with flow object "<< pDataFlow->
m_OID <<
"\n";
1231 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CBitFlow" <<
"FLOW_" << pDataFlow->
m_OID <<
"(&(FBO_"
1232 << pVariableStorage->
m_OID <<
"), &EVC);\n";
1234 OutStream <<
"VAR_" << Variable->second->m_OID <<
".m_BitValues.push_back(&FLOW_"
1235 << pDataFlow->
m_OID <<
");\n";
1258 ::std::string ApplicationLevel;
1265 ::std::map< ::std::string, ::oETCS::GEN::CFBNode > FBNodes;
1266 decltype (FBNodes.begin()) n;
1268 ::std::list< ::std::string > ExecutionOrder;
1269 decltype (ExecutionOrder.begin()) s;
1270 ::std::vector< const oETCS::GEN::CFBNode* > NodeStack(0);
1271 bool bFaultStateFound(
false);
1279 if (not pMainFunctionBlock->Properties(
"FailureGuard").begin()->second->m_NonProperties.empty())
1282 pFailureGuard =
static_cast< ::
GOPPRR::CObject*
>(pMainFunctionBlock->Properties(
"FailureGuard").begin()->second->m_NonProperties.begin()->second);
1285 CurrentStates = pEVCGraph->Roles(pEVCState,
"CurrentState");
1288 for (CurrentState = CurrentStates.begin(); CurrentState != CurrentStates.end() && not bFaultStateFound; CurrentState++)
1291 pModeTransition = pEVCGraph->Relationships(CurrentState->second).begin()->second;
1294 pCurrentModeGuard =
static_cast< ::
GOPPRR::CObject*
>(pModeTransition->
Properties(
"ModeGuard").begin()->second->m_NonProperties.begin()->second);
1297 if (pCurrentModeGuard == pFailureGuard)
1300 pNextState = pEVCGraph->Roles(pModeTransition, ::std::string(
"NextState")).begin()->second;
1303 pFaultState = pEVCGraph->Objects(pNextState,
"Mode").begin()->second;
1306 bFaultStateFound =
true;
1316 ApplicationLevel = pMainFunctionBlock->
Properties(
"ActiveApplicationLevel").begin()->second->m_Value;
1320 OutStream <<
"// Data flow object " << pMainFunctionBlock->m_Type <<
" [" << pMainFunctionBlock->m_ID <<
"] with OID " << pMainFunctionBlock->m_OID <<
"\n";
1323 OutStream <<
"::std::vector< ::oETCS::DF::CFunctionBlock* > FBVEC_" << pMainFunctionBlock->m_OID <<
";\n";
1326 OutStream <<
"::std::vector< ::oETCS::DF::CAbstractFlow* > FLOWVEC_" << pMainFunctionBlock->m_OID <<
";\n";
1334 for (n = FBNodes.begin(); n != FBNodes.end(); n++)
1337 for (i = n->second.m_Inputs.begin(); i != n->second.m_Inputs.end(); i++)
1354 for (n = FBNodes.begin(); n != FBNodes.end(); n++)
1363 for (s = ExecutionOrder.begin(); s != ExecutionOrder.end(); s++)
1366 OutStream <<
"FBVEC_" << pMainFunctionBlock->m_OID <<
".push_back(&FBO_" << *s <<
");\n";
1374 for (Relationship = pMainFunctionBlock->m_RelationshipSet.begin(); Relationship != pMainFunctionBlock->m_RelationshipSet.end(); Relationship++)
1377 if (Relationship->second->m_Type ==
"DataFlow")
1380 OutStream <<
"FLOWVEC_" << pMainFunctionBlock->m_OID <<
".push_back(&FLOW_" << Relationship->second->m_OID <<
");\n";
1388 for (Object = pMainFunctionBlock->m_ObjectSet.begin(); Object != pMainFunctionBlock->m_ObjectSet.end(); Object++)
1391 if (Object->second->m_Type ==
"CommunicationReader" || Object->second->m_Type ==
"CommunicationSender")
1394 if (Object->second->m_pDecomposition !=
nullptr)
1397 this->GenerateDataFlowForCommunication(pMainFunctionBlock->m_OID, Object->second->m_pDecomposition, OutStream);
1407 OID = pMainFunctionBlock->m_OID;
1410 SubFunctionBlocks = pMainFunctionBlock->Objects(
"SubFunction");
1413 for (SubFunctionBlock = SubFunctionBlocks.begin(); SubFunctionBlock != SubFunctionBlocks.end(); SubFunctionBlock++)
1416 if (SubFunctionBlock->second->m_pDecomposition != 0)
1419 GenerateDataFlow(OID, SubFunctionBlock->second->m_pDecomposition, OutStream);
1427 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CDataFlow" <<
"DATAFLOW_" << pMainFunctionBlock->m_OID <<
"(&EVCState_" << pEVCState->m_OID
1428 <<
", ::std::string(\"" << ApplicationLevel <<
"\")"
1429 <<
", FBVEC_" << pMainFunctionBlock->m_OID
1430 <<
", FLOWVEC_" << pMainFunctionBlock->m_OID
1431 <<
", &DMI_" << pMainFunctionBlock->m_OID;
1434 if (pFaultState != 0)
1437 OutStream <<
", &EVCState_" << pFaultState->
m_OID;
1442 OutStream <<
");\n";
1460 for (Object = pSubFunctionBlock->m_ObjectSet.begin(); Object != pSubFunctionBlock->m_ObjectSet.end(); Object++)
1463 if (Object->second->m_Type ==
"CommunicationReader" || Object->second->m_Type ==
"CommunicationSender")
1466 if (Object->second->m_pDecomposition !=
nullptr)
1469 this->GenerateDataFlowForCommunication(OID, Object->second->m_pDecomposition, OutStream);
1478 for (Relationship = pSubFunctionBlock->m_RelationshipSet.begin(); Relationship != pSubFunctionBlock->m_RelationshipSet.end(); Relationship++)
1481 if (Relationship->second->m_Type ==
"DataFlow")
1484 OutStream <<
"FLOWVEC_" << OID <<
".push_back(&FLOW_" << Relationship->second->m_OID <<
");\n";
1491 for (Object = pSubFunctionBlock->m_ObjectSet.begin(); Object != pSubFunctionBlock->m_ObjectSet.end(); Object++)
1494 if (Object->second->m_Type ==
"SubFunction")
1497 if (Object->second->m_pDecomposition != 0)
1500 this->GenerateDataFlow(OID, Object->second->m_pDecomposition, OutStream);
1525 for (Relationship = pCommGraph->m_RelationshipSet.begin(); Relationship != pCommGraph->m_RelationshipSet.end(); Relationship++)
1528 if (Relationship->second->m_Type ==
"DataFlow")
1531 pDataOutput = pCommGraph->Roles(Relationship->second,
"DataOutput",
false,
true).begin()->second;
1534 pOutputObject = pCommGraph->Objects(pDataOutput,
true).begin()->second;
1538 if (pOutputObject->
m_Type ==
"VariableInstance" || pOutputObject->
m_Type ==
"VariableStorage")
1541 OutStream <<
"FLOWVEC_" << OID <<
".push_back(&FLOW_" << Relationship->second->
m_OID <<
");\n";
1568 OutStream <<
"// DMI widget object " << pMainFunctionBlock->m_Type <<
" [" << pMainFunctionBlock->m_ID <<
"] with OID " << pMainFunctionBlock->m_OID <<
"\n";
1571 OutStream <<
"::std::vector< ::oETCS::DF::CDMIInput* > DMIIVEC_" << pMainFunctionBlock->m_OID <<
";\n";
1574 OutStream <<
"::std::vector< ::oETCS::DF::CDMIOutput* > DMIOVEC_" << pMainFunctionBlock->m_OID <<
";\n";
1578 DMIInputs = pMainFunctionBlock->Objects(
"DMIInput",
false,
false);
1581 for (DMIInput = DMIInputs.begin(); DMIInput != DMIInputs.end(); DMIInput++)
1584 OutStream <<
"DMIIVEC_" << pMainFunctionBlock->m_OID <<
".push_back(&FBO_" << DMIInput->second->m_OID <<
");\n";
1589 DMIOutputs = pMainFunctionBlock->Objects(
"DMIOutput",
false,
false);
1592 for (DMIOutput = DMIOutputs.begin(); DMIOutput != DMIOutputs.end(); DMIOutput++)
1595 OutStream <<
"DMIOVEC_" << pMainFunctionBlock->m_OID <<
".push_back(&FBO_" << DMIOutput->second->m_OID <<
");\n";
1601 SubFunctions = pMainFunctionBlock->Objects(
"SubFunction",
false,
false);
1604 for (SubFunction = SubFunctions.begin(); SubFunction != SubFunctions.end(); SubFunction++)
1607 if (SubFunction->second->m_pDecomposition != 0)
1610 this->GenerateDMI(pMainFunctionBlock->m_OID, SubFunction->second->m_pDecomposition, OutStream);
1618 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CDMISubject" <<
"DMI_" << pMainFunctionBlock->m_OID <<
"("
1619 <<
"DMIIVEC_" << pMainFunctionBlock->m_OID
1620 <<
", DMIOVEC_" << pMainFunctionBlock->m_OID <<
");\n";
1642 DMIInputs = pSubFunctionBlock->Objects(
"DMIInput",
false,
false);
1645 for (DMIInput = DMIInputs.begin(); DMIInput != DMIInputs.end(); DMIInput++)
1648 OutStream <<
"DMIIVEC_" << OID <<
".push_back(&FBO_" << DMIInput->second->m_OID <<
");\n";
1653 DMIOutputs = pSubFunctionBlock->Objects(
"DMIOutput",
false,
false);
1656 for (DMIOutput = DMIOutputs.begin(); DMIOutput != DMIOutputs.end(); DMIOutput++)
1659 OutStream <<
"DMIOVEC_" << OID <<
".push_back(&FBO_" << DMIOutput->second->m_OID <<
");\n";
1664 SubFunctions = pSubFunctionBlock->Objects(
"SubFunction",
false,
false);
1667 for (SubFunction = SubFunctions.begin(); SubFunction != SubFunctions.end(); SubFunction++)
1670 if (SubFunction->second->m_pDecomposition != 0)
1673 this->GenerateDMI(OID, SubFunction->second->m_pDecomposition, OutStream);
1697 bool bModeGuardFound(
false);
1702 ModeGuards = pMainFunctionBlock->Objects(
"ModeGuard",
false,
false);
1705 for (ModeGuard = ModeGuards.begin(); ModeGuard != ModeGuards.end(); ModeGuard++)
1708 CurrentRoles = pRootGraph->Roles(pEVCState, ::std::string(
"CurrentState"));
1711 for (CurrentRole = CurrentRoles.begin(); CurrentRole != CurrentRoles.end() && not bModeGuardFound; CurrentRole++)
1714 Transitions = pRootGraph->Relationships(CurrentRole->second);
1717 pTransition = Transitions.begin()->second;
1720 pCurrentModeGuard =
static_cast< ::
GOPPRR::CObject*
>(pTransition->
Properties(
"ModeGuard").begin()->second->m_NonProperties.begin()->second);
1723 if (pCurrentModeGuard == ModeGuard->second)
1726 if (m_GeneratedEVCTransitions.find(pTransition->
m_OID) == m_GeneratedEVCTransitions.end())
1729 NextRoles = pRootGraph->Roles(pTransition, ::std::string(
"NextState"));
1732 pNextEVCState = pRootGraph->Objects(NextRoles.begin()->second).begin()->second;
1735 OutStream <<
"// EVC transition object for ModeGuard [" << ModeGuard->second->
m_ID <<
"] with OID " << ModeGuard->second->m_OID <<
"\n";
1736 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CEVCTransition" <<
"EVCTRANS_" << pTransition->
m_OID <<
"("
1737 <<
"&FBO_" << ModeGuard->second->m_OID
1738 <<
", &EVCState_" << pEVCState->m_OID
1739 <<
", &EVCState_" << pNextEVCState->
m_OID
1740 <<
", " << pTransition->
Properties(
"Priority").begin()->second->m_Value
1744 m_GeneratedEVCTransitions[pTransition->
m_OID] =
true;
1749 bModeGuardFound =
true;
1756 bModeGuardFound =
false;
1784 const ::std::string CONTROL_FLOW_OBJECT(
"EmbeddedStateMachine");
1785 const ::std::string STATE_OBJECT(
"EmbeddedState");
1786 const ::std::string STATE_GUARD_OBJECT(
"StateGuard");
1787 const ::std::string INITIAL_OBJECT(
"EmbeddedInitialState");
1788 const ::std::string FINAL_OBJECT(
"EmbeddedFinalState");
1793 ::std::map< ::std::string, ::oETCS::GEN::CFBNode > FBNodes;
1794 decltype (FBNodes.begin()) n;
1796 ::std::list< ::std::string > ExecutionOrder;
1797 decltype (ExecutionOrder.begin()) s;
1798 ::std::vector< const oETCS::GEN::CFBNode* > NodeStack(0);
1799 bool bInitial(
false);
1806 for (GObject = pProject->m_ObjectSet.begin(); GObject != pProject->m_ObjectSet.end(); GObject++)
1809 if (GObject->second.m_Type == CONTROL_FLOW_OBJECT)
1812 if (GObject->second.m_pDecomposition != 0)
1815 pControlFlow = GObject->second.m_pDecomposition;
1818 States = pControlFlow->
Objects(STATE_OBJECT,
false,
false);
1821 for (State = States.begin(); State != States.end(); State++)
1824 if (m_GeneratedControlFlows.find(State->second->m_OID) == m_GeneratedControlFlows.end())
1827 OutStream <<
"// State object " << State->second->m_Type <<
" [" << State->second->m_ID <<
"] with OID " << State->second->m_OID <<
"\n";
1830 OutStream <<
"::std::vector< ::oETCS::DF::CFunctionBlock* > CVEC_" << State->second->m_OID <<
";\n";
1833 OutStream <<
"::std::vector< ::oETCS::DF::CAbstractFlow* > FLOWVEC_" << State->second->m_OID <<
";\n";
1836 Nexts = pControlFlow->
Roles(State->second,
"NextState",
false,
false);
1839 for (Next = Nexts.begin(); Next != Nexts.end() && not bInitial; Next++)
1842 Currents = pControlFlow->
Roles(Next->second, ::std::string(
"CurrentState"));
1845 pObject = pControlFlow->
Objects(Currents.begin()->second).begin()->second;
1848 if (pObject->
m_Type == INITIAL_OBJECT)
1859 if (State->second->m_pDecomposition != 0)
1862 pDataFlow = State->second->m_pDecomposition;
1872 for (n = FBNodes.begin(); n != FBNodes.end(); n++)
1875 for (i = n->second.m_Inputs.begin(); i != n->second.m_Inputs.end(); i++)
1899 ExecutionOrder.clear();
1902 for (n = FBNodes.begin(); n != FBNodes.end(); n++)
1911 for (s = ExecutionOrder.begin(); s != ExecutionOrder.end(); s++)
1914 OutStream <<
"CVEC_" << State->second->m_OID <<
".push_back(&FBO_" << *s <<
");\n";
1920 this->GenerateDataFlow(State->second->m_OID, State->second->m_pDecomposition, OutStream);
1927 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CControlFlow::CState" <<
"STATE_" << State->second->m_OID <<
"("
1928 <<
"&FBO_" << GObject->second.m_OID
1929 <<
", \"" << State->second->Properties(
"Name").begin()->second->m_Value <<
"\""
1930 <<
", CVEC_" << State->second->m_OID
1931 <<
", FLOWVEC_" << State->second->m_OID
1933 <<
", " << (bInitial ?
"true" :
"false")
1938 OutStream <<
"\n\n\n\n";
1945 m_GeneratedControlFlows[State->second->m_OID] =
true;
1954 Finals = pControlFlow->
Objects(FINAL_OBJECT,
false,
false);
1957 for (Final = Finals.begin(); Final != Finals.end(); Final++)
1960 if (m_GeneratedControlFlows.find(Final->second->m_OID) == m_GeneratedControlFlows.end())
1964 OutStream <<
"// Final state object " << Final->second->m_Type <<
" with OID " << Final->second->m_OID <<
"\n";
1965 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CControlFlow::CState" <<
"STATE_" << Final->second->m_OID <<
"("
1966 <<
"&FBO_" << GObject->second.m_OID
1967 <<
", \"" << Final->second->Properties(
"Name").begin()->second->m_Value <<
"\""
1968 <<
", ::std::vector< ::oETCS::DF::CFunctionBlock* >(0)"
1969 <<
", ::std::vector< ::oETCS::DF::CAbstractFlow* >(0)"
1975 m_GeneratedControlFlows[Final->second->m_OID] =
true;
1982 OutStream <<
"\n\n\n\n";
2010 EVCStates = pRootGraph->Objects(EVCSTATE_OBJECT);
2013 for (EVCState = EVCStates.begin(); EVCState != EVCStates.end(); EVCState++)
2016 Explosions = EVCState->second->m_Explosions;
2019 for (Explosion = Explosions.begin(); Explosion != Explosions.end(); Explosion++)
2022 this->GenerateTransitions(Explosion->second, EVCState->second, OutStream);
2044 const ::std::string CONTROL_FLOW_OBJECT(
"EmbeddedStateMachine");
2045 const ::std::string STATE_OBJECT(
"EmbeddedState");
2046 const ::std::string SUB_FUNCTION_OBJECT(
"SubFunction");
2052 StateMachines = pFunctionBlock->Objects(CONTROL_FLOW_OBJECT,
false,
false);
2055 for (StateMachine = StateMachines.begin(); StateMachine != StateMachines.end(); StateMachine++)
2058 if (StateMachine->second->m_pDecomposition != 0)
2061 pControlFlow = StateMachine->second->m_pDecomposition;
2064 States = pControlFlow->
Objects(STATE_OBJECT,
false,
false);
2067 for (State = States.begin(); State != States.end(); State++)
2070 if (State->second->m_pDecomposition != 0)
2073 this->GenerateTransitions(State->second->m_pDecomposition, pControlFlow, pEVCState, State->second, OutStream);
2086 SubFunctions = pFunctionBlock->Objects(SUB_FUNCTION_OBJECT,
false,
false);
2089 for (SubFunction = SubFunctions.begin(); SubFunction != SubFunctions.end(); SubFunction++)
2092 if (SubFunction->second->m_pDecomposition != 0)
2095 this ->GenerateTransitions(SubFunction->second->m_pDecomposition, pEVCState, OutStream);
2117 const ::std::string STATE_GUARD_OBJECT(
"StateGuard");
2127 StateGuards = pFunctionBlock->Objects(STATE_GUARD_OBJECT,
false,
false);
2130 for (StateGuard = StateGuards.begin(); StateGuard != StateGuards.end(); StateGuard++)
2133 Currents = pControlFlow->Roles(pState, std::string(
"CurrentState"),
false,
true);
2136 for (Current = Currents.begin(); Current != Currents.end(); Current++)
2139 Transitions = pControlFlow->Relationships(Current->second);
2142 pGuard =
static_cast< ::
GOPPRR::CObject*
>(Transitions.begin()->second->Properties(
"StateGuard").begin()->second->m_NonProperties.begin()->second);
2145 if (StateGuard->second == pGuard)
2148 Nexts = pControlFlow->Roles(Transitions.begin()->second, ::std::string(
"NextState"));
2151 pTarget = pControlFlow->Objects(Nexts.begin()->second).begin()->second;
2154 if (m_GeneratedTransitions.find(StateGuard->second->m_OID +
"_" + pEVCState->m_OID +
"_" + pControlFlow->m_OID) == m_GeneratedTransitions.end())
2157 OutStream <<
"// State transition object " << StateGuard->second->
m_Type <<
" [" << StateGuard->second->m_ID <<
"] with OID " << StateGuard->second->m_OID
2158 <<
" in EVCState [" << pEVCState->m_ID <<
"] with OID " << pEVCState->m_OID <<
"\n";
2159 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CTransition" <<
"TRANS_" << StateGuard->second->m_OID <<
"_" << pEVCState->m_OID <<
"_" << pControlFlow->m_OID <<
"("
2160 <<
"&EVCState_" << pEVCState->m_OID
2161 <<
", &FBO_" << StateGuard->second->m_OID
2162 <<
", &STATE_" << pState->m_OID
2163 <<
", &STATE_" << pTarget->
m_OID
2164 <<
", " << Transitions.begin()->second->Properties(
"Priority").begin()->second->m_Value
2168 m_GeneratedTransitions[StateGuard->second->m_OID +
"_" + pEVCState->m_OID +
"_" + pControlFlow->m_OID] =
true;
2187 decltype (pProject->m_GraphSet.begin()) GGraph;
2188 decltype (pProject->m_GraphSet) GGraphs;
2190 decltype (pProject->m_ObjectSet.begin()) GObject;
2191 decltype (pProject->m_ObjectSet.begin()) ComObject;
2225 ::std::string ResolutionUnit;
2226 ::std::string Resolution;
2228 ::std::string Value;
2229 ::std::string MappedValue;
2231 ::std::string ValueType;
2232 ::std::string PacketID;
2233 ::std::string ConditionalIterator;
2234 ::std::string ConditionalValue;
2239 const ::std::string APPLICATION_LEVEL_OBJECT(
"ApplicationLevelType");
2240 const ::std::string DMI_INPUT_OBJECT(
"DMIInput");
2241 const ::std::string DMI_OUTPUT_OBJECT(
"DMIOutput");
2242 const ::std::string BALISE_IN_DEVICE(
"BaliseReader");
2243 const ::std::string BALISE_OUT_DEVICE(
"BaliseSender");
2244 const ::std::string COM_IN(
"CommunicationReader");
2245 const ::std::string COM_OUT(
"CommunicationSender");
2246 const ::std::string VARIABLE_INSTANCE_OBJECT(
"VariableInstance");
2247 const ::std::string PACKET_OBJECT(
"Packet");
2248 const ::std::string ANY_PACKET_OBJECT(
"AnyPacket");
2249 const ::std::string VARIABLE_TYPE_OBJECT(
"VariableType");
2250 const ::std::string VARIABLE_STORAGE_OBJECT(
"VariableStorage");
2251 const ::std::string VARIABLE_TYPE_RESOLUTION(
"VariableResolution");
2252 const ::std::string VARIABLE_TYPE_RESOLUTION_UNIT(
"Unit");
2253 const ::std::string VARIABLE_TYPE_SIZE(
"Size");
2254 const ::std::string VALUEMAP_OBJECT(
"ValueMap");
2255 const ::std::string TELEGRAM_OBJECT(
"Telegram");
2256 const ::std::string DATAFLOW_RELATIONSHIP(
"DataFlow");
2257 const ::std::string DATAINPUT_ROLE(
"DataInput");
2258 const ::std::string DATAOUTPUT_ROLE(
"DataOutput");
2259 const ::std::string CONDITIONAL_FLAG_PROPERTY(
"IsConditionalIterator");
2260 const ::std::string CONDITIONAL_VALUE_PROPERTY(
"ConditionalValue");
2261 ::std::vector< ::std::string > InDeviceNames;
2262 ::std::vector< ::std::string > OutDeviceNames;
2263 ::std::stringstream TempStream;
2270 for (GGraph = pProject->m_GraphSet.begin(); GGraph != pProject->m_GraphSet.end(); GGraph++)
2273 if (GGraph->second.m_Type == COM_IN)
2276 OutStream <<
"// Vector of used packet IDs in graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
2277 OutStream << ::std::left << std::setw(38) <<
"::std::vector< unsigned char >" <<
"PACKIDVEC_" << GGraph->second.m_OID <<
";\n";
2281 Packets = GGraph->second.Objects(PACKET_OBJECT,
false,
false);
2284 for (Packet = Packets.begin(); Packet != Packets.end(); Packet++)
2287 OutStream <<
"PACKIDVEC_" << GGraph->second.m_OID <<
".push_back(" << Packet->second->Properties(
"PacketID").begin()->second->m_Value <<
");\n";
2298 OutStream <<
"\n\n\n\n";
2303 for (GObject = pProject->m_ObjectSet.begin(); GObject != pProject->m_ObjectSet.end(); GObject++)
2306 if (GObject->second.m_Type == VALUEMAP_OBJECT)
2309 Value = GObject->second.Properties(
"Value").begin()->second->m_Value;
2312 MappedValue = GObject->second.Properties(
"MappedValue").begin()->second->m_Value;
2315 Unit = GObject->second.Properties(
"ValueType").begin()->second->m_Value;
2318 ValueType = GObject->second.Properties(
"ValueType").begin()->second->m_Value;
2321 OutStream <<
"// Variable object (as value map) " << GObject->second.m_Type <<
" [" << GObject->second.m_ID <<
"] with OID " << GObject->second.m_OID <<
"\n";
2322 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CVariable" <<
"VARMAP_" << GObject->second.m_OID <<
"(&EVC, 1";
2325 if (Unit ==
"double")
2328 OutStream <<
", ::oETCS::DF::CVariable::DOUBLE";
2331 else if (Unit ==
"string")
2334 OutStream <<
", ::oETCS::DF::CVariable::STRING";
2340 OutStream <<
", ::oETCS::DF::CVariable::INTEGER";
2345 OutStream <<
", " << MappedValue.length();
2348 OutStream <<
");\n";
2351 OutStream <<
"VARMAP_" << GObject->second.m_OID <<
".SetValue(\"" << MappedValue <<
"\");\n";
2359 OutStream <<
"\n\n\n\n";
2363 for (GObject = pProject->m_ObjectSet.begin(); GObject != pProject->m_ObjectSet.end(); GObject++)
2366 if (GObject->second.m_Type == VARIABLE_INSTANCE_OBJECT)
2369 pVariableType =
dynamic_cast< ::
GOPPRR::CObject*
>(GObject->second.Properties(
"Type").begin()->second->NonProperties(VARIABLE_TYPE_OBJECT).begin()->second);
2372 Resolution = pVariableType->
Properties(VARIABLE_TYPE_RESOLUTION).begin()->second->m_Value;
2375 ResolutionUnit = pVariableType->
Properties(VARIABLE_TYPE_RESOLUTION_UNIT).begin()->second->m_Value;
2378 Size = pVariableType->
Properties(VARIABLE_TYPE_SIZE).begin()->second->m_Value;
2381 ConditionalIterator = GObject->second.Properties(CONDITIONAL_FLAG_PROPERTY).begin()->second->m_Value ==
"T" ?
"true" :
"false";
2382 ConditionalValue = GObject->second.Properties(CONDITIONAL_VALUE_PROPERTY).begin()->second->m_Value;
2385 OutStream <<
"// Variable object " << GObject->second.m_Type <<
" [" << GObject->second.m_ID <<
"] with OID " << GObject->second.m_OID <<
"\n";
2388 Properties = pVariableType->
Properties(
"Map");
2391 if (not Properties.begin()->second->m_NonProperties.empty())
2394 OutStream <<
"::std::map< ::oETCS::DF::VARIABLE_VALUE_VECTOR_T, ::oETCS::DF::CVariable* > STLMAP_" << GObject->second.m_OID <<
";\n";
2397 NonProperties = Properties.begin()->second->m_NonProperties;
2400 for (NonProperty = NonProperties.begin(); NonProperty != NonProperties.end(); NonProperty++)
2403 Value = NonProperty->second->Properties(
"Value").begin()->second->m_Value;
2406 OutStream <<
"STLMAP_" << GObject->second.m_OID <<
"[ ::oETCS::DF::CVariable::StringToValueVector(\"" << Value <<
"\") ] = &VARMAP_" << NonProperty->second->m_OID <<
";\n";
2414 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CVariable" <<
"VAR_" << GObject->second.m_OID <<
"(&EVC, " << Resolution;
2417 if (ResolutionUnit ==
"m")
2420 OutStream <<
", ::oETCS::DF::CVariable::METERS";
2423 else if (ResolutionUnit ==
"s")
2426 OutStream <<
", ::oETCS::DF::CVariable::SECONDS";
2429 else if (ResolutionUnit ==
"km/h")
2432 OutStream <<
", ::oETCS::DF::CVariable::KILO_METERS_PER_HOUR";
2435 else if (ResolutionUnit ==
"cm")
2438 OutStream <<
", ::oETCS::DF::CVariable::CENTI_METERS";
2441 else if (ResolutionUnit ==
"integer")
2444 OutStream <<
", ::oETCS::DF::CVariable::INTEGER";
2447 else if (ResolutionUnit ==
"string")
2450 OutStream <<
", ::oETCS::DF::CVariable::STRING";
2456 OutStream <<
", ::oETCS::DF::CVariable::DOUBLE";
2461 OutStream <<
", " << Size;
2465 OutStream <<
", " << ConditionalIterator;
2466 OutStream <<
", " << ConditionalValue;
2470 if (not Properties.begin()->second->m_NonProperties.empty())
2473 OutStream <<
", " <<
"STLMAP_" << GObject->second.m_OID;
2478 OutStream <<
");\n";
2487 OutStream <<
"\n\n\n\n";
2491 for (GObject = pProject->m_ObjectSet.begin(); GObject != pProject->m_ObjectSet.end(); GObject++)
2494 if (GObject->second.m_Type == PACKET_OBJECT)
2497 PacketID = GObject->second.Properties(
"PacketID").begin()->second->m_Value;
2500 OutStream <<
"// Packet object " << GObject->second.m_Type <<
" [" << GObject->second.m_ID <<
"] with OID " << GObject->second.m_OID <<
" & " << &(GObject->second) <<
"\n";
2503 if (GObject->second.m_pDecomposition != 0)
2506 Variables = GObject->second.m_pDecomposition->Objects(VARIABLE_INSTANCE_OBJECT);
2509 OutStream <<
"::std::vector< ::oETCS::DF::CVariable* > STLVEC_" << GObject->second.m_OID <<
";\n";
2512 for (Variable = Variables.begin(); Variable != Variables.end(); Variable++)
2515 OutStream <<
"STLVEC_" << GObject->second.m_OID <<
".push_back(&VAR_" << Variable->second->m_OID <<
");\n";
2518 if (Variable->second->Properties(
"IsIterator").begin()->second->m_Value ==
"T")
2521 IteratedVariables = GObject->second.m_pDecomposition->Contained(Variable->second,
false);
2524 for (Iterated = IteratedVariables.begin(); Iterated != IteratedVariables.end(); Iterated++)
2527 if (Iterated->second->m_Type == VARIABLE_INSTANCE_OBJECT)
2530 OutStream <<
"VAR_" << Variable->second->m_OID <<
".m_IteratedVariables.push_back(" <<
"&VAR_" << Iterated->second->m_OID <<
");\n";
2540 ScalingValues = GObject->second.m_pDecomposition->Roles(Variable->second,
"ScalingValue",
false,
false);
2543 for (ScalingValue = ScalingValues.begin(); ScalingValue != ScalingValues.end(); ScalingValue++)
2546 ScaledValue = GObject->second.m_pDecomposition->Roles(ScalingValue->second,
"ScaledValue",
false,
true).begin();
2549 pScaledVariable = GObject->second.
m_pDecomposition->
Objects(ScaledValue->second, VARIABLE_INSTANCE_OBJECT,
false,
true).begin()->second;
2552 OutStream <<
"VAR_" << Variable->second->m_OID <<
".m_ScaledVariables.push_back(" <<
"&VAR_" << pScaledVariable->
m_OID <<
");\n";
2561 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CPacket" <<
"PACK_" << GObject->second.m_OID <<
"(&EVC, " << PacketID
2562 <<
", STLVEC_" << GObject->second.m_OID <<
");\n";
2570 OutStream <<
"\n\n\n\n";
2574 for (GGraph = pProject->m_GraphSet.begin(); GGraph != pProject->m_GraphSet.end(); GGraph++)
2577 if (GGraph->second.m_Type == COM_IN)
2580 InDeviceNames.clear();
2583 BaliseInDevices = GGraph->second.Objects(BALISE_IN_DEVICE);
2586 for (BaliseInDevice = BaliseInDevices.begin(); BaliseInDevice != BaliseInDevices.end(); BaliseInDevice++)
2589 if (not GGraph->second.Ports(BaliseInDevice->second,
"telegramOutput").empty())
2592 OutStream <<
"// Balise in device object " << BaliseInDevice->second->m_Type <<
" [" << BaliseInDevice->second->m_ID <<
"] with OID " << BaliseInDevice->second->m_OID
2593 <<
" in graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
2596 OutStream <<
"::std::vector< ::oETCS::DF::CTelegram* > TELEGRAMS_" << BaliseInDevice->second->m_OID <<
"_" << GGraph->second.m_OID <<
";\n";
2599 OutPorts = GGraph->second.Ports(BaliseInDevice->second,
"telegramOutput");
2602 OutRoles = GGraph->second.Roles(BaliseInDevice->second, OutPorts.begin()->second);
2605 for (OutRole = OutRoles.begin(); OutRole != OutRoles.end(); OutRole++)
2608 InRoles = GGraph->second.Roles(OutRoles.begin()->second,
"DataInput");
2611 Telegrams = GGraph->second.Objects(InRoles.begin()->second);
2614 Telegram = Telegrams.begin();
2617 if (Telegram->second->m_pDecomposition != 0)
2620 pTelegramGraph = Telegram->second->m_pDecomposition;
2623 OutStream <<
"::std::vector< ::oETCS::DF::CVariable* > VARVEC_" << Telegram->second->
m_OID <<
"_" << GGraph->second.m_OID <<
";\n";
2626 OutStream <<
"::std::vector< ::oETCS::DF::CPacket* > PACKVEC_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID <<
";\n";
2629 pLeafNode = pTelegramGraph->
Objects(
"LeafNode").begin()->second;
2632 pCurrentNode = pTelegramGraph->
Objects(
"RootNode").begin()->second;
2635 while (pCurrentNode != pLeafNode)
2638 if (pCurrentNode->
m_Type == VARIABLE_INSTANCE_OBJECT)
2641 OutStream <<
"VARVEC_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID <<
".push_back(&VAR_" << pCurrentNode->
m_OID <<
");\n";
2644 else if (pCurrentNode->
m_Type == PACKET_OBJECT)
2647 OutStream <<
"PACKVEC_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID <<
".push_back(&PACK_" << pCurrentNode->
m_OID <<
");\n";
2650 else if (pCurrentNode->
m_Type == ANY_PACKET_OBJECT)
2659 for (Packet = Packets.begin(); Packet != Packets.end(); Packet++)
2662 OutStream <<
"PACKVEC_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID <<
".push_back(&PACK_" << Packet->second->m_OID <<
");\n";
2671 Previous = pTelegramGraph->
Roles(pCurrentNode,
"Previous",
true);
2674 Next = pTelegramGraph->
Roles(Previous.begin()->second,
"Next",
true);
2677 pCurrentNode = pTelegramGraph->
Objects(Next.begin()->second).begin()->second;
2684 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CTelegram" <<
"TEL_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID
2685 <<
"(&EVC, VARVEC_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID <<
", PACKVEC_" << Telegram->second->m_OID <<
"_" << GGraph->second.m_OID
2689 OutStream <<
"TELEGRAMS_" << BaliseInDevice->second->m_OID <<
"_" << GGraph->second.m_OID <<
".push_back(&TEL_"
2690 << Telegrams.begin()->second->m_OID <<
"_" << GGraph->second.m_OID <<
");\n";
2696 OutStream << ::std::left << std::setw(38) <<
"::oETCS::DF::CBaliseDeviceIn" <<
"BALIN_" << BaliseInDevice->second->m_OID <<
"_" << GGraph->second.m_OID
2697 <<
"(TELEGRAMS_" << BaliseInDevice->second->m_OID <<
"_" << GGraph->second.m_OID
2698 <<
", " << (BaliseInDevice->second->Properties(
"IsExternal").begin()->second->m_Value ==
"F" ?
"false" :
"true") <<
");\n";
2702 TempStream <<
"BALIN_" << BaliseInDevice->second->m_OID <<
"_" << GGraph->second.m_OID;
2703 InDeviceNames.push_back(TempStream.str());
2710 OutStream <<
"// vector of balise in devices in graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
2713 OutStream <<
"::std::vector< ::oETCS::DF::CBaliseDeviceIn* > INDEVICES_" << GGraph->second.m_OID <<
";\n";
2716 for (x = 0; x < InDeviceNames.size(); x++)
2719 OutStream <<
"INDEVICES_" << GGraph->second.m_OID <<
".push_back(&" << InDeviceNames[x] <<
");\n";
2724 else if (GGraph->second.m_Type == COM_OUT)
2727 OutDeviceNames.clear();
2730 BaliseOutDevices = GGraph->second.Objects(BALISE_OUT_DEVICE);
2733 for (BaliseOutDevice = BaliseOutDevices.begin(); BaliseOutDevice != BaliseOutDevices.end(); BaliseOutDevice++)
2736 if (not GGraph->second.Ports(BaliseOutDevice->second,
"telegramInput").empty())
2739 OutStream <<
"// Balise out device object " << BaliseOutDevice->second->m_Type <<
" [" << BaliseOutDevice->second->m_ID <<
"] with OID " << BaliseOutDevice->second->m_OID
2740 <<
" in graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
2743 OutStream <<
"::std::vector< ::oETCS::DF::CTelegram* > TELEGRAMS_" << BaliseOutDevice->second->m_OID <<
"_" << GGraph->second.m_OID <<
";\n";
2746 InRoles = GGraph->second.Roles(BaliseOutDevice->second,
"DataInput");
2749 OutRoles = GGraph->second.Roles(OutRoles.begin()->second,
"DataOutput");
2752 Telegrams = GGraph->second.Objects(OutRoles.begin()->second);
2755 OutStream <<
"TELEGRAMS_" << BaliseOutDevice->second->m_OID <<
"_" << GGraph->second.m_OID <<
".push_back(&TEL_"
2756 << Telegrams.begin()->second->m_OID <<
");\n";
2760 TempStream <<
"TELEGRAMS_" << BaliseOutDevice->second->m_OID <<
"_" << GGraph->second.m_OID;
2761 OutDeviceNames.push_back(TempStream.str());
2770 OutStream <<
"// vector of balise oit devices in graph [" << GGraph->second.m_ID <<
"] with OID " << GGraph->second.m_OID <<
"\n";
2773 OutStream <<
"::std::vector< ::oETCS::DF::CBaliseDeviceOut* > OUTDEVICES_" << GGraph->second.m_OID <<
";\n";
2776 for (x = 0; x < OutDeviceNames.size(); x++)
2779 OutStream <<
"OUTDEVICES_" << GGraph->second.m_OID <<
".push_back(&" << OutDeviceNames[x] <<
");\n";
2806 for (Object = pFunctionBlock->m_ObjectSet.begin(); Object != pFunctionBlock->m_ObjectSet.end(); Object++)
2809 if (m_FBMap.find(Object->second->m_Type) != m_FBMap.end())
2815 Inputs = pFunctionBlock->Roles(Object->second,
"DataInput",
false,
false);
2818 for (Input = Inputs.begin(); Input != Inputs.end(); Input++)
2821 pOutput = pFunctionBlock->Roles(Input->second,
"DataOutput",
false,
true).begin()->second;
2824 pOutputNode = pFunctionBlock->Objects(pOutput,
true).begin()->second;
2832 else if (Object->second->m_Type ==
"SubFunction")
2835 if (Object->second->m_pDecomposition != 0)
2838 this->BuildAbstractModel(Object->second->m_pDecomposition, FBNodes);
2856 ::std::time_t Now = ::std::chrono::system_clock::to_time_t(::std::chrono::system_clock::now());
2861 " Copyright (C) 2010-2012\n"
2862 " Johannes Feuser <feuser@uni-bremen.de>\n\n"
2863 " source generated for openETCS EVC by C++ generator\n"
2864 " time point (UTC) of generation: " << ::std::asctime(::std::gmtime(&Now)) <<
"\n"
2866 "// include Qt header\n"
2867 "#include <QtDBus>\n"
2868 "#include <QApplication>\n"
2869 "// include the main header of the openETCS library \n"
2870 "#include \"oETCS/DF/EVCStateMachine.h\"\n"
2871 "#include \"oETCS/DF/Storage.h\"\n"
2872 "#include \"oETCS/DF/FunctionBlocks.h\"\n"
2873 "#include \"oETCS/DF/DriverMachineInterfaceMOC.h\"\n"
2874 "#include \"oETCS/DF/ControlFlow.h\"\n"
2875 "#include \"oETCS/DF/Condition.h\"\n"
2876 "#include \"oETCS/DF/Language.h\"\n"
2877 "#include \"oETCS/DF/PlatformSpecificStubsMOC.h\"\n\n\n"
2878 "int main(int argc, char* argv[])\n"
2880 "// first create a QApplication object for widgets\n"
2881 "QApplication Application(argc, argv);\n\n\n";
2897 OutStream <<
"return (0);\n";
2898 OutStream <<
"} // int main(int argc, char* argv[]\n\n";
2911 bool bIsFunctionBlock(
false);
2913 const unsigned int NUMBER_ELEMENTS(
sizeof(pFunctionBlockTypes));
2921 for (x = 0; x < NUMBER_ELEMENTS && !bIsFunctionBlock; x++)
2924 bIsFunctionBlock = (pObject->m_Type == pFunctionBlockTypes[x]);
2931 return (bIsFunctionBlock);
2944 ::std::string PortType;
2952 if (pPort->m_Type.find(
"bool") != std::string::npos)
2958 else if (pPort->m_Type.find(
"doubleArray") != std::string::npos)
2961 PortType =
"::std::vector< double >";
2964 else if (pPort->m_Type.find(
"double") != std::string::npos)
2967 PortType =
"double";
2970 else if (pPort->m_Type.find(
"int") != std::string::npos)
2976 else if (pPort->m_Type.find(
"string") != std::string::npos)
2979 PortType =
"::std::string";
3000 ::std::string Prefix;
3009 if (pPort->m_Type.find(
"bool") != std::string::npos)
3015 else if (pPort->m_Type.find(
"doubleArray") != std::string::npos)
3021 else if (pPort->m_Type.find(
"double") != std::string::npos)
3027 else if (pPort->m_Type.find(
"int") != std::string::npos)
3033 else if (pPort->m_Type.find(
"string") != std::string::npos)
3063 decltype (Node.m_Inputs.begin()) i;
3064 decltype (ExecutionOrder.begin()) s;
3065 decltype (NodeStack.begin()) ns;
3067 bool bOnStack(
false);
3071 for (ns = NodeStack.begin(); ns != NodeStack.end() && not bOnStack; ns++)
3074 bOnStack = (*ns == &Node);
3083 for (s = ExecutionOrder.begin(); s != ExecutionOrder.end() && not bFound; s++)
3086 bFound = (*s == Node.m_OID);
3092 if (Node.m_Inputs.empty())
3098 ExecutionOrder.push_back(Node.m_OID);
3106 for (i = Node.m_Inputs.begin(); i != Node.m_Inputs.end(); i++)
3109 NodeStack.push_back(&Node);
3115 NodeStack.pop_back();
3123 ExecutionOrder.push_back(Node.m_OID);