ACF $AcfVersion:0$
CExtMessage.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QList>
7
8// ACF includes
10#include <istd/CClassInfo.h>
11#include <imod/TModelWrap.h>
12#include <iser/IObject.h>
13#include <ilog/CMessage.h>
14
15
16namespace ilog
17{
18
19
82class CExtMessage: public CMessage
83{
84public:
86
94 explicit CExtMessage(const iser::IObjectFactory* factoryPtr = NULL);
95
121 int id,
122 const QString& text,
123 const QString& source,
124 int flags = 0,
125 const QDateTime* timeStampPtr = NULL,
126 const iser::IObjectFactory* factoryPtr = NULL);
127
134
140 void SetObjectFactory(const iser::IObjectFactory* factoryPtr);
141
154
171
195 const iser::IObject* GetAttachedObject(int index) const;
196
211 const QString& GetAttachedObjectDescription(int index) const;
212
241 void InsertAttachedObject(iser::IObject* objectPtr, const QString& description = "");
242
243 // reimplemented (iser::IObject)
244
252 virtual QByteArray GetFactoryId() const override;
253
254 // reimplemented (iser::ISerializable)
255
267 virtual bool Serialize(iser::IArchive& archive) override;
268
269 // reimplemented (iser::IChangeable)
270
278 virtual bool CopyFrom(const istd::IChangeable& object, CompatibilityMode mode = CM_STRICT) override;
279
291
297 static QByteArray GetTypeName();
298
299protected:
311
312protected:
315
317 QList<AttachedObject> m_attachedObjects;
318};
319
320
321} // namespace ilog
322
323
324
325
Extended message supporting attached list of serializable objects.
Definition CExtMessage.h:83
static QByteArray GetTypeName()
Get the extended message type identifier.
virtual QByteArray GetFactoryId() const override
Get the factory identifier for serialization.
void ResetAttachedObjects()
Remove all attached objects from the message.
void InsertAttachedObject(iser::IObject *objectPtr, const QString &description="")
Add an object to this message.
virtual bool CopyFrom(const istd::IChangeable &object, CompatibilityMode mode=CM_STRICT) override
Copy message and attached objects from another message.
void SetObjectFactory(const iser::IObjectFactory *factoryPtr)
Set the object factory for deserialization.
CExtMessage(istd::IInformationProvider::InformationCategory category, int id, const QString &text, const QString &source, int flags=0, const QDateTime *timeStampPtr=NULL, const iser::IObjectFactory *factoryPtr=NULL)
Construct extended message with all properties.
int GetAttachedObjectsCount() const
Get the number of attached objects.
CExtMessage(const iser::IObjectFactory *factoryPtr=NULL)
Default constructor.
QList< AttachedObject > m_attachedObjects
List of attached objects with descriptions.
const iser::IObject * GetAttachedObject(int index) const
Get a specific attached object by index.
virtual istd::TUniqueInterfacePtr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Create a deep copy of this extended message.
const iser::IObjectFactory * GetObjectFactory() const
Get the object factory used for deserialization.
virtual bool Serialize(iser::IArchive &archive) override
Serialize or deserialize the message and attached objects.
const iser::IObjectFactory * m_factoryPtr
Object factory for deserializing attached objects.
const QString & GetAttachedObjectDescription(int index) const
Get the description of an attached object.
Basic implementation of the istd::IInformationProvider interface for log messages.
Definition CMessage.h:80
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Common interface for factorisable model objects.
Definition IObject.h:23
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
@ CM_STRICT
If external references are different this object are not compatible and cannot be compared or copied.
InformationCategory
Category of information.
Generic interface for a factory.
Definition TIFactory.h:19
Shared ownership smart pointer for interface types.
Unique ownership smart pointer for interface types.
#define NULL
Definition istd.h:74
This namespace contains implementations for the logging functionality.
Structure holding an attached object and its description.
istd::TSharedInterfacePtr< iser::IObject > objectPtr
Shared pointer to the attached object.
QString description
Human-readable description of the object.