corrected uniqueness of json keys, added write as option to json get
This commit is contained in:
@@ -927,11 +927,21 @@ void Message::dumpField(const string& fieldName, bool withConditions, ostream* o
|
||||
dumpAttribute(false, fieldName, output);
|
||||
}
|
||||
|
||||
void Message::decode(bool leadingSeparator, OutputFormat outputFormat, ostringstream* output) const {
|
||||
void Message::decode(bool leadingSeparator, bool appendDirection, OutputFormat outputFormat, ostringstream* output)
|
||||
const {
|
||||
if (leadingSeparator) {
|
||||
*output << ",";
|
||||
}
|
||||
*output << "\n \"" << getName() << "\": {" // TODO include read/write/passive for overlapping names
|
||||
*output << "\n \"" << getName();
|
||||
if (appendDirection) {
|
||||
if (isPassive()) {
|
||||
*output << "-u";
|
||||
} else if (isWrite()) {
|
||||
*output << "-w";
|
||||
}
|
||||
}
|
||||
*output << "\": {"
|
||||
<< "\n \"name\": \"" << getName() << "\""
|
||||
<< "\n \"lastup\": " << setw(0) << dec << static_cast<unsigned>(getLastUpdateTime());
|
||||
if (getLastUpdateTime() != 0) {
|
||||
*output << ",\n \"zz\": \"" << setfill('0') << setw(2) << hex << static_cast<unsigned>(getDstAddress()) << "\"";
|
||||
|
||||
@@ -549,12 +549,14 @@ class Message : public AttributedItem {
|
||||
virtual void dumpField(const string& fieldName, bool withConditions, ostream* output) const;
|
||||
|
||||
/**
|
||||
* Decode the message from the last stored data.
|
||||
* Decode the message from the last stored data in JSON format.
|
||||
* @param leadingSeparator whether to prepend a separator before the first value.
|
||||
* @param appendDirection whether to append the direction to the name key (for passive and write).
|
||||
* @param outputFormat the @a OutputFormat options to use.
|
||||
* @param output the @a ostringstream to append the decoded value(s) to.
|
||||
*/
|
||||
virtual void decode(bool leadingSeparator, OutputFormat outputFormat, ostringstream* output) const;
|
||||
virtual void decode(bool leadingSeparator, bool appendDirection, OutputFormat outputFormat, ostringstream* output)
|
||||
const;
|
||||
|
||||
protected:
|
||||
/** the optional circuit name. */
|
||||
|
||||
Reference in New Issue
Block a user