add reason for load instruction
This commit is contained in:
@@ -1145,6 +1145,6 @@ void BusHandler::setScanConfigLoaded(unsigned char address, string file) {
|
|||||||
m_seenAddresses[address] |= LOAD_INIT;
|
m_seenAddresses[address] |= LOAD_INIT;
|
||||||
if (!file.empty()) {
|
if (!file.empty()) {
|
||||||
m_seenAddresses[address] |= LOAD_DONE;
|
m_seenAddresses[address] |= LOAD_DONE;
|
||||||
m_messages->addLoadedFile(address, file);
|
m_messages->addLoadedFile(address, file, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1454,7 +1454,7 @@ string Instruction::getDestination()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
result_t LoadInstruction::execute(MessageMap* messages, ostringstream& log) {
|
result_t LoadInstruction::execute(MessageMap* messages, ostringstream& log, Condition* condition) {
|
||||||
result_t result = messages->readFromFile(m_filename, false, m_defaultDest, m_defaultCircuit, m_defaultSuffix);
|
result_t result = messages->readFromFile(m_filename, false, m_defaultDest, m_defaultCircuit, m_defaultSuffix);
|
||||||
if (log.tellp()>0) {
|
if (log.tellp()>0) {
|
||||||
log << ", ";
|
log << ", ";
|
||||||
@@ -1475,7 +1475,13 @@ result_t LoadInstruction::execute(MessageMap* messages, ostringstream& log) {
|
|||||||
} else {
|
} else {
|
||||||
filename = m_filename.substr(pos+1);
|
filename = m_filename.substr(pos+1);
|
||||||
}
|
}
|
||||||
messages->addLoadedFile(address, filename);
|
string comment;
|
||||||
|
if (condition) {
|
||||||
|
ostringstream out;
|
||||||
|
condition->dump(out);
|
||||||
|
comment = out.str();
|
||||||
|
}
|
||||||
|
messages->addLoadedFile(address, filename, comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1780,7 +1786,7 @@ result_t MessageMap::executeInstructions(ostringstream& log, void (*readMessageF
|
|||||||
if (instruction->isSingleton()) {
|
if (instruction->isSingleton()) {
|
||||||
removeSingletons = true;
|
removeSingletons = true;
|
||||||
}
|
}
|
||||||
result_t result = instruction->execute(this, log);
|
result_t result = instruction->execute(this, log, condition);
|
||||||
if (result!=RESULT_OK) {
|
if (result!=RESULT_OK) {
|
||||||
overallResult = result;
|
overallResult = result;
|
||||||
}
|
}
|
||||||
@@ -1813,13 +1819,19 @@ result_t MessageMap::executeInstructions(ostringstream& log, void (*readMessageF
|
|||||||
return overallResult;
|
return overallResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageMap::addLoadedFile(unsigned char address, string file)
|
void MessageMap::addLoadedFile(unsigned char address, string file, string comment)
|
||||||
{
|
{
|
||||||
if (file.empty()) return;
|
if (!file.empty()) {
|
||||||
if (m_loadedFiles.find(address)==m_loadedFiles.end())
|
string fileComment = "\""+file+"\"";
|
||||||
m_loadedFiles[address] = "\""+file+"\"";
|
if (!comment.empty()) {
|
||||||
else
|
fileComment += " ("+comment+")";
|
||||||
m_loadedFiles[address] += ", \""+file+"\"";
|
}
|
||||||
|
if (m_loadedFiles.find(address)==m_loadedFiles.end()) {
|
||||||
|
m_loadedFiles[address] = fileComment;
|
||||||
|
} else {
|
||||||
|
m_loadedFiles[address] += fileComment;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string MessageMap::getLoadedFiles(unsigned char address)
|
string MessageMap::getLoadedFiles(unsigned char address)
|
||||||
|
|||||||
@@ -1041,9 +1041,10 @@ public:
|
|||||||
* Execute the instruction.
|
* Execute the instruction.
|
||||||
* @param messages the @a MessageMap.
|
* @param messages the @a MessageMap.
|
||||||
* @param log the @a ostringstream to log success messages to (if necessary).
|
* @param log the @a ostringstream to log success messages to (if necessary).
|
||||||
|
* @param condition the @a Condition that was successfully evaluated for execution, or NULL.
|
||||||
* @return @a RESULT_OK on success, or an error code.
|
* @return @a RESULT_OK on success, or an error code.
|
||||||
*/
|
*/
|
||||||
virtual result_t execute(MessageMap* messages, ostringstream& log) = 0;
|
virtual result_t execute(MessageMap* messages, ostringstream& log, Condition* condition) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -1092,7 +1093,7 @@ public:
|
|||||||
virtual ~LoadInstruction() { }
|
virtual ~LoadInstruction() { }
|
||||||
|
|
||||||
// @copydoc
|
// @copydoc
|
||||||
virtual result_t execute(MessageMap* messages, ostringstream& log);
|
virtual result_t execute(MessageMap* messages, ostringstream& log, Condition* condition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -1190,8 +1191,9 @@ public:
|
|||||||
* Add a loaded file to a participant.
|
* Add a loaded file to a participant.
|
||||||
* @param address the slave address.
|
* @param address the slave address.
|
||||||
* @param file the name of the file from which a configuration part was loaded for the participant.
|
* @param file the name of the file from which a configuration part was loaded for the participant.
|
||||||
|
* @param comment an optional comment.
|
||||||
*/
|
*/
|
||||||
void addLoadedFile(unsigned char address, string file);
|
void addLoadedFile(unsigned char address, string file, string comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the loaded files for a participant.
|
* Get the loaded files for a participant.
|
||||||
|
|||||||
Reference in New Issue
Block a user