#include "dbcc/message.h" #include #include #include namespace ad { namespace dbcc { std::istream& operator>>(std::istream& in, Message& msg) { // Parse the message ID. in >> msg.id_; // Parse the name of the message std::string name; in >> name; msg.name_ = name.substr(0, name.length() - 1); // Parse the message length in >> msg.dlc_; // Parse the sender in >> msg.from_; in.ignore(std::numeric_limits::max(), '\n'); // As long as there is a signal, parse the signal while (in) { Signal sig; in >> sig; if (in) { msg.AppendSignal(sig); } } in.clear(); return in; } std::set Message::To() const { std::set collection; for (auto sig : signals_) { auto to_list = sig.To(); collection.insert(to_list.begin(), to_list.end()); } return collection; } } // namespace dbcc } // namespace ad