Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,33 +108,42 @@ case class ComponentCppWriter (
val internalStrHeaders =
guardedList (hasInternalPorts) (List("Fw/Types/InternalInterfaceString.hpp"))

val standardHeaders = List.concat(
List(
"FpConfig.hpp",
"Fw/Port/InputSerializePort.hpp",
"Fw/Port/OutputSerializePort.hpp",
"Fw/Comp/ActiveComponentBase.hpp"
),
dpHeaders,
mutexHeaders,
cmdStrHeaders,
tlmStrHeaders,
prmStrHeaders,
logStrHeaders,
internalStrHeaders
).map(CppWriter.headerString)
val symbolHeaders = writeIncludeDirectives
val headers = standardHeaders ++ symbolHeaders
linesMember(addBlankPrefix(headers.sorted.flatMap({
case s: "#include \"Fw/Log/LogTextPortAc.hpp\"" =>
lines(
s"""|#if FW_ENABLE_TEXT_LOGGING == 1
|$s
|#endif
|""".stripMargin
)
case s => lines(s)
})))
val systemHeaders = List(
"FpConfig.hpp"
).map(CppWriter.systemHeaderString).sorted.map(line)
val userHeaders = {
val standardHeaders = List.concat(
List(
"Fw/Port/InputSerializePort.hpp",
"Fw/Port/OutputSerializePort.hpp",
"Fw/Comp/ActiveComponentBase.hpp"
),
dpHeaders,
mutexHeaders,
cmdStrHeaders,
tlmStrHeaders,
prmStrHeaders,
logStrHeaders,
internalStrHeaders
).map(CppWriter.headerString)
val symbolHeaders = writeIncludeDirectives
(standardHeaders ++ symbolHeaders).sorted.flatMap({
case s: "#include \"Fw/Log/LogTextPortAc.hpp\"" =>
lines(
s"""|#if FW_ENABLE_TEXT_LOGGING == 1
|$s
|#endif
|""".stripMargin
)
case s => lines(s)
})
}
linesMember(
List.concat(
addBlankPrefix(systemHeaders),
addBlankPrefix(userHeaders)
)
)
}

private def getCppIncludes: CppDoc.Member = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ abstract class ComponentCppWriterUtils(
/** Get the C++ return type of a port instance as a String option */
def getPortReturnType(pi: PortInstance): Option[String] = {
def transformer (sym: Symbol.Port) (node: AstNode[Ast.TypeName]) =
TypeCppWriter.getName(s, s.a.typeMap(node.id))
TypeCppWriter.getName(s, s.a.typeMap(node.id), "Fw::String")
transformPortReturnType(pi, transformer)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ case class PortCppWriter (

private val typeCppWriter = TypeCppWriter(s, "Fw::StringBase")

private val returnTypeCppWriter = TypeCppWriter(s, "Fw::String")

private val formalParamsCppWriter = FormalParamsCppWriter(s)

private val params = data.params
Expand Down Expand Up @@ -58,7 +60,7 @@ case class PortCppWriter (

// Return type as a C++ type
private val returnType = data.returnType match {
case Some(value) => typeCppWriter.write(s.a.typeMap(value.id))
case Some(value) => returnTypeCppWriter.write(s.a.typeMap(value.id))
case None => "void"
}

Expand Down Expand Up @@ -121,27 +123,27 @@ case class PortCppWriter (
val systemHeaders = List(
"cstdio",
"cstring",
"FpConfig.hpp"
).map(CppWriter.systemHeaderString).map(line)
val serializableHeader = data.returnType match {
case Some(_) => Nil
case None => List("Fw/Types/Serializable.hpp")
}
val standardHeaders = (
List(
"FpConfig.hpp",
"Fw/Comp/PassiveComponentBase.hpp",
"Fw/Port/InputPortBase.hpp",
"Fw/Port/OutputPortBase.hpp",
"Fw/Types/StringType.hpp",
"Fw/Types/String.hpp",
) ++ serializableHeader
).map(CppWriter.headerString)
val symbolHeaders = writeIncludeDirectives
val userHeaders = (standardHeaders ++ symbolHeaders).sorted.map(line)
linesMember(
List(
Line.blank :: systemHeaders,
Line.blank :: userHeaders
).flatten
List.concat(
addBlankPrefix(systemHeaders),
addBlankPrefix(userHeaders)
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#ifndef ActiveAsyncProductPortsOnlyComponentAc_HPP
#define ActiveAsyncProductPortsOnlyComponentAc_HPP

#include "FpConfig.hpp"
#include <FpConfig.hpp>

#include "Fw/Comp/ActiveComponentBase.hpp"
#include "Fw/Dp/DpRequestPortAc.hpp"
#include "Fw/Dp/DpResponsePortAc.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,30 @@ void ActiveAsyncProductsComponentBase ::
#endif
}

// Connect input port noArgsStringReturnSync
for (
FwIndexType port = 0;
port < static_cast<FwIndexType>(this->getNum_noArgsStringReturnSync_InputPorts());
port++
) {
this->m_noArgsStringReturnSync_InputPort[port].init();
this->m_noArgsStringReturnSync_InputPort[port].addCallComp(
this,
m_p_noArgsStringReturnSync_in
);
this->m_noArgsStringReturnSync_InputPort[port].setPortNum(port);

#if FW_OBJECT_NAMES == 1
Fw::ObjectName portName;
portName.format(
"%s_noArgsStringReturnSync_InputPort[%" PRI_PlatformIntType "]",
this->m_objName.toChar(),
port
);
this->m_noArgsStringReturnSync_InputPort[port].setObjName(portName.toChar());
#endif
}

// Connect input port noArgsSync
for (
FwIndexType port = 0;
Expand Down Expand Up @@ -893,6 +917,25 @@ void ActiveAsyncProductsComponentBase ::
#endif
}

// Connect output port noArgsStringReturnOut
for (
FwIndexType port = 0;
port < static_cast<FwIndexType>(this->getNum_noArgsStringReturnOut_OutputPorts());
port++
) {
this->m_noArgsStringReturnOut_OutputPort[port].init();

#if FW_OBJECT_NAMES == 1
Fw::ObjectName portName;
portName.format(
"%s_noArgsStringReturnOut_OutputPort[%" PRI_PlatformIntType "]",
this->m_objName.toChar(),
port
);
this->m_noArgsStringReturnOut_OutputPort[port].setObjName(portName.toChar());
#endif
}

// Connect output port typedOut
for (
FwIndexType port = 0;
Expand Down Expand Up @@ -1016,6 +1059,17 @@ Ports::InputNoArgsReturnPort* ActiveAsyncProductsComponentBase ::
return &this->m_noArgsReturnSync_InputPort[portNum];
}

Ports::InputNoArgsStringReturnPort* ActiveAsyncProductsComponentBase ::
get_noArgsStringReturnSync_InputPort(FwIndexType portNum)
{
FW_ASSERT(
portNum < this->getNum_noArgsStringReturnSync_InputPorts(),
static_cast<FwAssertArgType>(portNum)
);

return &this->m_noArgsStringReturnSync_InputPort[portNum];
}

Ports::InputNoArgsPort* ActiveAsyncProductsComponentBase ::
get_noArgsSync_InputPort(FwIndexType portNum)
{
Expand Down Expand Up @@ -1295,6 +1349,20 @@ void ActiveAsyncProductsComponentBase ::
this->m_noArgsReturnOut_OutputPort[portNum].addCallPort(port);
}

void ActiveAsyncProductsComponentBase ::
set_noArgsStringReturnOut_OutputPort(
FwIndexType portNum,
Ports::InputNoArgsStringReturnPort* port
)
{
FW_ASSERT(
portNum < this->getNum_noArgsStringReturnOut_OutputPorts(),
static_cast<FwAssertArgType>(portNum)
);

this->m_noArgsStringReturnOut_OutputPort[portNum].addCallPort(port);
}

void ActiveAsyncProductsComponentBase ::
set_typedOut_OutputPort(
FwIndexType portNum,
Expand Down Expand Up @@ -1558,6 +1626,12 @@ FwIndexType ActiveAsyncProductsComponentBase ::
return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnSync_InputPort));
}

FwIndexType ActiveAsyncProductsComponentBase ::
getNum_noArgsStringReturnSync_InputPorts() const
{
return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsStringReturnSync_InputPort));
}

FwIndexType ActiveAsyncProductsComponentBase ::
getNum_noArgsSync_InputPorts() const
{
Expand Down Expand Up @@ -1696,6 +1770,12 @@ FwIndexType ActiveAsyncProductsComponentBase ::
return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsReturnOut_OutputPort));
}

FwIndexType ActiveAsyncProductsComponentBase ::
getNum_noArgsStringReturnOut_OutputPorts() const
{
return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_noArgsStringReturnOut_OutputPort));
}

FwIndexType ActiveAsyncProductsComponentBase ::
getNum_typedOut_OutputPorts() const
{
Expand Down Expand Up @@ -1852,6 +1932,17 @@ bool ActiveAsyncProductsComponentBase ::
return this->m_noArgsReturnOut_OutputPort[portNum].isConnected();
}

bool ActiveAsyncProductsComponentBase ::
isConnected_noArgsStringReturnOut_OutputPort(FwIndexType portNum)
{
FW_ASSERT(
portNum < this->getNum_noArgsStringReturnOut_OutputPorts(),
static_cast<FwAssertArgType>(portNum)
);

return this->m_noArgsStringReturnOut_OutputPort[portNum].isConnected();
}

bool ActiveAsyncProductsComponentBase ::
isConnected_typedOut_OutputPort(FwIndexType portNum)
{
Expand Down Expand Up @@ -2056,6 +2147,23 @@ U32 ActiveAsyncProductsComponentBase ::
return retVal;
}

Fw::String ActiveAsyncProductsComponentBase ::
noArgsStringReturnSync_handlerBase(FwIndexType portNum)
{
// Make sure port number is valid
FW_ASSERT(
portNum < this->getNum_noArgsStringReturnSync_InputPorts(),
static_cast<FwAssertArgType>(portNum)
);

Fw::String retVal;

// Call handler function
retVal = this->noArgsStringReturnSync_handler(portNum);

return retVal;
}

void ActiveAsyncProductsComponentBase ::
noArgsSync_handlerBase(FwIndexType portNum)
{
Expand Down Expand Up @@ -2821,6 +2929,21 @@ U32 ActiveAsyncProductsComponentBase ::
return this->m_noArgsReturnOut_OutputPort[portNum].invoke();
}

Fw::String ActiveAsyncProductsComponentBase ::
noArgsStringReturnOut_out(FwIndexType portNum)
{
FW_ASSERT(
portNum < this->getNum_noArgsStringReturnOut_OutputPorts(),
static_cast<FwAssertArgType>(portNum)
);

FW_ASSERT(
this->m_noArgsStringReturnOut_OutputPort[portNum].isConnected(),
static_cast<FwAssertArgType>(portNum)
);
return this->m_noArgsStringReturnOut_OutputPort[portNum].invoke();
}

void ActiveAsyncProductsComponentBase ::
typedOut_out(
FwIndexType portNum,
Expand Down Expand Up @@ -3426,6 +3549,17 @@ U32 ActiveAsyncProductsComponentBase ::
return compPtr->noArgsReturnSync_handlerBase(portNum);
}

Fw::String ActiveAsyncProductsComponentBase ::
m_p_noArgsStringReturnSync_in(
Fw::PassiveComponentBase* callComp,
FwIndexType portNum
)
{
FW_ASSERT(callComp);
ActiveAsyncProductsComponentBase* compPtr = static_cast<ActiveAsyncProductsComponentBase*>(callComp);
return compPtr->noArgsStringReturnSync_handlerBase(portNum);
}

void ActiveAsyncProductsComponentBase ::
m_p_noArgsSync_in(
Fw::PassiveComponentBase* callComp,
Expand Down
Loading