`ocean.util.serialize.model.*`
collection of generic parts of serializer/decorator implementations
`ocean.util.serialize.pkgname.Serializer`
`ocean.util.serialize.pkgname.Deserializer`
`ocean.util.serialize.pkgname.*Decorator`
actual modules to be used by applications. `pkgname` here represents
specific serialization format, one sub-package for each new format. There can
be more modules exposed to applications depending on specific format but
those are minimal ones you should expect. Decorator implementation count may
vary from 0 to many depending on actual needs.
`ocean.util.serialize.pgkname.model.*`
any internal modules used to implement `pkgname` serializer / decorators
If you are going to implement and new serialization format, more detailed
knowledge of this package internal is needed. Most important module to become
familiar with is `ocean.util.model.Traits` - it defines set of `isSomething`
templates that help to ensure that given serializer / decorators conforms the
standard API. `ocean.util.serialize` uses duck typing approach so there does
not need to be any common base. In fact, serializers are commonly implemented
as static structs.
New format package must have at minimum `Serializer` and `Deserilaizer`
modules. Put `static assert (isSerializer!(This));` and
`static assert (isDeserializer!(This))` at the beginning of actual aggregate
definition to ensure that API is conformant. However you may want to disable
that asssertion during initial development stage because DMD1 tends to hide
any compiler error messages showing assertion failure instead.
`Decorator` implementation is allowed to be non-static (so that it can keep
any intermediate data buffers). As decorator methods are typically templated,
one can't use abstract class / override approach for common parts. Technique
used in existing `VersionDecorator` is to define set of template mixins that
implement common methods and inject those directly to implementation classes.
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details.
Alternatively, this file may be distributed under the terms of the Tango
3-Clause BSD License (see LICENSE_BSD.txt for details).
Terminology
`ocean.util.serialize.model.*` collection of generic parts of serializer/decorator implementations
`ocean.util.serialize.pkgname.Serializer` `ocean.util.serialize.pkgname.Deserializer` `ocean.util.serialize.pkgname.*Decorator` actual modules to be used by applications. `pkgname` here represents specific serialization format, one sub-package for each new format. There can be more modules exposed to applications depending on specific format but those are minimal ones you should expect. Decorator implementation count may vary from 0 to many depending on actual needs.
`ocean.util.serialize.pgkname.model.*` any internal modules used to implement `pkgname` serializer / decorators
Usage
If you are going to implement and new serialization format, more detailed knowledge of this package internal is needed. Most important module to become familiar with is `ocean.util.model.Traits` - it defines set of `isSomething` templates that help to ensure that given serializer / decorators conforms the standard API. `ocean.util.serialize` uses duck typing approach so there does not need to be any common base. In fact, serializers are commonly implemented as static structs.
New format package must have at minimum `Serializer` and `Deserilaizer` modules. Put `static assert (isSerializer!(This));` and `static assert (isDeserializer!(This))` at the beginning of actual aggregate definition to ensure that API is conformant. However you may want to disable that asssertion during initial development stage because DMD1 tends to hide any compiler error messages showing assertion failure instead.
`Decorator` implementation is allowed to be non-static (so that it can keep any intermediate data buffers). As decorator methods are typically templated, one can't use abstract class / override approach for common parts. Technique used in existing `VersionDecorator` is to define set of template mixins that implement common methods and inject those directly to implementation classes.