DSMDefinitions

class dsviper.DSMDefinitions

Bases: object

A parsed model, whole.

The definitions it declares plus the function pools attached to them. Serialises to and from a blob.

Note: Not directly instantiable.

attachment_function_pools() → list[DSMAttachmentFunctionPool]

Return the list of attachment function pools.

attachments() → list[DSMAttachment]

Return the list of attachments.

static bson_decode(blob: ValueBlob) → DSMDefinitions

Return a DSMDefinitions from a bson encoded blob.

bson_encode() → ValueBlob

Return the definitions in bson.

clubs() → list[DSMClub]

Return the list of clubs.

concepts() → list[DSMConcept]

Return the list of concepts.

static decode(blob: ValueBlob, *, stream_codec_instancing: StreamCodecInstancing | None = None) → DSMDefinitions

Return the decoded DSMDefinitions with Codec.STREAM_TOKEN_BINARY if not specified.

encode(*, stream_codec_instancing: StreamCodecInstancing | None = None) → ValueBlob

Return the blob that encodes the definitions with Codec.STREAM_TOKEN_BINARY if not specified.

enumerations() → list[DSMEnumeration]

Return the list of enumerations.

static from_attachment_function_pool(attachment_function_pool: AttachmentFunctionPool, definitions: DefinitionsConst) → DSMDefinitions

Return the DSM declarations of attachment_function_pool.

The types it references are resolved against definitions.

attachment_function_pool is a runtime AttachmentFunctionPool - the live object a C++ host registered - not the DSMAttachmentFunctionPool that attachment_function_pools() answers.

static from_definitions(definitions: DefinitionsConst) → DSMDefinitions

Return the DSM declarations of every type and attachment definitions holds.

static from_function_pool(function_pool: FunctionPool, definitions: DefinitionsConst) → DSMDefinitions

Return the DSM declarations of function_pool.

The types it references are resolved against definitions.

function_pool is a runtime FunctionPool - the live object a C++ host registered - not the DSMFunctionPool that function_pools() answers.

static from_xml_string(xml_string: str) → DSMDefinitions

Return a DSMDefinitions from an XML encoded string.

function_pools() → list[DSMFunctionPool]

Return the list of function pools.

static json_decode(json_string: str) → DSMDefinitions

Return a DSMDefinitions from a JSON encoded string.

json_encode(indent: int = -1) → str

Encode and return the definitions in a JSON encoded string. If indent is specified, the string is pretty printed.

static read(stream_reading: StreamReading) → DSMDefinitions

Return a DSMDefinitions.

structures() → list[DSMStructure]

Return the list of structures.

to_definitions() → Definitions

Return a Definitions by converting all DSM definitions.

to_dsm(*, show_documentation: bool = True, show_runtime_id: bool = False, html: bool = False, attachments: list[DSMAttachment] | None = None) → str

Return the DSM source of these declarations.

The output is grouped by attachment, two blocks each: the types it depends on, sorted so that every type comes after what it needs, then the attachment itself - the types, then the mapping that persists a document of them under a key. A namespace therefore opens once per block, because each block declares into it: the first the types, the second the attachment. A comment on each says which it is. attachments restricts the output to those attachments and what they depend on; empty or unset renders all of them. show_documentation keeps the doc comments, show_runtime_id annotates each declaration with its runtime id, and html wraps every token in a <span> carrying a colour class.

to_xml_string(indent: int = -1) → str

Encode and return the definitions in an XML encoded string. If indent is specified, the string is pretty printed.

write(stream_writing: StreamWriting) → None

Write the definitions with the StreamWriting interface.