Page MenuHomePhorge

attach_modulesToTestbench.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

attach_modulesToTestbench.cpp

#include "attach_modulesToTestbench.h"
#include "rlutil.h"
#include "SensorSlotOfTestbench.h"
#define PRINT
using namespace rlutil;
bool attach_csvReaderModuleToSensorSlotInAgent(Testbench* testbench, Sensor* sensor, CSVreaderModule* csvReaderModule) {
if(testbench != NULL && sensor != NULL && csvReaderModule != NULL) {
SensorSlotOfTestbench* sensorSlot = testbench->get_sensorSlotAddressOfTestbench(sensor);
if(sensorSlot != NULL) {
#ifdef PRINT
printf(" > CSV-Reader ");
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", csvReaderModule->get_name().c_str());
setColor(TXTCOLOR_GREY);
printf("(id: %03u) ", csvReaderModule->get_id());
#endif // PRINT
if(sensorSlot->set_csvReaderModule(csvReaderModule)) {
#ifdef PRINT
setColor(TXTCOLOR_LIGHTGREEN);
printf("attached ");
setColor(TXTCOLOR_GREY);
printf("to Sensor ");
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", sensor->get_name().c_str());
setColor(TXTCOLOR_GREY);
printf("(id: %03u) in Testbench ", sensor->get_id());
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", testbench->get_name().c_str());
setColor(TXTCOLOR_GREY);
printf("(id: %03u)\n", testbench->get_id());
#endif // PRINT
return true;
}
else {
#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf("Couldn't attach the CSVreaderModule!\n");
setColor(TXTCOLOR_GREY);
#endif // PRINT
}
}
else {
#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the CSVreaderModule because Sensor isn't registered in %s (id: %03u)!\n", testbench->get_name().c_str(), testbench->get_id());
setColor(TXTCOLOR_GREY);
#endif // PRINT
}
}
else {
#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the CSVreaderModule because Testbench, Sensorm or CSVreaderModule is not valid!\n");
setColor(TXTCOLOR_GREY);
#endif // PRINT
}
return false;
}

File Metadata

Mime Type
text/x-c
Expires
Sun, Mar 1, 10:18 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287627
Default Alt Text
attach_modulesToTestbench.cpp (1 KB)

Event Timeline