GitHub    Download    Forum
Overview
Tutorial
C++ API
C# API
DTDL
Comments, Preprocessor
Definitions
Data types
Namespaces
Restrictions
DADL
Setup

Definitions

The Data Type Definition Language is used to describe data types used in a DataFS schema.
DTDL allows users to define classes, lists and structs. Objects inside DataFS contain one or more classes. Lists and structs are used as multi-value attributes.

class

A class has a unique global ID and attributes. Every attribute can be set or empty.
There are two types of attributes: the "fixed" attributes and the "variable" attributes. The system always allocates memory for the fixed attributes, but not for the variable attributes. This makes fixed attributes faster, but they always take up space, even if they are not set/used in the object. On the flip side, variable attributes only use space when they are really used, but provide less performance.
class SampleType [ id({DA249990-6D74-496E-B06A-C0694033665E}) ]
{
    int32    value1;
    wstring  value2;
    double   value2 [v];   // variable attribute
};

struct

A struct has a unique global ID and attributes. Structs cannot contain structs, lists or variable-sized arrays.
Structs are packed into a single binary block and store in one single attribute of a class.
struct SampleStruct [ id({D2223417-CA65-4b3d-9D76-A321983EB758}) ]
{
    int32[3] arrayA;
    wstring  valueB;
    float    valueC;
};

list

A list has a unique global ID and attributes. Lists cannot contain structs, lists or variable-sized arrays.
Like structs, list items are packed into a single binary block. These blocks are then stored inside the list, which itself is stored in one single attribute of a class.
Every list item's first 16 bytes must be unique. The system generates these 16 bytes automatically. If desired, you can set the 'custom key' option if your application can guarantee the uniqueness itself.
list SampleList [ id({BA506E95-D20C-4E9A-8960-2210E7E46F87}), ck ] // ck for "custom key"
{
    object  link;		// unique 16 bytes
    wstring strName;
};

list SampleList [ id({BA506E95-D20C-4E9A-8960-2210E7E46F88}) ]
{
    int value;
};

external

external class eSampleType [ id({327472EB-0685-4022-9481-630393BB8B07}) ];

external struct eSampleStruct [ id({405EAC4E-1083-4595-8C52-F45F65718D4F}) ];

external list eSampleList [ id({503DC255-2D1B-428d-B22B-06A52592701C}) ];
If a class, struct or list is marked as "external", the system expects that the type will be present at install time. This can be useful if you want to use a type inside your definitions without defining them inside your DTDL.

Namespaces

You can group definitions into namespaces. See Namespaces for more information.

Inheritance

Classes, lists and structs can inherit from one or more types. In this case, the action of the compiler can be considered as copy-pasting the inherited types into the inheriting type.

Description

You can place a description in front of a definition. This description will be stored in the schema and can be considered as documentation.
["this is an empty class"]
class q
{};
© 2022 Mobiland AG