Salome HOME
Removed Debug for deflection dump
[modules/shaper.git] / src / Events / Events_InfoMessage.h
index e441219553e9c1d838d35c9ba5370eee7bb2abb6..2924df181116796ad571560ac69f6508577cbdeb 100644 (file)
@@ -11,6 +11,9 @@
 #include <Events_Message.h>
 #include <Events_Loop.h>
 
+#include <string>
+#include <list>
+
 /**\class Events_InfoMessage
  * \ingroup EventsLoop
  * \brief An event message for sending a string message which has to be translated.
@@ -21,7 +24,7 @@ public:
 
   /// Constructor
   /// \param theSender a pointer on sender object
-  Events_InfoMessage(const void* theSender = 0):Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
+  explicit Events_InfoMessage(const void* theSender = 0):Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
 
   /// Constructor
   /// \param theSender a pointer on sender object
@@ -46,10 +49,19 @@ public:
 
   /// Set message string for translation
   /// \param theMsg the string of message
-  void setMessage(const std::string& theMsg) { myMessage = theMsg; } 
+  void setMessageString(const std::string& theMsg) { myMessage = theMsg; } 
 
   /// Returns message
-  std::string message() const { return myMessage; }
+  std::string messageString() const { return myMessage; }
+
+  Events_InfoMessage& operator=(const std::string& theMsg) {
+    setMessageString(theMsg);
+    return *this;
+  }
+
+  bool empty() const {
+    return myMessage.empty();
+  }
 
   /// Add parameter for message string of string type
   /// \param theParam the parameter
@@ -60,23 +72,11 @@ public:
 
   /// Add parameter for message string of double type
   /// \param theParam the parameter
-  void addParameter(double theParam) 
-  { 
-    char aBuf[50];
-    int n = sprintf(aBuf, "%g", theParam);
-    std::string aStr(aBuf);
-    myParameters.push_back(aStr); 
-  }
+  EVENTS_EXPORT void addParameter(double theParam);
 
   /// Add parameter for message string of integer type
   /// \param theParam the parameter
-  void addParameter(int theParam) 
-  { 
-    char aBuf[50];
-    int n = sprintf(aBuf, "%d", theParam);
-    std::string aStr(aBuf);
-    myParameters.push_back(aStr); 
-  }
+  EVENTS_EXPORT void addParameter(int theParam);
 
   /// Returns list of parameters
   std::list<std::string> parameters() const { return myParameters; }
@@ -93,10 +93,8 @@ public:
   /// \param theParam the parameter
   Events_InfoMessage& arg(double theParam) { addParameter(theParam); return *this; }
 
-  void send() { 
-    std::shared_ptr<Events_Message> aMsg(new Events_InfoMessage(*this));
-    Events_Loop::loop()->send(aMsg); 
-  }
+  /// Send the message
+  EVENTS_EXPORT void send();
 
 private:
 
@@ -110,4 +108,4 @@ private:
   std::list<std::string> myParameters;
 };
 
-#endif
\ No newline at end of file
+#endif