Qore Programming Language Reference Manual
1.8.0
|
The Serializable class can be used to mark a class as being serializable. More...
Public Member Methods | |
constructor () | |
The constructor does not perform any action; this class is just used to mark a class as serializable by inheriting this class. | |
copy () | |
The copy constructor does not perform any action; this class is just used to mark a class as serializable by inheriting this class. | |
serialize (OutputStream stream) | |
converts the object to binary data representing the object More... | |
binary | serialize () |
converts the object to binary data representing the object More... | |
hash< SerializationInfo > | serializeToData () |
converts the object to a serialization hash representing the object More... | |
Static Public Member Methods | |
static auto | deserialize (InputStream stream) |
Deserializes data produced with serialize() and returns the value represented by the data. More... | |
static auto | deserialize (binary bin) |
Deserializes data produced with serialize() and returns the value represented by the data. More... | |
static auto | deserialize (string bin) |
Deserializes data produced with serialize() and returns the value represented by the data. More... | |
static auto | deserialize (hash< SerializationInfo > data) |
Deserializes data produced with serializeToData() and returns the value represented by the data. More... | |
static hash< SerializationInfo > | deserializeToData (InputStream stream) |
Deserializes data produced with serialize() and returns the value represented by the data. More... | |
static hash< SerializationInfo > | deserializeToData (binary bin) |
Deserializes data produced with serialize() and returns the value represented by the data. More... | |
static | serialize (auto val, OutputStream stream) |
serializes the data and writes the serialized data to the given output stream More... | |
static binary | serialize (auto val) |
serializes the data and returns the serialized data as a binary object More... | |
static hash< SerializationInfo > | serializeToData (auto val) |
converts the value to a serialization hash representing the value More... | |
Private:Internal Member Methods | |
nothing | deserializeMembers (hash< auto > members) |
overrides the default automatic member assignment logic for user classes during data deserialization More... | |
*hash< auto > | serializeMembers (*hash< auto > members) |
overrides the default automatic member retrieval for user classes during data serialization More... | |
The Serializable class can be used to mark a class as being serializable.
This class serves two purposes; to mark classes as serializable and then to implement the actual serialization and deserialization methods.
This class may also be inherited as private:internal to mark it as serializable (in this case the serialization methods are only available inside the class itself).
Objects are serialized very efficiently; each object in a data structure will only be serialized once, even if it appears multiple times in the data structure. Recursive references and cyclic graphs of objects are also supported for serialization.
Classes that do not inherit this class cannot be serialized; if any non-transient member of a serializable class holds an object from a class that does not inherit this class, a SERIALIZATION-ERROR
will be thrown when the object is attempted to be serialized.
Furthermore any attempt to serialize a closures, call references, or a reference will result in a SERIALIZATION-ERROR
as well.
|
static |
Deserializes data produced with serialize() and returns the value represented by the data.
bin | binary data representing serialized data as generated by serialize() |
DESERIALIZATION-ERROR | the data cannot be deserialized due to an error in the serialization format or a reference to an unknown class or Hashdecl: Type-Safe Hash Declarations |
|
static |
Deserializes data produced with serializeToData() and returns the value represented by the data.
data | the data representing the object as generated by serializeToData() |
DESERIALIZATION-ERROR | the data cannot be deserialized due to an error in the serialization format or a reference to an unknown class or Hashdecl: Type-Safe Hash Declarations |
|
static |
Deserializes data produced with serialize() and returns the value represented by the data.
stream | an input stream providing serialized binary data as generated by serialize() |
DESERIALIZATION-ERROR | the data cannot be deserialized due to an error in the serialization format or a reference to an unknown class or Hashdecl: Type-Safe Hash Declarations |
|
static |
Deserializes data produced with serialize() and returns the value represented by the data.
bin | binary data representing serialized data as generated by serialize() |
DESERIALIZATION-ERROR | the data cannot be deserialized due to an error in the serialization format or a reference to an unknown class or Hashdecl: Type-Safe Hash Declarations |
|
private:internal |
overrides the default automatic member assignment logic for user classes during data deserialization
This method is special in that it is only called during data deserialization for user classes for each class in a class hierarchy if the method is defined.
This method in the base class does nothing and should not be called from user classes; this method is declared private:internal
to emphasize that it is only called for the local class by the internal deserialization logic; it may be declared with any access permission, but in any case the method only has an effect for the local class and not for the hierarchy, which makes it different than other Qore class methods (other than the similar serializeMembers() method.
This method can be used to implement special deserialization logic when deserializing members of a particular class in a class hierarchy.
members | locally-defined deserialized members to assign to the local class to be assigned manually in this method; this hash will be empty if no members were serialized |
|
static |
Deserializes data produced with serialize() and returns the value represented by the data.
bin | binary data representing serialized data as generated by serialize() |
DESERIALIZATION-ERROR | the data cannot be deserialized due to an error in the serialization format or a reference to an unknown class or Hashdecl: Type-Safe Hash Declarations |
|
static |
Deserializes data produced with serialize() and returns the value represented by the data.
stream | an input stream providing serialized binary data as generated by serialize() |
DESERIALIZATION-ERROR | the data cannot be deserialized due to an error in the serialization format or a reference to an unknown class or Hashdecl: Type-Safe Hash Declarations |
binary Qore::Serializable::serialize | ( | ) |
converts the object to binary data representing the object
All non-serializable data such as closures, call references, references, or non-serializable objects must be tagged as Transient Members or a SERIALIZATION-ERROR
exception will be thrown.
SERIALIZATION-ERROR | the object cannot be serialized as it contains non-serializable data (closures, call references, references, and non-serializable objects) |
|
static |
serializes the data and returns the serialized data as a binary object
val | the data to serialize |
All non-serializable data such as closures, call references, references, or non-serializable objects must be tagged as Transient Members in object members or a SERIALIZATION-ERROR
exception will be thrown.
SERIALIZATION-ERROR | the object cannot be serialized as it contains non-serializable data (closures, call references, references, and non-serializable objects) |
|
static |
serializes the data and writes the serialized data to the given output stream
val | the data to serialize |
stream | an output stream where the serialized data will be written |
All non-serializable data such as closures, call references, references, or non-serializable objects must be tagged as Transient Members in object members or a SERIALIZATION-ERROR
exception will be thrown.
SERIALIZATION-ERROR | the object cannot be serialized as it contains non-serializable data (closures, call references, references, and non-serializable objects) |
Qore::Serializable::serialize | ( | OutputStream | stream | ) |
converts the object to binary data representing the object
stream | an output stream where the serialized data will be written |
All non-serializable data such as closures, call references, references, or non-serializable objects must be tagged as Transient Members or a SERIALIZATION-ERROR
exception will be thrown.
SERIALIZATION-ERROR | the object cannot be serialized as it contains non-serializable data (closures, call references, references, and non-serializable objects) |
overrides the default automatic member retrieval for user classes during data serialization
This method is special in that it is only called for user classes for each class in a class hierarchy if the method is defined.
This method in the base class does nothing and should not be called from user classes; this method is declared private:internal
to emphasize that it is only called for the local class by the internal serialization logic; it may be declared with any access permission, but in any case the method only has an effect for the local class and not for the hierarchy, which makes it different than other Qore class methods (other than the similar deserializeMembers() method).
This method can be used to implement special serialization logic when serializing members of a particular class in a class hierarchy.
members | locally-defined serialized non-transient members, if any |
hash<SerializationInfo> Qore::Serializable::serializeToData | ( | ) |
converts the object to a serialization hash representing the object
All non-serializable data such as closures, call references, references, or non-serializable objects must be tagged as Transient Members or a SERIALIZATION-ERROR
exception will be thrown.
SERIALIZATION-ERROR | the object cannot be serialized as it contains non-serializable data (closures, call references, references, and non-serializable objects) |
|
static |
converts the value to a serialization hash representing the value
val | the value to serialize to a serialization data hash |
All non-serializable data such as closures, call references, references, or non-serializable objects must be tagged as Transient Members or a SERIALIZATION-ERROR
exception will be thrown.
SERIALIZATION-ERROR | the object cannot be serialized as it contains non-serializable data (closures, call references, references, and non-serializable objects) |