Skip to content

Commit

Permalink
Rename for types and add names
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Kuzin authored and aleksandr-kuzin committed Nov 15, 2024
1 parent b13e81e commit 417c798
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 19 deletions.
5 changes: 3 additions & 2 deletions asam_cmp_capture_module/src/capture_module_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ FunctionBlockPtr CaptureModuleFb::create(const ContextPtr& ctx, const ComponentP

FunctionBlockTypePtr CaptureModuleFb::CreateType()
{
return FunctionBlockType("asam_cmp_capture_module", "AsamCmpCaptureModule", "ASAM CMP Capture Module");
return FunctionBlockType("AsamCmpCaptureModule", "AsamCmpCaptureModule", "ASAM CMP Capture Module");
}

void CaptureModuleFb::createFbs()
{
const StringPtr captureModuleId = "asam_cmp_capture";
const StringPtr captureModuleId = "Capture";
CaptureFbInit init{ethernetWrapper, selectedEthernetDeviceName};
auto newFb = createWithImplementation<IFunctionBlock, CaptureFb>(
context, functionBlocks, captureModuleId, init);
newFb.setName("Capture");
functionBlocks.addItem(newFb);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CaptureCommonFbImpl<Interfaces...>::CaptureCommonFbImpl(const ContextPtr& ctx, c
template <typename... Interfaces>
FunctionBlockTypePtr CaptureCommonFbImpl<Interfaces...>::CreateType()
{
return FunctionBlockType("asam_cmp_capture", "AsamCmpCapture", "ASAM CMP Capture");
return FunctionBlockType("AsamCmpCapture", "AsamCmpCapture", "ASAM CMP Capture");
}

template <typename... Interfaces>
Expand Down Expand Up @@ -151,8 +151,10 @@ FunctionBlockPtr CaptureCommonFbImpl<Interfaces...>::addInterfaceWithParams(uint
throw std::runtime_error("Adding interfaces is disabled during update");
InterfaceCommonInit init{interfaceId, &interfaceIdManager};

StringPtr fbId = fmt::format("asam_cmp_interface_{}", createdInterfaces++);
StringPtr fbName = fmt::format("Interface {}", createdInterfaces);
StringPtr fbId = fmt::format("Interface_{}", createdInterfaces++);
auto newFb = createWithImplementation<IFunctionBlock, Impl>(this->context, this->functionBlocks, fbId, init, std::forward<Params>(params)...);
newFb.setName(fbName);
this->functionBlocks.addItem(newFb);
interfaceIdManager.addId(interfaceId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ FunctionBlockPtr InterfaceCommonFb::addStreamWithParams(uint8_t streamId, Params

StreamCommonInit init{streamId, payloadType, &streamIdManager};

StringPtr fbId = fmt::format("asam_cmp_stream_{}", createdStreams++);
StringPtr fbName = fmt::format("Stream {}", createdStreams);
StringPtr fbId = fmt::format("Stream_{}", createdStreams++);
auto newFb = createWithImplementation<IFunctionBlock, Impl>(context, functionBlocks, fbId, init, std::forward<Params>(params)...);
newFb.setName(fbName);
functionBlocks.addItem(newFb);
streamIdManager.addId(streamId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ StreamCommonFbImpl<Interfaces...>::StreamCommonFbImpl(const ContextPtr& ctx,
template <typename... Interfaces>
FunctionBlockTypePtr StreamCommonFbImpl<Interfaces...>::CreateType()
{
return FunctionBlockType("asam_cmp_stream", "AsamCmpStream", "ASAM CMP Stream");
return FunctionBlockType("AsamCmpStream", "AsamCmpStream", "ASAM CMP Stream");
}

template <typename... Interfaces>
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_common_lib/src/interface_common_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ InterfaceCommonFb::InterfaceCommonFb(const ContextPtr& ctx,

FunctionBlockTypePtr InterfaceCommonFb::CreateType()
{
return FunctionBlockType("asam_cmp_interface", "AsamCmpInterface", "ASAM CMP Interface");
return FunctionBlockType("AsamCmpInterface", "AsamCmpInterface", "ASAM CMP Interface");
}

void InterfaceCommonFb::initProperties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DataSinkFb final : public FunctionBlock
void removeCaptureModule(int fbIndex);

[[nodiscard]] static StringPtr getFbId(size_t id);
[[nodiscard]] static StringPtr getFbName(size_t id);

private:
size_t captureModuleId{0};
Expand Down
9 changes: 7 additions & 2 deletions asam_cmp_data_sink/src/data_sink_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DataSinkFb::DataSinkFb(const ContextPtr& ctx,

FunctionBlockTypePtr DataSinkFb::CreateType()
{
return FunctionBlockType("asam_cmp_data_sink", "AsamCmpDataSink", "ASAM CMP Data Sink");
return FunctionBlockType("AsamCmpDataSink", "AsamCmpDataSink", "ASAM CMP Data Sink");
}

void DataSinkFb::addCaptureModuleFromStatus(int index)
Expand Down Expand Up @@ -72,7 +72,12 @@ void DataSinkFb::removeCaptureModule(int fbIndex)

StringPtr DataSinkFb::getFbId(size_t id)
{
return fmt::format("asam_cmp_capture_{}", id);
return fmt::format("Capture_{}", id);
}

StringPtr DataSinkFb::getFbName(size_t id)
{
return fmt::format("Capture {}", id);
}

void DataSinkFb::initProperties()
Expand Down
6 changes: 3 additions & 3 deletions asam_cmp_data_sink/src/data_sink_module_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ void DataSinkModuleFb::networkAdapterChangedInternal()

FunctionBlockTypePtr DataSinkModuleFb::CreateType()
{
return FunctionBlockType("asam_cmp_data_sink_module", "AsamCmpDataSinkModule", "ASAM CMP Data Sink Module");
return FunctionBlockType("AsamCmpDataSinkModule", "AsamCmpDataSinkModule", "ASAM CMP Data Sink Module");
}

void DataSinkModuleFb::createFbs()
{
const StringPtr statusId = "asam_cmp_status";
const StringPtr statusId = "Status";
auto newFb = createWithImplementation<IFunctionBlock, StatusFbImpl>(context, functionBlocks, statusId);
functionBlocks.addItem(newFb);
auto statusMt = functionBlocks.getItems()[0].asPtr<IStatusHandler>(true)->getStatusMt();

const StringPtr dataSinkId = "asam_cmp_data_sink";
const StringPtr dataSinkId = "DataSink";
newFb = createWithImplementation<IFunctionBlock, DataSinkFb>(
context, functionBlocks, dataSinkId, statusMt, dataPacketsPublisher, capturePacketsPublisher);
functionBlocks.addItem(newFb);
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/src/status_fb_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ StatusFbImpl::StatusFbImpl(const ContextPtr& ctx, const ComponentPtr& parent, co

FunctionBlockTypePtr StatusFbImpl::CreateType()
{
return FunctionBlockType("asam_cmp_status", "AsamCmpStatus", "ASAM CMP Status");
return FunctionBlockType("AsamCmpStatus", "AsamCmpStatus", "ASAM CMP Status");
}

void StatusFbImpl::processStatusPacket(const std::shared_ptr<ASAM::CMP::Packet>& packet)
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/tests/test_capture_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEST_F(CaptureFbTest, CreateCaptureModule)
TEST_F(CaptureFbTest, FunctionBlockType)
{
auto type = captureFb.getFunctionBlockType();
ASSERT_EQ(type.getId(), "asam_cmp_capture");
ASSERT_EQ(type.getId(), "AsamCmpCapture");
ASSERT_EQ(type.getName(), "AsamCmpCapture");
ASSERT_EQ(type.getDescription(), "ASAM CMP Capture");
}
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/tests/test_data_sink_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ TEST_F(DataSinkFbTest, NotNull)
TEST_F(DataSinkFbTest, FunctionBlockType)
{
auto type = funcBlock.getFunctionBlockType();
ASSERT_EQ(type.getId(), "asam_cmp_data_sink");
ASSERT_EQ(type.getId(), "AsamCmpDataSink");
ASSERT_EQ(type.getName(), "AsamCmpDataSink");
ASSERT_EQ(type.getDescription(), "ASAM CMP Data Sink");
}
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/tests/test_data_sink_module_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TEST_F(DataSinkModuleFbTest, NotNull)
TEST_F(DataSinkModuleFbTest, FunctionBlockType)
{
auto type = funcBlock.getFunctionBlockType();
ASSERT_EQ(type.getId(), "asam_cmp_data_sink_module");
ASSERT_EQ(type.getId(), "AsamCmpDataSinkModule");
ASSERT_EQ(type.getName(), "AsamCmpDataSinkModule");
ASSERT_EQ(type.getDescription(), "ASAM CMP Data Sink Module");
}
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/tests/test_interface_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST_F(InterfaceFbTest, NotNull)
TEST_F(InterfaceFbTest, FunctionBlockType)
{
auto type = interfaceFb.getFunctionBlockType();
ASSERT_EQ(type.getId(), "asam_cmp_interface");
ASSERT_EQ(type.getId(), "AsamCmpInterface");
ASSERT_EQ(type.getName(), "AsamCmpInterface");
ASSERT_EQ(type.getDescription(), "ASAM CMP Interface");
}
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/tests/test_status_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST_F(StatusFbTest, NotNull)
TEST_F(StatusFbTest, FunctionBlockType)
{
auto type = funcBlock.getFunctionBlockType();
ASSERT_EQ(type.getId(), "asam_cmp_status");
ASSERT_EQ(type.getId(), "AsamCmpStatus");
ASSERT_EQ(type.getName(), "AsamCmpStatus");
ASSERT_EQ(type.getDescription(), "ASAM CMP Status");
}
Expand Down
2 changes: 1 addition & 1 deletion asam_cmp_data_sink/tests/test_stream_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST_F(StreamFbTest, NotNull)
TEST_F(StreamFbTest, FunctionBlockType)
{
auto type = funcBlock.getFunctionBlockType();
ASSERT_EQ(type.getId(), "asam_cmp_stream");
ASSERT_EQ(type.getId(), "AsamCmpStream");
ASSERT_EQ(type.getName(), "AsamCmpStream");
ASSERT_EQ(type.getDescription(), "ASAM CMP Stream");
}
Expand Down

0 comments on commit 417c798

Please sign in to comment.