Utility module for (de-)serialisation and (de-)compression (zlib, zstd) of derived types. Namelist is the only serialisation format supported.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | Z_TYPE_INVALID | = | -1 |
Invalid or unknown type. |
integer, | public, | parameter | :: | Z_TYPE_NONE | = | 0 |
No compression. |
integer, | public, | parameter | :: | Z_TYPE_ZLIB | = | 1 |
Deflate compression. |
integer, | public, | parameter | :: | Z_TYPE_ZSTD | = | 2 |
Zstandard compression. |
integer, | public, | parameter | :: | Z_TYPE_LAST | = | 2 |
Never use this. |
integer, | public, | parameter | :: | Z_TYPE_NAME_LEN | = | 4 |
Max. type enumerator name length. |
character(len=*), | public, | parameter | :: | Z_TYPE_NAMES(0:Z_TYPE_LAST) | = | [character(len=Z_TYPE_NAME_LEN)::'none', 'zlib', 'zstd'] |
Compression type enumerator names. |
Generic serialisation and compression function.
Compresses given input and returns the result in allocatable string
output
. The actual length may be smaller than the string length
and is returned in output_len
.
The following compression types are supported:
Z_TYPE_NONE
– No compression (output equals input).Z_TYPE_ZLIB
– Deflate compression.Z_TYPE_ZSTD
– Zstandard compression.The function returns the following error codes:
E_INVALID
if compression type is invalid.E_ZLIB
if zlib library call failed.E_ZSTD
if zstd library call failed.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Uncompressed data. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Compressed data. |
|
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Actual output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises beat beat
to namelist format and compresses it
depending on z
. The serialised and compressed result is returned
in output
. The argument output_len
will equal the length of
output
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(beat_type), | intent(inout) | :: | beat |
Beat type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed beat. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises log log
to namelist format and compresses it depending
on z
. The serialised and compressed result is returned in
output
. The argument output_len
will equal the length of
output
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(log_type), | intent(inout) | :: | log |
Log type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed log. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises node node
to namelist format and compresses it
depending on z
. The serialised and compressed result is
returned in output
. The argument output_len
will equal the
length of output
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(node_type), | intent(inout) | :: | node |
Node type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed node. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises observation observ
to namelist format and compresses it
depending on z
. The serialised and compressed result is returned
in output
. The argument output_len
will equal the length of
output
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(observ_type), | intent(inout) | :: | observ |
Observation type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed observation. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises sensor sensor
to namelist format and compresses it
depending on z
. The serialised and compressed result is
returned in output
. The argument output_len
will equal the
length of output
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sensor_type), | intent(inout) | :: | sensor |
Sensor type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed sensor. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises target target
to namelist format and compresses it
depending on z
. The serialised and compressed result is
returned in output
. The argument output_len
will equal the
length of output
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(target_type), | intent(inout) | :: | target |
Target type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed target. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Generic deserialisation and decompression function.
Uncompresses given input and returns the result in string output
.
The string must be allocated and large enough to hold the
uncompressed data. The actual length may be smaller than the output
length and is returned in output_len
.
The following compression types are supported:
Z_TYPE_NONE
– No compression (output equals input).Z_TYPE_ZLIB
– Deflate compression.Z_TYPE_ZSTD
– Zstandard compression.The function returns the following error codes:
E_INVALID
if compression type is invalid.E_ZLIB
if zlib library call failed.E_ZSTD
if zstd library call failed.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed data. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
character(len=*), | intent(inout) | :: | output |
Uncompressed data. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Actual output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Uncompressed compressed beat namelist input
and returns
deserialised type in beat
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed and Namelist-serialised beat. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
type(beat_type), | intent(out) | :: | beat |
Uncompressed and deserialised beat. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Uncompressed compressed log namelist input
and returns
deserialised type in log
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed and Namelist-serialised log. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
type(log_type), | intent(out) | :: | log |
Uncompressed and deserialised log. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Uncompressed compressed node namelist input
and returns
deserialised type in node
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed and Namelist-serialised node. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
type(node_type), | intent(out) | :: | node |
Uncompressed and deserialised node. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Uncompressed compressed observation namelist input
and returns
deserialised z in observ
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed and Namelist-serialised observation. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
type(observ_type), | intent(out) | :: | observ |
Uncompressed and deserialised observation. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Uncompressed compressed sensor namelist input
and returns
deserialised type in sensor
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed and Namelist-serialised sensor. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
type(sensor_type), | intent(out) | :: | sensor |
Uncompressed and deserialised sensor. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Uncompressed compressed target namelist input
and returns
deserialised type in target
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | input |
Compressed and Namelist-serialised target. |
||
integer, | intent(in) | :: | z |
Input compression enumerator ( |
||
type(target_type), | intent(out) | :: | target |
Uncompressed and deserialised target. |
||
integer(kind=i8), | intent(in), | optional | :: | input_len |
Actual input length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard decompression context to use with type |
Generic validation function.
Returns .true.
if the given compression enumerator z
is
valid. The type Z_TYPE_NONE
is a valid type, and Z_TYPE_INVALID
is invalid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | z |
Compression enumerator. |
Serialises derived type
to namelist format and compresses it
depending on compression type z
. The serialised and compressed
result is returned in output
. The argument output_len
will equal
the length of output
. The function returns E_INVALID
if type
is unsupported.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(*), | intent(inout) | :: | type |
Derived type to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
character(len=:), | intent(out), | allocatable | :: | output |
Serialised and compressed type. |
|
integer(kind=i8), | intent(out), | optional | :: | output_len |
Output length. |
|
type(zstd_context_type), | intent(inout), | optional | :: | context |
Zstandard compression context to use with type |
Serialises derived types types
to namelist format and compresses
them depending on compression type z
. If z
is Z_TYPE_ZSTD
, the
function uses a Zstandard compression context. The serialised and
compressed results are returned in output
. The function returns
E_INVALID
if types
is unsupported. On error, not all strings of
output
may be allocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(*), | intent(inout) | :: | types(:) |
Derived types to serialise and compress. |
||
integer, | intent(in) | :: | z |
Output compression enumerator ( |
||
type(string_type), | intent(out), | allocatable | :: | output(:) |
Serialised and compressed types. |
Returns compression type enumerator from HTTP content encoding:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | encoding |
Content encoding name. |
Returns compression type enumerator from name. The function returns
Z_TYPE_INVALID
if the name is not a valid type name.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name |
Compression enumerator name. |
Returns .true.
if the given compression enumerator z
is
valid. The type Z_TYPE_NONE
is a valid type, and Z_TYPE_INVALID
is invalid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | z |
Compression enumerator. |
Returns compression type name as allocatable string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | z |
Compression enumerator. |
Compression type name.
Returns allocatable HTTP content type string from compression type
enumerator. The function returns an empty string for types
Z_TYPE_INVALID
and Z_TYPE_NONE
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | z |
Compression enumerator. |
Content encoding string.