using namespace std;
This commit is contained in:
+20
-18
@@ -26,6 +26,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @brief Base class for all kinds of bus messages.
|
||||
*/
|
||||
@@ -48,10 +50,10 @@ public:
|
||||
* @param data the @a DataField for encoding/decoding the message.
|
||||
* @param pollPriority the priority for polling, or 0 for no polling at all.
|
||||
*/
|
||||
Message(const std::string clazz, const std::string name, const bool isSetMessage,
|
||||
const bool isActiveMessage, const std::string comment,
|
||||
Message(const string clazz, const string name, const bool isSetMessage,
|
||||
const bool isActiveMessage, const string comment,
|
||||
const unsigned char srcAddress, const unsigned char dstAddress,
|
||||
const std::vector<unsigned char> id, DataField* data,
|
||||
const vector<unsigned char> id, DataField* data,
|
||||
const unsigned int pollPriority)
|
||||
: m_class(clazz), m_name(name), m_isSetMessage(isSetMessage),
|
||||
m_isActiveMessage(isActiveMessage), m_comment(comment),
|
||||
@@ -70,18 +72,18 @@ public:
|
||||
* @return @a RESULT_OK on success, or an error code.
|
||||
* Note: the caller needs to free the created instance.
|
||||
*/
|
||||
static result_t create(std::vector<std::string>::iterator& it, const std::vector<std::string>::iterator end,
|
||||
const std::map<std::string, DataField*> templates, Message*& returnValue);
|
||||
static result_t create(vector<string>::iterator& it, const vector<string>::iterator end,
|
||||
const map<string, DataField*> templates, Message*& returnValue);
|
||||
/**
|
||||
* @brief Get the optional device class.
|
||||
* @return the optional device class.
|
||||
*/
|
||||
std::string getClass() const { return m_class; }
|
||||
string getClass() const { return m_class; }
|
||||
/**
|
||||
* @brief Get the message name (unique within the same class and type).
|
||||
* @return the message name (unique within the same class and type).
|
||||
*/
|
||||
std::string getName() const { return m_name; }
|
||||
string getName() const { return m_name; }
|
||||
/**
|
||||
* @brief Get whether this is a set message.
|
||||
* @return whether this is a set message.
|
||||
@@ -99,7 +101,7 @@ public:
|
||||
* @brief Get the comment.
|
||||
* @return the comment.
|
||||
*/
|
||||
std::string getComment() const { return m_comment; }
|
||||
string getComment() const { return m_comment; }
|
||||
/**
|
||||
* @brief Get the source address.
|
||||
* @return the source address, or @a SYN for any.
|
||||
@@ -114,39 +116,39 @@ public:
|
||||
* @brief Get the command ID bytes.
|
||||
* @return the primary, secondary, and optionally further command ID bytes.
|
||||
*/
|
||||
std::vector<unsigned char> getId() const { return m_id; }
|
||||
vector<unsigned char> getId() const { return m_id; }
|
||||
/**
|
||||
* @brief Reads the value from the master or slave @a SymbolString.
|
||||
* @param masterData the unescaped master data @a SymbolString for reading binary data.
|
||||
* @param slaveData the unescaped slave data @a SymbolString for reading binary data.
|
||||
* @param output the @a std::ostringstream to append the formatted value to.
|
||||
* @param output the @a ostringstream to append the formatted value to.
|
||||
* @param verbose whether to prepend the name, append the unit (if present), and append
|
||||
* the comment in square brackets (if present).
|
||||
* @param separator the separator character between multiple fields.
|
||||
* @return @a RESULT_OK on success, or an error code.
|
||||
*/
|
||||
//result_t read(SymbolString& masterData, SymbolString& slaveData, std::ostringstream& output,
|
||||
//result_t read(SymbolString& masterData, SymbolString& slaveData, ostringstream& output,
|
||||
// bool verbose=false, char separator=';') = 0;
|
||||
/**
|
||||
* @brief Writes the value to the master or slave @a SymbolString.
|
||||
* @param input the @a std::istringstream to parse the formatted value from.
|
||||
* @param input the @a istringstream to parse the formatted value from.
|
||||
* @param masterData the unescaped master data @a SymbolString for writing binary data.
|
||||
* @param slaveData the unescaped slave data @a SymbolString for writing binary data.
|
||||
* @param separator the separator character between multiple fields.
|
||||
* @return @a RESULT_OK on success, or an error code.
|
||||
*/
|
||||
result_t prepare(const unsigned char srcAddress, SymbolString& masterData,
|
||||
std::istringstream& input, char separator=';');
|
||||
istringstream& input, char separator=';');
|
||||
result_t handle(SymbolString& masterData, SymbolString& slaveData,
|
||||
std::ostringstream& output, char separator=';', bool answer=false);
|
||||
ostringstream& output, char separator=';', bool answer=false);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the optional device class. */
|
||||
const std::string m_class;
|
||||
const string m_class;
|
||||
/** the message name (unique within the same class and type). */
|
||||
const std::string m_name;
|
||||
const string m_name;
|
||||
/** whether this is a set message. */
|
||||
const bool m_isSetMessage;
|
||||
/** true if message can be initiated by the daemon itself and any other
|
||||
@@ -154,13 +156,13 @@ private:
|
||||
* other than the daemon. */
|
||||
const bool m_isActiveMessage;
|
||||
/** the comment. */
|
||||
const std::string m_comment;
|
||||
const string m_comment;
|
||||
/** the source address (optional if passive), or @a SYN for any. */
|
||||
const unsigned char m_srcAddress;
|
||||
/** the destination address. */
|
||||
const unsigned char m_dstAddress;
|
||||
/** the primary, secondary, and optionally further command ID bytes. */
|
||||
const std::vector<unsigned char> m_id;
|
||||
const vector<unsigned char> m_id;
|
||||
/** the @a DataField for encoding/decoding the message. */
|
||||
DataField* m_data;
|
||||
/** the priority for polling, or 0 for no polling at all. */
|
||||
|
||||
Reference in New Issue
Block a user