20 #ifndef __vtkMRMLMessageCollection_h 21 #define __vtkMRMLMessageCollection_h 27 #include <vtkCallbackCommand.h> 28 #include <vtkIdTypeArray.h> 39 #ifndef vtkWarningToMessageCollectionMacro 40 #define vtkWarningToMessageCollectionMacro(messageCollection, devMsgPrefix, userMsg) \ 41 vtkWarningToMessageCollectionWithObjectMacro(this, messageCollection, devMsgPrefix, userMsg) 44 #ifndef vtkErrorToMessageCollectionMacro 45 #define vtkErrorToMessageCollectionMacro(messageCollection, devMsgPrefix, userMsg) \ 46 vtkErrorToMessageCollectionWithObjectMacro(this, messageCollection, devMsgPrefix, userMsg) 49 #ifndef vtkWarningToMessageCollectionWithObjectMacro 50 #define vtkWarningToMessageCollectionWithObjectMacro(self, messageCollection, devMsgPrefix, userMsg) \ 52 vtkOStreamWrapper::EndlType endl; \ 53 vtkOStreamWrapper::UseEndl(endl); \ 54 if (messageCollection) \ 56 vtkOStrStreamWrapper userMsgStream; \ 57 userMsgStream << userMsg; \ 58 messageCollection->AddMessage(vtkCommand::WarningEvent, userMsgStream.str()); \ 59 userMsgStream.rdbuf()->freeze(0); \ 61 vtkWarningWithObjectMacro(self, << devMsgPrefix << ": " << userMsg); \ 65 #ifndef vtkErrorToMessageCollectionWithObjectMacro 66 #define vtkErrorToMessageCollectionWithObjectMacro(self, messageCollection, devMsgPrefix, userMsg) \ 68 vtkOStreamWrapper::EndlType endl; \ 69 vtkOStreamWrapper::UseEndl(endl); \ 70 if (messageCollection) \ 72 vtkOStrStreamWrapper userMsgStream; \ 73 userMsgStream << userMsg; \ 74 messageCollection->AddMessage(vtkCommand::ErrorEvent, userMsgStream.str()); \ 75 userMsgStream.rdbuf()->freeze(0); \ 77 vtkErrorWithObjectMacro(self, << devMsgPrefix << ": " << userMsg); \ 91 void PrintSelf(ostream& os, vtkIndent indent)
override;
95 virtual int GetNumberOfMessages()
const;
98 virtual int GetNumberOfMessagesOfType(
unsigned long messageType)
const;
101 virtual int GetNumberOfMessagesOfType(
const char *eventName)
const;
104 virtual unsigned long GetNthMessageType(
int index)
const;
107 virtual std::string GetNthMessageText(
int index)
const;
112 virtual void AddMessage(
unsigned long messageType,
const std::string &messageText);
116 virtual void AddSeparator();
123 virtual void ClearMessages();
131 virtual std::string GetAllMessagesAsString(
bool* errorFound=
nullptr,
bool* warningFound=
nullptr);
136 virtual void SetObservedObject(vtkObject* observedObject);
148 Message(
unsigned long messageType,
const std::string &messageText);
154 static void CallbackFunction(vtkObject*,
long unsigned int,
155 void* clientData,
void* callData);
std::vector< Message > Messages
vtkSmartPointer< vtkCallbackCommand > CallbackCommand
A helper class that describes a single message
vtkSmartPointer< vtkObject > ObservedObject
unsigned long MessageType