Skip to content

Commit 9ad2fab

Browse files
authored
Merge pull request #671 from nasa/issue-569-fprime-tlm-pkts
Fix to code generation for telemetry packets
2 parents 6e97646 + b0f83ec commit 9ad2fab

21 files changed

+633
-13
lines changed

compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopTlmPacketIncludes.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ case class TopTlmPacketIncludes(
1919
CppWriter.headerString(getIncludePath(tps))
2020

2121
private def getIncludePath(tps: TlmPacketSet): String = {
22-
val fileNameBase = ComputeCppFiles.FileNames.getTlmPacketSet(tps.getName)
22+
val t = s.a.topologyMap(Symbol.Topology(aNode))
23+
val tpsName = s"${t.getName}_${tps.getName}"
24+
val fileNameBase = ComputeCppFiles.FileNames.getTlmPacketSet(tpsName)
2325
val fileName = s"$fileNameBase.hpp"
2426
s.getRelativePath(fileName).toString
2527
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ case class TopologyCppWriter(
6666
TopConfigObjects(s, aNode).getHppLines
6767
)
6868
val cppLines = linesMember(
69-
Line.blank :: addBlankPostfix(TopConfigObjects(s, aNode).getCppLines),
69+
TopConfigObjects(s, aNode).getCppLines,
7070
CppDoc.Lines.Cpp
7171
)
7272
val (helperFnNames, helperFns) = TopHelperFns(s, aNode).getMembers

compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ M::Active active1(FW_OPTIONAL_NAME("active1"));
3737

3838
namespace M {
3939

40-
4140
// ----------------------------------------------------------------------
4241
// Component configuration objects
4342
// ----------------------------------------------------------------------
@@ -50,7 +49,6 @@ namespace M {
5049

5150
}
5251

53-
5452
// ----------------------------------------------------------------------
5553
// Helper functions
5654
// ----------------------------------------------------------------------

compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace M {
2424

2525
namespace M {
2626

27-
2827
// ----------------------------------------------------------------------
2928
// Helper functions
3029
// ----------------------------------------------------------------------

compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace M {
3030

3131
namespace M {
3232

33-
3433
// ----------------------------------------------------------------------
3534
// Component configuration objects
3635
// ----------------------------------------------------------------------
@@ -54,7 +53,6 @@ namespace M {
5453

5554
}
5655

57-
5856
// ----------------------------------------------------------------------
5957
// Helper functions
6058
// ----------------------------------------------------------------------

compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ M::N::O::C c(FW_OPTIONAL_NAME("c"));
1414

1515
namespace M {
1616

17-
1817
// ----------------------------------------------------------------------
1918
// Helper functions
2019
// ----------------------------------------------------------------------
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// ======================================================================
2+
// \title NoInstancesTopologyAc.cpp
3+
// \author Generated by fpp-to-cpp
4+
// \brief cpp file for NoInstances topology
5+
// ======================================================================
6+
7+
#include "NoInstancesTopologyAc.hpp"
8+
9+
// ----------------------------------------------------------------------
10+
// Helper functions
11+
// ----------------------------------------------------------------------
12+
13+
void initComponents(const TopologyState& state) {
14+
// Nothing to do
15+
}
16+
17+
void configComponents(const TopologyState& state) {
18+
// Nothing to do
19+
}
20+
21+
void setBaseIds() {
22+
// Nothing to do
23+
}
24+
25+
void connectComponents() {
26+
// Nothing to do
27+
}
28+
29+
void regCommands() {
30+
// Nothing to do
31+
}
32+
33+
void readParameters() {
34+
// Nothing to do
35+
}
36+
37+
void loadParameters() {
38+
// Nothing to do
39+
}
40+
41+
void startTasks(const TopologyState& state) {
42+
// Nothing to do
43+
}
44+
45+
void stopTasks(const TopologyState& state) {
46+
// Nothing to do
47+
}
48+
49+
void freeThreads(const TopologyState& state) {
50+
// Nothing to do
51+
}
52+
53+
void tearDownComponents(const TopologyState& state) {
54+
// Nothing to do
55+
}
56+
57+
// ----------------------------------------------------------------------
58+
// Setup and teardown functions
59+
// ----------------------------------------------------------------------
60+
61+
void setup(const TopologyState& state) {
62+
initComponents(state);
63+
configComponents(state);
64+
setBaseIds();
65+
connectComponents();
66+
regCommands();
67+
readParameters();
68+
loadParameters();
69+
startTasks(state);
70+
}
71+
72+
void teardown(const TopologyState& state) {
73+
stopTasks(state);
74+
freeThreads(state);
75+
tearDownComponents(state);
76+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// ======================================================================
2+
// \title NoInstancesTopologyAc.hpp
3+
// \author Generated by fpp-to-cpp
4+
// \brief hpp file for NoInstances topology
5+
// ======================================================================
6+
7+
#ifndef NoInstancesTopologyAc_HPP
8+
#define NoInstancesTopologyAc_HPP
9+
10+
#include "NoInstancesTopologyDefs.hpp"
11+
#include "NoInstances_P1TlmPacketsAc.hpp"
12+
#include "NoInstances_P2TlmPacketsAc.hpp"
13+
14+
// ----------------------------------------------------------------------
15+
// Helper functions
16+
// ----------------------------------------------------------------------
17+
18+
//! Initialize components
19+
void initComponents(
20+
const TopologyState& state //!< The topology state
21+
);
22+
23+
//! Configure components
24+
void configComponents(
25+
const TopologyState& state //!< The topology state
26+
);
27+
28+
//! Set component base Ids
29+
void setBaseIds();
30+
31+
//! Connect components
32+
void connectComponents();
33+
34+
//! Register commands
35+
void regCommands();
36+
37+
//! Read parameters
38+
void readParameters();
39+
40+
//! Load parameters
41+
void loadParameters();
42+
43+
//! Start tasks
44+
void startTasks(
45+
const TopologyState& state //!< The topology state
46+
);
47+
48+
//! Stop tasks
49+
void stopTasks(
50+
const TopologyState& state //!< The topology state
51+
);
52+
53+
//! Free threads
54+
void freeThreads(
55+
const TopologyState& state //!< The topology state
56+
);
57+
58+
//! Tear down components
59+
void tearDownComponents(
60+
const TopologyState& state //!< The topology state
61+
);
62+
63+
// ----------------------------------------------------------------------
64+
// Setup and teardown functions
65+
// ----------------------------------------------------------------------
66+
67+
//! Set up the topology
68+
void setup(
69+
const TopologyState& state //!< The topology state
70+
);
71+
72+
//! Tear down the topology
73+
void teardown(
74+
const TopologyState& state //!< The topology state
75+
);
76+
77+
#endif

compiler/tools/fpp-to-cpp/test/top/NoNamespaceTopologyAc.ref.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include "NoNamespaceTopologyAc.hpp"
88

9-
109
// ----------------------------------------------------------------------
1110
// Helper functions
1211
// ----------------------------------------------------------------------
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// ======================================================================
2+
// \title OneInstanceTopologyAc.cpp
3+
// \author Generated by fpp-to-cpp
4+
// \brief cpp file for OneInstance topology
5+
// ======================================================================
6+
7+
#include "OneInstanceTopologyAc.hpp"
8+
9+
// ----------------------------------------------------------------------
10+
// Component instances
11+
// ----------------------------------------------------------------------
12+
13+
namespace M {
14+
15+
C c1(FW_OPTIONAL_NAME("c1"));
16+
17+
}
18+
19+
namespace M {
20+
21+
// ----------------------------------------------------------------------
22+
// Helper functions
23+
// ----------------------------------------------------------------------
24+
25+
void initComponents(const TopologyState& state) {
26+
M::c1.init(InstanceIds::M_c1);
27+
}
28+
29+
void configComponents(const TopologyState& state) {
30+
// Nothing to do
31+
}
32+
33+
void setBaseIds() {
34+
M::c1.setIdBase(BaseIds::M_c1);
35+
}
36+
37+
void connectComponents() {
38+
// Nothing to do
39+
}
40+
41+
void regCommands() {
42+
// Nothing to do
43+
}
44+
45+
void readParameters() {
46+
// Nothing to do
47+
}
48+
49+
void loadParameters() {
50+
// Nothing to do
51+
}
52+
53+
void startTasks(const TopologyState& state) {
54+
// Nothing to do
55+
}
56+
57+
void stopTasks(const TopologyState& state) {
58+
// Nothing to do
59+
}
60+
61+
void freeThreads(const TopologyState& state) {
62+
// Nothing to do
63+
}
64+
65+
void tearDownComponents(const TopologyState& state) {
66+
// Nothing to do
67+
}
68+
69+
// ----------------------------------------------------------------------
70+
// Setup and teardown functions
71+
// ----------------------------------------------------------------------
72+
73+
void setup(const TopologyState& state) {
74+
initComponents(state);
75+
configComponents(state);
76+
setBaseIds();
77+
connectComponents();
78+
regCommands();
79+
readParameters();
80+
loadParameters();
81+
startTasks(state);
82+
}
83+
84+
void teardown(const TopologyState& state) {
85+
stopTasks(state);
86+
freeThreads(state);
87+
tearDownComponents(state);
88+
}
89+
90+
}

0 commit comments

Comments
 (0)