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)
40#define vtkWarningToMessageCollectionMacro(messageCollection, devMsgPrefix, userMsg) \ …
44#ifndef vtkErrorToMessageCollectionMacro
45#define vtkErrorToMessageCollectionMacro(messageCollection, devMsgPrefix, userMsg) \
46 vtkErrorToMessageCollectionWithObjectMacro(this, messageCollection, devMsgPrefix, userMsg)
45#define vtkErrorToMessageCollectionMacro(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); \
50#define vtkWarningToMessageCollectionWithObjectMacro(self, messageCollection, 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); \
66#define vtkErrorToMessageCollectionWithObjectMacro(self, messageCollection, devMsgPrefix, userMsg) \ …
91 void PrintSelf(ostream& os, vtkIndent indent)
override;
112 virtual void AddMessage(
unsigned long messageType,
const std::string &messageText);
148 Message(
unsigned long messageType,
const std::string &messageText);
155 void* clientData,
void* callData);
vtkSmartPointer< vtkCallbackCommand > CallbackCommand
virtual int GetNumberOfMessagesOfType(unsigned long messageType) const
Return the number of reported messages of the specified event type.
virtual int GetNumberOfMessages() const
Return the total number of reported messages.
virtual void SetObservedObject(vtkObject *observedObject)
virtual std::string GetNthMessageText(int index) const
Get event type of a message from the message vector.
static vtkMRMLMessageCollection * New()
~vtkMRMLMessageCollection() override
std::vector< Message > Messages
vtkSmartPointer< vtkObject > ObservedObject
virtual void DeepCopy(vtkMRMLMessageCollection *source)
Copy all messages from another collection.
static void CallbackFunction(vtkObject *, long unsigned int, void *clientData, void *callData)
void PrintSelf(ostream &os, vtkIndent indent) override
virtual int GetNumberOfMessagesOfType(const char *eventName) const
Get the number of reported messages of the specified event type.
virtual unsigned long GetNthMessageType(int index) const
Get text of a message from the message vector.
virtual void ClearMessages()
Clear the message vector.
virtual void AddMessages(vtkMRMLMessageCollection *source, const std::string &prefix=std::string())
vtkMRMLMessageCollection()
virtual std::string GetAllMessagesAsString(bool *errorFound=nullptr, bool *warningFound=nullptr)
vtkMRMLMessageCollection(const vtkMRMLMessageCollection &)
virtual void AddSeparator()
void operator=(const vtkMRMLMessageCollection &)
virtual void AddMessage(unsigned long messageType, const std::string &messageText)
unsigned long MessageType
Message(unsigned long messageType, const std::string &messageText)