Salome HOME
Disabled test case for pipe with bi-normal
[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 #include <string>
15 #include <list>
16
17 /**\class Events_InfoMessage
18  * \ingroup EventsLoop
19  * \brief An event message for sending a string message which has to be translated.
20  */
21 class Events_InfoMessage: public Events_Message
22 {
23 public:
24
25   /// Constructor
26   /// \param theSender a pointer on sender object
27   Events_InfoMessage(const void* theSender = 0):Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
28
29   /// Constructor
30   /// \param theSender a pointer on sender object
31   Events_InfoMessage(const std::string& theContext, 
32     const std::string& theMsg, const void* theSender = 0):
33   Events_Message(Events_Loop::eventByName("InfoMessage"), theSender),
34     myContext(theContext), myMessage(theMsg) {}
35
36   /// default destructor   
37   virtual ~Events_InfoMessage() {}
38
39   /// Identifier of this event (one for all errors)
40   static Events_ID errorID()  { return Events_Loop::loop()->eventByName("InfoMessage"); }
41
42   /// Set a context string
43   /// \param theContext a context string
44   void  setContext(const std::string& theContext) { myContext = theContext; } 
45
46
47   /// Returns context string
48   std::string context() const { return myContext; }
49
50   /// Set message string for translation
51   /// \param theMsg the string of message
52   void setMessageString(const std::string& theMsg) { myMessage = theMsg; } 
53
54   /// Returns message
55   std::string messageString() const { return myMessage; }
56
57   /// Add parameter for message string of string type
58   /// \param theParam the parameter
59   void addParameter(const std::string& theParam) 
60   { 
61     myParameters.push_back(theParam); 
62   }
63
64   /// Add parameter for message string of double type
65   /// \param theParam the parameter
66   EVENTS_EXPORT void addParameter(double theParam);
67
68   /// Add parameter for message string of integer type
69   /// \param theParam the parameter
70   EVENTS_EXPORT void addParameter(int theParam);
71
72   /// Returns list of parameters
73   std::list<std::string> parameters() const { return myParameters; }
74
75   /// Add parameter for message string of string type
76   /// \param theParam the parameter
77   Events_InfoMessage& arg(const std::string& theParam) { addParameter(theParam); return *this; }
78
79   /// Add parameter for message string of integer type
80   /// \param theParam the parameter
81   Events_InfoMessage& arg(int theParam) { addParameter(theParam); return *this; }
82
83   /// Add parameter for message string of double type
84   /// \param theParam the parameter
85   Events_InfoMessage& arg(double theParam) { addParameter(theParam); return *this; }
86
87   /// Send the message
88   EVENTS_EXPORT void send();
89
90 private:
91
92   /// Context of the messgae
93   std::string myContext;
94
95   /// String of the message
96   std::string myMessage;
97
98   /// Parameters of the message
99   std::list<std::string> myParameters;
100 };
101
102 #endif