Salome HOME
Read translations
[modules/shaper.git] / src / Events / Events_InfoMessage.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Events_InfoMessage.hxx
4 // Created:     31 May 2016
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef Events_InfoMessage_H_
8 #define Events_InfoMessage_H_
9
10 #include <Events.h>
11 #include <Events_Message.h>
12 #include <Events_Loop.h>
13
14 class Events_InfoMessage: public Events_Message
15 {
16 public:
17   Events_InfoMessage(const void* theSender = 0) : 
18       Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
19
20   void  setContext(const std::string& theContext) { myContext = theContext; } 
21
22   std::string context() const { return myContext; }
23
24   void setMessage(const std::string& theMsg) { myMessage = theMsg; } 
25
26   std::string message() const { return myMessage; }
27
28   void addParameter(const std::string& theParam) 
29   { 
30     myParameters.push_back(theParam); 
31   }
32
33   void addParameter(double theParam) 
34   { 
35     char aBuf[50];
36     int n = sprintf_s(aBuf, "%g", theParam);
37     std::string aStr(aBuf);
38     myParameters.push_back(aStr); 
39   }
40
41   void addParameter(int theParam) 
42   { 
43     char aBuf[50];
44     int n = sprintf_s(aBuf, "%d", theParam);
45     std::string aStr(aBuf);
46     myParameters.push_back(aStr); 
47   }
48
49   std::list<std::string> parameters() const { return myParameters; }
50
51 private:
52
53   /// Context of the messgae
54   std::string myContext;
55
56   /// String of the message
57   std::string myMessage;
58
59   /// Parameters of the message
60   std::list<std::string> myParameters;
61 };
62
63 #endif