added since and until params to MessageMap::findAll(), added column constants
This commit is contained in:
+21
-10
@@ -745,7 +745,7 @@ void Message::dump(ostream& output, vector<size_t>* columns, bool withConditions
|
||||
void Message::dumpColumn(ostream& output, size_t column, bool withConditions)
|
||||
{
|
||||
switch (column) {
|
||||
case 0: // type
|
||||
case COLUMN_TYPE: // type
|
||||
if (withConditions && m_condition!=NULL) {
|
||||
m_condition->dump(output);
|
||||
}
|
||||
@@ -761,34 +761,34 @@ void Message::dumpColumn(ostream& output, size_t column, bool withConditions)
|
||||
output << static_cast<unsigned>(m_pollPriority);
|
||||
}
|
||||
break;
|
||||
case 1: // circuit
|
||||
case COLUMN_CIRCUIT: // circuit
|
||||
DataField::dumpString(output, m_circuit, false);
|
||||
break;
|
||||
case 2: // name
|
||||
case COLUMN_NAME: // name
|
||||
DataField::dumpString(output, m_name, false);
|
||||
break;
|
||||
case 3: // comment
|
||||
case COLUMN_COMMENT: // comment
|
||||
DataField::dumpString(output, m_comment, false);
|
||||
break;
|
||||
case 4: // QQ
|
||||
case COLUMN_QQ: // QQ
|
||||
if (m_srcAddress != SYN)
|
||||
output << hex << setw(2) << setfill('0') << static_cast<unsigned>(m_srcAddress);
|
||||
break;
|
||||
case 5: // ZZ
|
||||
case COLUMN_ZZ: // ZZ
|
||||
if (m_dstAddress != SYN)
|
||||
output << hex << setw(2) << setfill('0') << static_cast<unsigned>(m_dstAddress);
|
||||
break;
|
||||
case 6: // PBSB
|
||||
case COLUMN_PBSB: // PBSB
|
||||
for (vector<unsigned char>::const_iterator it = m_id.begin(); it < m_id.begin()+2 && it < m_id.end(); it++) {
|
||||
output << hex << setw(2) << setfill('0') << static_cast<unsigned>(*it);
|
||||
}
|
||||
break;
|
||||
case 7: // ID
|
||||
case COLUMN_ID: // ID
|
||||
for (vector<unsigned char>::const_iterator it = m_id.begin()+2; it < m_id.end(); it++) {
|
||||
output << hex << setw(2) << setfill('0') << static_cast<unsigned>(*it);
|
||||
}
|
||||
break;
|
||||
case 8: // fields
|
||||
case COLUMN_FIELDS: // fields
|
||||
m_data->dump(output);
|
||||
break;
|
||||
}
|
||||
@@ -1898,7 +1898,8 @@ Message* MessageMap::find(const string& circuit, const string& name, const bool
|
||||
|
||||
deque<Message*> MessageMap::findAll(const string& circuit, const string& name, const bool completeMatch,
|
||||
const bool withRead, const bool withWrite, const bool withPassive,
|
||||
const bool completeMatchIgnoreCircuitSuffix, const bool onlyAvailable)
|
||||
const bool completeMatchIgnoreCircuitSuffix, const bool onlyAvailable,
|
||||
const time_t since, const time_t until)
|
||||
{
|
||||
bool checkCircuitIgnoreSuffix = completeMatch && completeMatchIgnoreCircuitSuffix;
|
||||
deque<Message*> ret;
|
||||
@@ -1950,6 +1951,16 @@ deque<Message*> MessageMap::findAll(const string& circuit, const string& name, c
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (since!=0 || until!=0) {
|
||||
if (message->getDstAddress() == SYN) {
|
||||
continue;
|
||||
}
|
||||
time_t lastchg = message->getLastChangeTime();
|
||||
if ((since!=0 && lastchg < since)
|
||||
|| (until!=0 && lastchg >= until)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!onlyAvailable || message->isAvailable()) {
|
||||
ret.push_back(*msgIt);
|
||||
}
|
||||
|
||||
+33
-3
@@ -61,6 +61,33 @@ class SimpleCondition;
|
||||
class CombinedCondition;
|
||||
class MessageMap;
|
||||
|
||||
/** the column index in @a Message::dump() for the message type. */
|
||||
#define COLUMN_TYPE 0
|
||||
|
||||
/** the column index in @a Message::dump() for the circuit name. */
|
||||
#define COLUMN_CIRCUIT 1
|
||||
|
||||
/** the column index in @a Message::dump() for the message name. */
|
||||
#define COLUMN_NAME 2
|
||||
|
||||
/** the column index in @a Message::dump() for the message comment. */
|
||||
#define COLUMN_COMMENT 3
|
||||
|
||||
/** the column index in @a Message::dump() for the source address QQ. */
|
||||
#define COLUMN_QQ 4
|
||||
|
||||
/** the column index in @a Message::dump() for the destination address QQ. */
|
||||
#define COLUMN_ZZ 5
|
||||
|
||||
/** the column index in @a Message::dump() for the PBSB bytes. */
|
||||
#define COLUMN_PBSB 6
|
||||
|
||||
/** the column index in @a Message::dump() for the ID columns (after the PBSB bytes). */
|
||||
#define COLUMN_ID 7
|
||||
|
||||
/** the column index in @a Message::dump() for the field(s). */
|
||||
#define COLUMN_FIELDS 8
|
||||
|
||||
/**
|
||||
* Defines parameters of a message sent or received on the bus.
|
||||
*/
|
||||
@@ -472,7 +499,7 @@ public:
|
||||
/**
|
||||
* Write the message definition or parts of it to the @a ostream.
|
||||
* @param output the @a ostream to append the formatted value to.
|
||||
* @param columns the list of column indexes to write, or NULL for all.
|
||||
* @param columns the list of column indexes to write, or NULL for all (see @p COLUMN_TYPE index constants).
|
||||
* @param withConditions whether to include the optional conditions prefix.
|
||||
*/
|
||||
void dump(ostream& output, vector<size_t>* columns=NULL, bool withConditions=false);
|
||||
@@ -480,7 +507,7 @@ public:
|
||||
/**
|
||||
* Write the specified column to the @a ostream.
|
||||
* @param output the @a ostream to append the formatted value to.
|
||||
* @param column the column indexes to write.
|
||||
* @param column the column index to write (see @p COLUMN_TYPE index constants).
|
||||
* @param withConditions whether to include the optional conditions prefix.
|
||||
*/
|
||||
virtual void dumpColumn(ostream& output, size_t column, bool withConditions);
|
||||
@@ -1242,11 +1269,14 @@ public:
|
||||
* @return the found @a Message instances.
|
||||
* @param completeMatchIgnoreCircuitSuffix ignore different circuit suffixes (after "#") for completeMatch.
|
||||
* @param onlyAvailable true to include only available messages (default true), false to also include messages that are currently not available (e.g. due to unresolved or false conditions).
|
||||
* @param since the start time from which to add updates (inclusive, also removes messages with unset destination address), or 0 to ignore.
|
||||
* @param until the end time to which to add updates (exclusive, also removes messages with unset destination address), or 0 to ignore.
|
||||
* Note: the caller may not free the returned instances.
|
||||
*/
|
||||
deque<Message*> findAll(const string& circuit, const string& name, const bool completeMatch=true,
|
||||
const bool withRead=true, const bool withWrite=false, const bool withPassive=false,
|
||||
const bool completeMatchIgnoreCircuitSuffix=false, const bool onlyAvailable=true);
|
||||
const bool completeMatchIgnoreCircuitSuffix=false, const bool onlyAvailable=true,
|
||||
const time_t since=0, const time_t until=0);
|
||||
|
||||
/**
|
||||
* Find the @a Message instance for the specified master data.
|
||||
|
||||
Reference in New Issue
Block a user