Msg.hpp
Go to the documentation of this file.
1 // This is -*-c++-*-
2 //
3 // Msg.hpp
4 //
5 
6 #ifndef MSG_HPP
7 #define MSG_HPP
8 
9 #include "../BasicDatatypes.hpp"
10 #include <iosfwd> // for istream, ostream
11 
12 namespace datatypes
13 {
14 
15 //
16 // A text message.
17 //
18 class Msg : public BasicData
19 {
20 public:
22  Msg(const UINT16 sourceId);
23 
25  Msg(const UINT16 sourceId, const std::string message);
26 
27  // Estimate the memory usage of this object
28  virtual const UINT32 getUsedMemory() const { return sizeof(*this) + m_msgText.length(); };
29 
30  std::string getMsg() const;
31  void setMsg(std::string message);
32 
33  std::string toString() const;
34 
36  bool operator==(const Msg& other) const
37  {
38  return (m_msgText == other.m_msgText);
39  }
40 
41 private:
42  std::string m_msgText;
43 };
44 
45 std::ostream& operator<<(std::ostream& os, const Msg& msg);
46 
47 } // namespace datatypes
48 
49 #endif
uint16_t UINT16
virtual const UINT32 getUsedMemory() const
Definition: Msg.hpp:28
bool operator==(const Msg &other) const
Equality predicate.
Definition: Msg.hpp:36
uint32_t UINT32
std::string getMsg() const
Definition: Msg.cpp:33
std::string m_msgText
Definition: Msg.hpp:42
std::string toString() const
Conversion to string for debugging.
Definition: Msg.cpp:28
void setMsg(std::string message)
Definition: Msg.cpp:39
Msg(const UINT16 sourceId)
Constructor.
Definition: Msg.cpp:14
std::ostream & operator<<(std::ostream &os, const EvalCaseResult &result)


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30