1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// @generated by openehr-codegen from BMM (`P_BMM_CLASS`) — DO NOT EDIT.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0
// Hand-written spec functions/invariants live in the sibling `*_impl.rs`.
//! The openEHR `P_BMM_CLASS` spec class, generated from the vendored BMM
//! meta-model.
use crate::v1_1::bmm::core::bmm_class::BmmClass;
use crate::v1_1::bmm_persistence::p_bmm_base_type::PBmmBaseType;
use crate::v1_1::bmm_persistence::p_bmm_constant::PBmmConstant;
use crate::v1_1::bmm_persistence::p_bmm_enumeration::PBmmEnumeration;
use crate::v1_1::bmm_persistence::p_bmm_function::PBmmFunction;
use crate::v1_1::bmm_persistence::p_bmm_generic_parameter::PBmmGenericParameter;
use crate::v1_1::bmm_persistence::p_bmm_interface::PBmmInterface;
use crate::v1_1::bmm_persistence::p_bmm_property::PBmmProperty;
/// Definition of persistent form of `BMM_CLASS` for serialisation to ODIN, JSON, XML etc.
#[doc(alias = "P_BMM_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub struct PBmmClassData {
// inherited: P_BMM_MODEL_ELEMENT
/// Optional documentation of this element.
pub documentation: Option<String>,
/// Name of the class. Persisted attribute.
pub name: String,
/// List of immediate inheritance parents. If there are generic ancestors, use `_ancestor_defs_` instead. Persisted attribute.
pub ancestors: Option<Vec<String>>,
/// Constants defined in this class, keyed by name. Persistent attribute.
pub constants: Option<std::collections::BTreeMap<String, PBmmConstant>>,
/// Properties defined in this class, keyed by name. Persisted attribute.
pub properties: Option<std::collections::BTreeMap<String, PBmmProperty>>,
/// Functions (routines) defined in this class, keyed by name. Persisted attribute.
pub functions: Option<std::collections::BTreeMap<String, PBmmFunction>>,
/// Invariants defined on this class, as a Hash of assertion expressions keyed by tag. Persisted attribute.
pub invariants: Option<std::collections::BTreeMap<String, String>>,
/// True if this is an abstract type. Persisted attribute.
pub is_abstract: Option<bool>,
/// True if this class definition overrides one found in an included schema.
pub is_override: Option<bool>,
/// Generic parameter definitions, keyed by parameter name. Persisted attribute.
pub generic_parameter_defs: Option<indexmap::IndexMap<String, PBmmGenericParameter>>,
/// Reference to original source schema defining this class.
///
/// Set during `BMM_SCHEMA` materialise. Useful for GUI tools to enable user to edit the schema file containing a given class (i.e. taking into account that a class may be in any of the schemas in a schema inclusion hierarchy).
pub source_schema_id: String,
/// `BMM_CLASS` object built by `_create_bmm_class_definition_` and `_populate_bmm_class_definition_`.
pub bmm_class: Option<BmmClass>,
/// Unique id generated for later comparison during merging, in order to detect if two classes are the same. Assigned in post-load processing.
pub uid: i32,
/// Structured inheritance ancestors, keyed by type signature, e.g. `GENERIC_PARENT<T,SUPPLIER_B>`.
///
/// Used instead of `_ancestors_` when the class has a generic ancestor; any non-generic ancestor of the same class is then also listed here, as a `P_BMM_SIMPLE_TYPE`. Persisted attribute.
pub ancestor_defs: Option<std::collections::BTreeMap<String, PBmmBaseType>>,
}
/// Polymorphic slot of `P_BMM_CLASS`, dispatched on each payload's `_type`.
///
/// Definition of persistent form of `BMM_CLASS` for serialisation to ODIN, JSON, XML etc.
#[doc(alias = "P_BMM_CLASS")]
#[derive(Debug, Clone, PartialEq)]
pub enum PBmmClass {
/// The `P_BMM_ENUMERATION` subtype of `P_BMM_CLASS`.
PBmmEnumeration(PBmmEnumeration),
/// The `P_BMM_INTERFACE` subtype of `P_BMM_CLASS`.
PBmmInterface(PBmmInterface),
/// An instance of `P_BMM_CLASS` itself (its own, least-rich form).
PBmmClass(PBmmClassData),
}