hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MessagesCollection.cpp
Go to the documentation of this file.
1 #include "MessagesCollection.hpp"
2 
3 namespace HCE
4 {
5 //-----------------------------------------------------------------------------
7 : Messages()
8 {
9 }
10 //-----------------------------------------------------------------------------
11 MessagesCollection::MessagesCollection(const std::vector<MsgItem>& msgItems)
12 : Messages()
13 {
14  set(msgItems);
15 }
16 //-----------------------------------------------------------------------------
18 {
19  (*this) = rhs;
20 }
21 //-----------------------------------------------------------------------------
23 {
24  (*this) = std::forward<MessagesCollection>(rhs);
25 }
26 //-----------------------------------------------------------------------------
28 {
29 }
30 //-----------------------------------------------------------------------------
32 {
33  if (this != &rhs)
34  {
35  Messages = rhs.getMessages();
36  }
37  return *this;
38 }
39 //-----------------------------------------------------------------------------
41 {
42  if (this != &rhs)
43  {
44  Messages = std::move(rhs.getMessages());
45  }
46  return *this;
47 }
48 //-----------------------------------------------------------------------------
49 void MessagesCollection::set(const std::vector<MsgItem>& msgItems)
50 {
51  Messages.clear();
52  for (size_t i=0;i<msgItems.size();++i)
53  Messages.insert(MSG_MAP::value_type(msgItems[i]));
54 }
55 //-----------------------------------------------------------------------------
56 std::string MessagesCollection::getMessage(unsigned int type)
57 {
58  std::string message;
59  MSG_MAP::iterator iter = Messages.find(type);
60  if (iter!=Messages.end())
61  message = (*iter).second;
62 
63  return message;
64 }
65 //-----------------------------------------------------------------------------
66 //-----------------------------------------------------------------------------
67 } // end namespace HCE