Skip to content

Commit d54f529

Browse files
authored
Merge pull request #1002 from nasa/issue-984-extern-param-defaults
Revise code generation for parameters
2 parents 8d943a2 + 5c7e5bd commit d54f529

52 files changed

Lines changed: 7002 additions & 6203 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriter.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,6 @@ case class ComponentCppWriter (
536536
)
537537
),
538538
List(s"Fw::${kindStr}ComponentBase(compName)") :::
539-
(if (hasExternalParameters) List("paramDelegatePtr(nullptr)") else Nil) :::
540539
smInstancesByName.map { (name, smi) =>
541540
val sm = s.a.stateMachineMap(smi.symbol)
542541
val hasActionsOrGuards = sm.hasActions || sm.hasGuards
@@ -555,9 +554,6 @@ case class ComponentCppWriter (
555554
throttledEventsWithTimeout.map((_, event) => line(
556555
s"this->${eventThrottleTimeName(event.getName)} = Fw::Time();"
557556
)),
558-
sortedParams.flatMap((_, param) => guardedList(!param.isExternal) (
559-
lines(s"this->${paramValidityFlagName(param.getName)} = Fw::ParamValid::UNINIT;")
560-
))
561557
)
562558
)
563559
),

compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentCppWriterUtils.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,19 @@ abstract class ComponentCppWriterUtils(
964964
CppDoc.Function.PureVirtual
965965
)
966966

967+
def getValidityFlagForParam(param: Param) = {
968+
val paramName = param.getName
969+
val flagName = paramValidityFlagName(paramName)
970+
linesClassMember(
971+
lines(
972+
s"""|
973+
|//! The validity flag for $paramName
974+
|Fw::ParamValid $flagName = Fw::ParamValid::UNINIT;
975+
|"""
976+
)
977+
)
978+
}
979+
967980
/** Writes the type of a state machine implementation */
968981
def writeStateMachineImplType(smSymbol: Symbol.StateMachine) =
969982
StateMachine.getSymbolKind(smSymbol) match {

0 commit comments

Comments
 (0)