ACF $AcfVersion:0$
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
ilog::CMessageContainer Class Reference

Basic implementation of a message container. More...

#include <CMessageContainer.h>

Inheritance diagram for ilog::CMessageContainer:
istd::THierarchicalBase< IHierarchicalMessageContainer > ilog::IMessageConsumer istd::TChangeDelegator< Base > istd::IPolymorphic istd::CChangeDelegator istd::IChangeDelegator istd::IChangeable istd::IPolymorphic ilog::CLogComp iloggui::CLogGuiComp

Public Member Functions

 CMessageContainer ()
 
 CMessageContainer (const CMessageContainer &container)
 
CMessageContaineroperator= (const CMessageContainer &container)
 
int GetMessagesCount () const
 Get the number of messages in the container.
 
virtual void AddChildContainer (IHierarchicalMessageContainer *childContainerPtr)
 Add a child message container to this object.
 
void SetSlaveConsumer (ilog::IMessageConsumer *consumerPtr)
 Set slave message consumer.
 
void SetMaxMessageCount (int maxMessageCount=-1)
 Set maximal number of messages in the container.
 
virtual bool Serialize (iser::IArchive &archive) override
 
virtual istd::IInformationProvider::InformationCategory GetWorstCategory () const override
 
virtual Messages GetMessages () const override
 
virtual void ClearMessages () override
 
virtual bool IsMessageSupported (int messageCategory=-1, int messageId=-1, const istd::IInformationProvider *messagePtr=NULL) const override
 Check if a message is supported by this consumer.
 
virtual void AddMessage (const IMessageConsumer::MessagePtr &messagePtr) override
 Adds a message to this consumer.
 
virtual int GetChildsCount () const override
 
virtual IHierarchicalMessageContainerGetChild (int index) const override
 
virtual int GetSupportedOperations () const override
 Get set of flags for supported operations.
 
virtual bool CopyFrom (const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
 Copy this object from another one.
 
virtual bool IsEqual (const istd::IChangeable &object) const override
 Compare this object with another object.
 
virtual istd::TUniqueInterfacePtr< istd::IChangeableCloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const override
 Make a copy of this object.
 
virtual bool ResetData (CompatibilityMode mode) override
 Reset data to its default state.
 
- Public Member Functions inherited from istd::THierarchicalBase< IHierarchicalMessageContainer >
 THierarchicalBase ()
 
virtual void SetParentPtr (typename Base::InterfaceType *parentPtr)
 
virtual int GetHierarchicalFlags () const override
 
virtual typename Base::InterfaceType * GetParent () const override
 
- Public Member Functions inherited from istd::TChangeDelegator< Base >
 TChangeDelegator ()
 
 TChangeDelegator (istd::IChangeable *slavePtr)
 
virtual void OnBeginChanges () override
 Callback function for begin change event.
 
virtual void OnEndChanges (const istd::IChangeable::ChangeSet &changeSet) override
 Callback function for end change event.
 
- Public Member Functions inherited from istd::CChangeDelegator
 CChangeDelegator ()
 
 CChangeDelegator (istd::IChangeable *slavePtr)
 
virtual void SetSlavePtr (istd::IChangeable *slavePtr) override
 Sets the slave object pointer for change delegation.
 
virtual istd::IChangeableGetSlavePtr () const override
 Gets the slave object pointer.
 
- Public Member Functions inherited from istd::IChangeable
virtual void BeginChanges (const ChangeSet &changeSet)
 Starts the change transaction.
 
virtual void EndChanges (const ChangeSet &changeSet)
 Ends the change transaction.
 
virtual void BeginChangeGroup (const ChangeSet &changeSet)
 Starts group of changes.
 
virtual void EndChangeGroup (const ChangeSet &changeSet)
 Ends group of changes.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Static Public Member Functions

template<typename MessageType >
static bool RegisterMessageType (const QByteArray &messageTypeId=QByteArray())
 Register a new message type.
 
- Static Public Member Functions inherited from istd::IChangeable
static const ChangeSetGetNoChanges ()
 Get empty set of changes.
 
static const ChangeSetGetAnyChange ()
 Get anonymous change set.
 
static const ChangeSetGetAllChanges ()
 Get anonymous change set.
 
static const ChangeSetGetDelegatedChanges ()
 Get delegated change set.
 

Protected Types

typedef QVector< IHierarchicalMessageContainer * > Childs
 

Protected Attributes

Messages m_messages
 
Childs m_childContainers
 
ilog::IMessageConsumerm_slaveConsumerPtr
 
int m_maxMessagesCount
 
int m_worstCategory
 
- Protected Attributes inherited from istd::THierarchicalBase< IHierarchicalMessageContainer >
typename Base::InterfaceType * m_parentPtr
 

Additional Inherited Members

- Public Types inherited from istd::THierarchicalBase< IHierarchicalMessageContainer >
typedef istd::TChangeDelegator< IHierarchicalMessageContainer > BaseClass
 
- Public Types inherited from istd::TChangeDelegator< Base >
typedef Base BaseClass
 
typedef CChangeDelegator BaseClass2
 
- Public Types inherited from istd::CChangeDelegator
typedef istd::IChangeable BaseClass
 
- Public Types inherited from istd::IChangeable
enum  ChangeFlags {
  CF_ACF_INTERNAL = 0 , CF_ALL_DATA , CF_ANY , CF_DESTROYING ,
  CF_DELEGATED , CF_NO_UNDO
}
 Data model change notification flags. More...
 
enum  SupportedOperations {
  SO_NONE = 0 , SO_OBSERVE = 1 << 0 , SO_COPY = 1 << 1 , SO_CLONE = 1 << 2 ,
  SO_COMPARE = 1 << 3 , SO_RESET = 1 << 4
}
 Flags for supported operations. More...
 
enum  CompatibilityMode { CM_STRICT , CM_WITHOUT_REFS , CM_WITH_REFS , CM_CONVERT }
 Control how relationship betweeen objects are interpreted. More...
 
typedef QMultiMap< QByteArray, QVariant > ChangeInfoMap
 
- Public Types inherited from ilog::IMessageConsumer
typedef istd::TSharedInterfacePtr< istd::IInformationProviderMessagePtr
 Shared pointer type for message objects.
 

Detailed Description

Basic implementation of a message container.

Definition at line 30 of file CMessageContainer.h.

Member Typedef Documentation

◆ Childs

Definition at line 106 of file CMessageContainer.h.

Constructor & Destructor Documentation

◆ CMessageContainer() [1/2]

ilog::CMessageContainer::CMessageContainer ( )

◆ CMessageContainer() [2/2]

ilog::CMessageContainer::CMessageContainer ( const CMessageContainer container)

Member Function Documentation

◆ AddChildContainer()

virtual void ilog::CMessageContainer::AddChildContainer ( IHierarchicalMessageContainer childContainerPtr)
virtual

Add a child message container to this object.

GetMessages returns messages from this container and all its children.

◆ AddMessage()

virtual void ilog::CMessageContainer::AddMessage ( const IMessageConsumer::MessagePtr messagePtr)
overridevirtual

Adds a message to this consumer.

This method transfers ownership of the message to the consumer via shared pointer. The consumer may store, display, forward, or otherwise process the message.

Most implementations deliver messages asynchronously using Qt signals/slots to ensure thread safety when messages are added from worker threads.

Parameters
messagePtrShared pointer to the message. After this call, the message is owned by the shared pointer and will be automatically deleted when no longer referenced.
Note
This method should not throw exceptions. Implementations should handle errors gracefully (e.g., by logging internally or ignoring invalid messages).
Warning
The message object should not be modified after being added to a consumer, as multiple consumers may reference the same message object.
Example
// Create message with shared pointer
2001,
"File not found: config.xml",
"ConfigLoader"
)
);
// Add to consumer (ownership transferred)
consumer->AddMessage(msg);
// msg can still be used as shared pointer maintains reference count
// but don't modify the message after adding it
Basic implementation of the istd::IInformationProvider interface for log messages.
Definition CMessage.h:80
@ IC_ERROR
Information about error, processing could not be done correctly.
Shared ownership smart pointer for interface types.
See also
IsMessageSupported()

Implements ilog::IMessageConsumer.

Reimplemented in ilog::CLogComp, and iloggui::CLogGuiComp.

◆ ClearMessages()

virtual void ilog::CMessageContainer::ClearMessages ( )
overridevirtual

Reimplemented in iloggui::CLogGuiComp.

◆ CloneMe()

virtual istd::TUniqueInterfacePtr< istd::IChangeable > ilog::CMessageContainer::CloneMe ( CompatibilityMode  mode = CM_WITHOUT_REFS) const
overridevirtual

Make a copy of this object.

Returns
new instance or NULL, if this operation is not supported.

Reimplemented from istd::IChangeable.

◆ CopyFrom()

virtual bool ilog::CMessageContainer::CopyFrom ( const istd::IChangeable object,
CompatibilityMode  mode = CM_WITHOUT_REFS 
)
overridevirtual

Copy this object from another one.

Default implementation in istd::IChangeable does nothing.

Reimplemented from istd::IChangeable.

◆ GetChild()

virtual IHierarchicalMessageContainer * ilog::CMessageContainer::GetChild ( int  index) const
overridevirtual

◆ GetChildsCount()

virtual int ilog::CMessageContainer::GetChildsCount ( ) const
overridevirtual

◆ GetMessages()

virtual Messages ilog::CMessageContainer::GetMessages ( ) const
overridevirtual

◆ GetMessagesCount()

int ilog::CMessageContainer::GetMessagesCount ( ) const

Get the number of messages in the container.

Note
Messages in the child containers are not involved in the calculation.

◆ GetSupportedOperations()

virtual int ilog::CMessageContainer::GetSupportedOperations ( ) const
overridevirtual

Get set of flags for supported operations.

See also
SupportedOperations

Reimplemented from istd::IChangeable.

◆ GetWorstCategory()

virtual istd::IInformationProvider::InformationCategory ilog::CMessageContainer::GetWorstCategory ( ) const
overridevirtual

◆ IsEqual()

virtual bool ilog::CMessageContainer::IsEqual ( const istd::IChangeable object) const
overridevirtual

Compare this object with another object.

Parameters
objectObject to be compared
Returns
true if the objects are identical and false otherwise.

Reimplemented from istd::IChangeable.

◆ IsMessageSupported()

virtual bool ilog::CMessageContainer::IsMessageSupported ( int  messageCategory = -1,
int  messageId = -1,
const istd::IInformationProvider messagePtr = NULL 
) const
overridevirtual

Check if a message is supported by this consumer.

This method allows consumers to filter messages based on category, ID, or the complete message object. It's used to determine whether a message should be sent to this consumer before actually adding it.

Parameters
messageCategoryCategory of message (IC_NONE, IC_INFO, IC_WARNING, IC_ERROR, IC_CRITICAL) or -1 if category check should be skipped.
See also
istd::IInformationProvider::InformationCategory.
Parameters
messageIdNumeric ID of message or -1 if ID check should be skipped. Message IDs are application-defined for filtering and routing.
messagePtrOptional pointer to complete message object for detailed inspection, or NULL if not needed. The consumer will not store this pointer.
Returns
true if the message is supported and should be sent to this consumer, false if the message should be filtered out.
Note
Returning false does not indicate an error; it simply means the message doesn't match the consumer's filter criteria.
Example
// Check if consumer accepts warnings
if (consumer->IsMessageSupported(istd::IInformationProvider::IC_WARNING)) {
// Consumer accepts warnings
}
// Check specific message ID
if (consumer->IsMessageSupported(-1, 5001)) {
// Consumer accepts message ID 5001
}
// Check complete message
if (consumer->IsMessageSupported(-1, -1, &msg)) {
// Consumer accepts this specific message
}
@ IC_INFO
Normal information level.
@ IC_WARNING
Information about warning, processing could be done.

Implements ilog::IMessageConsumer.

Reimplemented in ilog::CLogComp, and iloggui::CLogGuiComp.

◆ operator=()

CMessageContainer & ilog::CMessageContainer::operator= ( const CMessageContainer container)

◆ RegisterMessageType()

template<typename MessageType >
bool ilog::CMessageContainer::RegisterMessageType ( const QByteArray &  messageTypeId = QByteArray())
static

Register a new message type.

Only messages of known (registered) types can be serialized.

Definition at line 118 of file CMessageContainer.h.

References istd::TComposedFactory< InterfaceType >::RegisterFactory().

◆ ResetData()

virtual bool ilog::CMessageContainer::ResetData ( CompatibilityMode  mode)
overridevirtual

Reset data to its default state.

Default implementation in istd::IChangeable does nothing.

Returns
true if the operation was successful, and false otherwise.

Reimplemented from istd::IChangeable.

◆ Serialize()

virtual bool ilog::CMessageContainer::Serialize ( iser::IArchive archive)
overridevirtual

◆ SetMaxMessageCount()

void ilog::CMessageContainer::SetMaxMessageCount ( int  maxMessageCount = -1)

Set maximal number of messages in the container.

If the container is full and a new message is added, the oldest message will be removed.

Parameters
maxMessageCountmaximal number of messages in the container. If the value equals -1, no limit is set for.

◆ SetSlaveConsumer()

void ilog::CMessageContainer::SetSlaveConsumer ( ilog::IMessageConsumer consumerPtr)

Set slave message consumer.

All incoming messages will be delegated to this object.

Member Data Documentation

◆ m_childContainers

Childs ilog::CMessageContainer::m_childContainers
protected

Definition at line 107 of file CMessageContainer.h.

◆ m_maxMessagesCount

int ilog::CMessageContainer::m_maxMessagesCount
protected

Definition at line 110 of file CMessageContainer.h.

◆ m_messages

Messages ilog::CMessageContainer::m_messages
protected

Definition at line 104 of file CMessageContainer.h.

◆ m_slaveConsumerPtr

ilog::IMessageConsumer* ilog::CMessageContainer::m_slaveConsumerPtr
protected

Definition at line 109 of file CMessageContainer.h.

◆ m_worstCategory

int ilog::CMessageContainer::m_worstCategory
mutableprotected

Definition at line 111 of file CMessageContainer.h.


The documentation for this class was generated from the following file: