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

Basic implementation of the istd::IInformationProvider interface for log messages. More...

#include <CMessage.h>

Inheritance diagram for ilog::CMessage:
istd::IInformationProvider iser::IObject istd::IChangeable iser::ISerializable istd::IPolymorphic istd::IChangeable istd::IPolymorphic ilog::CExtMessage ilog::TExtMessage< Element >

Public Member Functions

 CMessage ()
 Default constructor.
 
 CMessage (istd::IInformationProvider::InformationCategory category, int id, const QString &text, const QString &source, int flags=0, const QDateTime *timeStampPtr=NULL)
 Construct a message with all properties.
 
void SetMessageValues (istd::IInformationProvider::InformationCategory category, int id, const QString &text, const QString &source, int flags=0, const QDateTime *timeStampPtr=NULL)
 Set all message properties at once.
 
virtual void SetCategory (istd::IInformationProvider::InformationCategory category)
 Set the message category (severity level).
 
virtual void SetText (const QString &text)
 Set the message text.
 
virtual void SetSource (const QString &source)
 Set the message source.
 
virtual QDateTime GetInformationTimeStamp () const override
 Get the message timestamp.
 
virtual InformationCategory GetInformationCategory () const override
 Get the message category (severity level).
 
virtual int GetInformationId () const override
 Get the numeric message identifier.
 
virtual QString GetInformationDescription () const override
 Get the human-readable message text.
 
virtual QString GetInformationSource () const override
 Get the message source identifier.
 
virtual int GetInformationFlags () const override
 Get application-defined flags.
 
virtual QByteArray GetFactoryId () const override
 Get the factory identifier for serialization.
 
virtual bool Serialize (iser::IArchive &archive) override
 Serialize or deserialize the message.
 
virtual bool CopyFrom (const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
 Copy message data from another object.
 
virtual istd::TUniqueInterfacePtr< istd::IChangeableCloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const override
 Create a deep copy of this message.
 
- Public Member Functions inherited from istd::IInformationProvider
 I_DECLARE_ENUM (InformationCategory, IC_NONE, IC_INFO, IC_WARNING, IC_ERROR, IC_CRITICAL)
 
- Public Member Functions inherited from istd::IChangeable
virtual int GetSupportedOperations () const
 Get set of flags for supported operations.
 
virtual bool IsEqual (const IChangeable &object) const
 Compare this object with another object.
 
virtual bool ResetData (CompatibilityMode mode=CM_WITHOUT_REFS)
 Reset data to its default state.
 
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 ()
 
- Public Member Functions inherited from iser::ISerializable
virtual quint32 GetMinimalVersion (int versionId) const
 Get minimal needed version to correct storing of this data.
 

Static Public Member Functions

static QByteArray GetMessageTypeId ()
 Get the message type identifier for serialization.
 
- 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 Attributes

istd::IInformationProvider::InformationCategory m_category
 Message category (severity level)
 
int m_id
 Numeric message identifier.
 
QString m_text
 Human-readable message text.
 
QString m_source
 Message source identifier.
 
int m_flags
 Application-defined flags.
 
QDateTime m_timeStamp
 Message creation timestamp.
 

Additional Inherited Members

- Public Types inherited from istd::IInformationProvider
enum  InformationCategory {
  IC_NONE = 0 , IC_INFO , IC_WARNING , IC_ERROR ,
  IC_CRITICAL
}
 Category of information. More...
 
enum  InformationTypeFlags { ITF_DEBUG = 0x1 , ITF_SYSTEM = 0x2 , ITF_USER = 0x4 }
 Additionally information flags. More...
 
- 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
 
- Protected Member Functions inherited from istd::IChangeable
virtual void OnBeginChanges ()
 Callback function for begin change event.
 
virtual void OnEndChanges (const ChangeSet &changeSet)
 Callback function for end change event.
 

Detailed Description

Basic implementation of the istd::IInformationProvider interface for log messages.

CMessage is the fundamental message class in the ilog library. It stores all standard message properties including category (severity), ID, text, source, flags, and timestamp.

The class implements both IInformationProvider (for message data access) and IObject (for serialization and type identification), making it fully compatible with the ACF framework's serialization and component systems.

Messages are typically created with all properties at construction and treated as immutable thereafter, though setter methods are provided for scenarios requiring modification.

Message Properties
  • Category: Severity level (IC_NONE, IC_INFO, IC_WARNING, IC_ERROR, IC_CRITICAL)
  • ID: Numeric identifier for message type (application-defined)
  • Text: Human-readable message description
  • Source: Origin of the message (component, module, or function name)
  • Flags: Application-defined flags for filtering or processing
  • Timestamp: When the message was created (automatically set if not provided)
Thread Safety
Individual message objects are not thread-safe for modification. However, they are typically treated as immutable after creation and shared via TSharedInterfacePtr, making them safe for multi-threaded read access.
Usage Example
// Create a simple info message
1001,
"Application started successfully",
"Main"
)
);
// Create an error message with custom timestamp
QDateTime customTime = QDateTime::currentDateTime();
5001,
"Database connection failed",
"DatabaseManager",
0,
&customTime
)
);
// Send to logger
logger->AddMessage(msg);
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.
@ IC_INFO
Normal information level.
Shared ownership smart pointer for interface types.
See also
ilog::CExtMessage, ilog::TExtMessage, istd::IInformationProvider

Definition at line 77 of file CMessage.h.

Constructor & Destructor Documentation

◆ CMessage() [1/2]

ilog::CMessage::CMessage ( )

Default constructor.

Creates an empty message with:

  • Category: IC_NONE
  • ID: 0
  • Empty text and source
  • No flags
  • Current timestamp

Typically used when deserializing or before calling SetMessageValues().

◆ CMessage() [2/2]

ilog::CMessage::CMessage ( istd::IInformationProvider::InformationCategory  category,
int  id,
const QString &  text,
const QString &  source,
int  flags = 0,
const QDateTime *  timeStampPtr = NULL 
)

Construct a message with all properties.

Parameters
categoryMessage severity level
idNumeric message identifier (application-defined)
textHuman-readable message description
sourceMessage origin (component, module, function name)
flagsOptional application-defined flags (default: 0)
timeStampPtrOptional pointer to timestamp, or NULL to use current time
Example
// Create warning message
2001,
"Memory usage above 80%",
"MemoryMonitor",
MY_FLAG_PERFORMANCE
);
@ IC_WARNING
Information about warning, processing could be done.

Member Function Documentation

◆ CloneMe()

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

Create a deep copy of this message.

Parameters
modeCompatibility mode for cloning
Returns
New message object with copied data, or NULL on error
Note
Caller takes ownership of the returned pointer

Reimplemented from istd::IChangeable.

Reimplemented in ilog::CExtMessage, and ilog::TExtMessage< Element >.

◆ CopyFrom()

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

Copy message data from another object.

Parameters
objectSource object to copy from (must be compatible)
modeCompatibility mode for copying
Returns
true if copy succeeded, false if incompatible

Reimplemented from istd::IChangeable.

Reimplemented in ilog::CExtMessage, and ilog::TExtMessage< Element >.

◆ GetFactoryId()

virtual QByteArray ilog::CMessage::GetFactoryId ( ) const
overridevirtual

Get the factory identifier for serialization.

Returns
Type identifier for object factory
See also
GetMessageTypeId()

Reimplemented from iser::IObject.

Reimplemented in ilog::CExtMessage, and ilog::TExtMessage< Element >.

◆ GetInformationCategory()

istd::IInformationProvider::InformationCategory ilog::CMessage::GetInformationCategory ( ) const
inlineoverridevirtual

Get the message category (severity level).

Returns
Message category (IC_NONE, IC_INFO, IC_WARNING, IC_ERROR, IC_CRITICAL)

Implements istd::IInformationProvider.

Definition at line 306 of file CMessage.h.

References m_category.

◆ GetInformationDescription()

QString ilog::CMessage::GetInformationDescription ( ) const
inlineoverridevirtual

Get the human-readable message text.

Returns
Message description

Implements istd::IInformationProvider.

Definition at line 318 of file CMessage.h.

References m_text.

◆ GetInformationFlags()

int ilog::CMessage::GetInformationFlags ( ) const
inlineoverridevirtual

Get application-defined flags.

Returns
Message flags for custom filtering or processing

Implements istd::IInformationProvider.

Definition at line 330 of file CMessage.h.

References m_flags.

◆ GetInformationId()

int ilog::CMessage::GetInformationId ( ) const
inlineoverridevirtual

Get the numeric message identifier.

Returns
Application-defined message ID

Implements istd::IInformationProvider.

Definition at line 312 of file CMessage.h.

References m_id.

◆ GetInformationSource()

QString ilog::CMessage::GetInformationSource ( ) const
inlineoverridevirtual

Get the message source identifier.

Returns
Message origin (component, module, function name)

Implements istd::IInformationProvider.

Definition at line 324 of file CMessage.h.

References m_source.

◆ GetInformationTimeStamp()

QDateTime ilog::CMessage::GetInformationTimeStamp ( ) const
inlineoverridevirtual

Get the message timestamp.

Returns
When the message was created
See also
QDateTime

Implements istd::IInformationProvider.

Definition at line 300 of file CMessage.h.

References m_timeStamp.

◆ GetMessageTypeId()

static QByteArray ilog::CMessage::GetMessageTypeId ( )
static

Get the message type identifier for serialization.

Returns
Type identifier string

◆ Serialize()

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

Serialize or deserialize the message.

Stores/loads all message properties (category, ID, text, source, flags, timestamp) to/from the archive.

Parameters
archiveArchive for reading or writing
Returns
true if serialization succeeded, false on error
See also
iser::IArchive

Implements iser::ISerializable.

Reimplemented in ilog::CExtMessage, and ilog::TExtMessage< Element >.

◆ SetCategory()

virtual void ilog::CMessage::SetCategory ( istd::IInformationProvider::InformationCategory  category)
virtual

Set the message category (severity level).

Parameters
categoryNew message category
See also
GetInformationCategory()

◆ SetMessageValues()

void ilog::CMessage::SetMessageValues ( istd::IInformationProvider::InformationCategory  category,
int  id,
const QString &  text,
const QString &  source,
int  flags = 0,
const QDateTime *  timeStampPtr = NULL 
)

Set all message properties at once.

Allows modification of message properties after construction. Typically used when reusing message objects or when constructing incrementally.

Parameters
categoryMessage severity level
idNumeric message identifier
textHuman-readable message description
sourceMessage origin
flagsOptional application-defined flags (default: 0)
timeStampPtrOptional pointer to timestamp, or NULL to use current time
Note
Modifying messages after adding them to containers or consumers may lead to inconsistencies. Prefer creating new messages.

◆ SetSource()

virtual void ilog::CMessage::SetSource ( const QString &  source)
virtual

Set the message source.

Parameters
sourceNew message origin identifier
See also
GetInformationSource()

◆ SetText()

virtual void ilog::CMessage::SetText ( const QString &  text)
virtual

Set the message text.

Parameters
textNew message description
See also
GetInformationDescription()

Member Data Documentation

◆ m_category

istd::IInformationProvider::InformationCategory ilog::CMessage::m_category
protected

Message category (severity level)

Definition at line 277 of file CMessage.h.

Referenced by GetInformationCategory().

◆ m_flags

int ilog::CMessage::m_flags
protected

Application-defined flags.

Definition at line 289 of file CMessage.h.

Referenced by GetInformationFlags().

◆ m_id

int ilog::CMessage::m_id
protected

Numeric message identifier.

Definition at line 280 of file CMessage.h.

Referenced by GetInformationId().

◆ m_source

QString ilog::CMessage::m_source
protected

Message source identifier.

Definition at line 286 of file CMessage.h.

Referenced by GetInformationSource().

◆ m_text

QString ilog::CMessage::m_text
protected

Human-readable message text.

Definition at line 283 of file CMessage.h.

Referenced by GetInformationDescription().

◆ m_timeStamp

QDateTime ilog::CMessage::m_timeStamp
protected

Message creation timestamp.

Definition at line 292 of file CMessage.h.

Referenced by GetInformationTimeStamp().


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