CTL
0.6.1
Computed Tomography Library
|
Go to the source code of this file.
Classes | |
class | CTL::SerializationInterface |
Specify an interface for de-/serialization from/to QVariant s. More... | |
Macros | |
#define | CTL_TYPE_ID(newIndex) |
#define CTL_TYPE_ID | ( | newIndex | ) |
This macro should be used in classes with SerializationInterface as base class. It adds a class to the type enumeration with the index newIndex and it overrides the function int type() const
so that it returns the newIndex.
Moreover, the SerializationHelper::RegisterWithSerializationHelper
class is declared as a friend class. This allows access to a possible private default constructor of the class using this macro.
The usage of the macro should be in a class definition as follows:
or further subclasses can be typed like
Additionally, the type may be registered to the SerializationHelper
by using the macro DECLARE_SERIALIZABLE_TYPE(className_woNamespace)
. This is not necessary, however, it enables the SerializationHelper to mangage the deserialization of classes with the following types as base class:
Note that newIndex within one of the top four categories has to be unique for each class that uses this macro. It is not necessary for the newIndex to be unique with respect to the other categories.
The SerializationHelper
is used by implementations (subclasses) of AbstractSerializer
. For instance, you can create an object of the 3rd category from a JSON file with