Page MenuHomePhorge

attach_modules.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

attach_modules.cpp

#include "attach_modules.h"
#include <cstdio>
//#include "rlutil.h"
// using namespace rlutil;
bool attach_historyModuleToSensorSlotInAgent(Agent *agent, Sensor *sensor,
Channel *inputPort,
HistoryModule *historyModule) {
if (agent != NULL && inputPort != NULL && historyModule != NULL) {
SensorSlotOfAgent *sensorSlotOfAgent =
agent->get_sensorHandlerOfAgent()->get_sensorSlotAddress(inputPort);
if (sensorSlotOfAgent != NULL) {
printf(" > HistoryModule ");
// setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", historyModule->get_name());
// setColor(TXTCOLOR_GREY);
printf("(id: %03u) ", historyModule->get_id());
if (sensorSlotOfAgent->set_historyModule(historyModule)) {
// setColor(TXTCOLOR_LIGHTGREEN);
printf("attached ");
// setColor(TXTCOLOR_GREY);
printf("to Sensor ");
// setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", sensor->get_name());
// setColor(TXTCOLOR_GREY);
printf("(id: %03u) in Agent ", sensor->get_id());
// setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", agent->get_name());
// setColor(TXTCOLOR_GREY);
printf("(id: %03u)\n", agent->get_id());
return true;
} else {
// setColor(TXTCOLOR_LIGHTRED);
printf("Couldn't attach the HistoryModule!\n");
// setColor(TXTCOLOR_GREY);
}
} else {
// setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the HistoryModule because Sensor isn't "
"mounted in %s (id: %03u)!\n",
agent->get_name(), agent->get_id());
// setColor(TXTCOLOR_GREY);
}
} else {
// setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the HistoryModule because Agent, Channel, or "
"HistoryModule is not valid!\n");
// setColor(TXTCOLOR_GREY);
}
return false;
}

File Metadata

Mime Type
text/x-c
Expires
Sun, Mar 1, 10:25 PM (11 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
283040
Default Alt Text
attach_modules.cpp (1 KB)

Event Timeline