Skip to content

Commit

Permalink
Revise topology code gen
Browse files Browse the repository at this point in the history
Use fully-qualified names for instance defs
  • Loading branch information
bocchino committed Nov 19, 2024
1 parent 2753fd4 commit 46a2b58
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,8 @@ abstract class TopologyCppWriterUtils(
def getComponentNameAsQualIdent(ci: ComponentInstance): String =
getNameAsQualIdent(getComponentName(ci))

def getShortName(name: Name.Qualified): Name.Qualified = {
val ens = s.a.getEnclosingNames(symbol)
name.shortName(ens)
}

def getNameAsQualIdent(name: Name.Qualified): String =
CppWriter.writeQualifiedName(getShortName(name))
CppWriter.writeQualifiedName(name)

def getSpecifierForPhase (phase: Int) (ci: ComponentInstance):
Option[InitSpecifier] = ci.initSpecifierMap.get(phase)
Expand Down
6 changes: 3 additions & 3 deletions compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace M {

Active active1(FW_OPTIONAL_NAME("active1"));
M::Active active1(FW_OPTIONAL_NAME("active1"));

}

Expand All @@ -23,13 +23,13 @@ namespace M {

namespace M {

Active active3(FW_OPTIONAL_NAME("active3"));
M::Active active3(FW_OPTIONAL_NAME("active3"));

}

namespace M {

Passive passive1(FW_OPTIONAL_NAME("passive1"));
M::Passive passive1(FW_OPTIONAL_NAME("passive1"));

}

Expand Down
8 changes: 4 additions & 4 deletions compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@
namespace M {

//! active1
extern Active active1;
extern M::Active active1;

}

namespace M {

//! active2
extern Active active2;
extern M::Active active2;

}

namespace M {

//! active3
extern Active active3;
extern M::Active active3;

}

namespace M {

//! passive1
extern Passive passive1;
extern M::Passive passive1;

}

Expand Down
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

namespace M {

C c1(FW_OPTIONAL_NAME("c1"));
M::C c1(FW_OPTIONAL_NAME("c1"));

}

namespace M {

C c2(FW_OPTIONAL_NAME("c2"));
M::C c2(FW_OPTIONAL_NAME("c2"));

}

Expand Down
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
namespace M {

//! c1
extern C c1;
extern M::C c1;

}

namespace M {

//! c2
extern C c2;
extern M::C c2;

}

Expand Down
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

namespace M {

C c1(FW_OPTIONAL_NAME("c1"));
M::C c1(FW_OPTIONAL_NAME("c1"));

}

namespace M {

C c2(FW_OPTIONAL_NAME("c2"));
M::C c2(FW_OPTIONAL_NAME("c2"));

}

Expand Down
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
namespace M {

//! c1
extern C c1;
extern M::C c1;

}

namespace M {

//! c2
extern C c2;
extern M::C c2;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Component instances
// ----------------------------------------------------------------------

N::O::C c(FW_OPTIONAL_NAME("c"));
M::N::O::C c(FW_OPTIONAL_NAME("c"));

namespace M {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// ----------------------------------------------------------------------

//! c
extern N::O::C c;
extern M::N::O::C c;

namespace M {

Expand Down
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

namespace M {

C c1(FW_OPTIONAL_NAME("c1"));
M::C c1(FW_OPTIONAL_NAME("c1"));

}

namespace M {

C c2(FW_OPTIONAL_NAME("c2"));
M::C c2(FW_OPTIONAL_NAME("c2"));

}

Expand Down
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
namespace M {

//! c1
extern C c1;
extern M::C c1;

}

namespace M {

//! c2
extern C c2;
extern M::C c2;

}

Expand Down

0 comments on commit 46a2b58

Please sign in to comment.