GitHub    Download    Forum
Overview
Tutorial
C++ API
C# API
DTDL
DADL
Comments, Preprocessor
Definitions
BitFlagSets
Linking objects
Setup

Definitions

Reading and writing objects to a database has to be done in a specific way. By defining types that can be compiled to various programming languages and can be used inside an application, this process can be performed using an object-like approach that is a familiar feature of lots of programming languages.
The types defined in DADL provide a way of grouping the types defined in DTDL and building objects from it.

object

Objects are the main elements in DADL. An object is defined by selecting the DTDL classes it should contain and the attributes that access functions should be generated for.
object WMyObject
{
    MyClass
    {
        Title       [ get, set, remove ];
        Description [ get, set, remove ];
    }

    MailServer::Class2
    {
        Link URL    [ get, set ];
    }
};
The example defines an object with two DTDL classes and functions for three attributes. The 'Link' attribute will be renamed to 'URL' inside the 'WMyObject' class.
The table below shows the supported function types.
FunctionDescription
get Reads the attribute.
set Sets the attribute.
set(ClassName) Sets the attribute to the ObjectId of the passed object of type 'ClassName'.
remove Removes the attribute.
link(ClassName) Sets the attribute to this ObjectLink.
open(ClassName) Reads the attribute and opens the object as type 'ClassName'.

list, struct

Lists and structs do not have a real definition. They use the structure given by the DTDL definition.
All that is needed is to import the type and use it. If no name is defined for it, the name of the DTDL datatype will be used. A name for the type can be defined by using a list or struct definition.
// define WMyList to use the DTDL list MyList of namespace a::b
list WMyList a::b::MyList;

// define WMyStruct to use the DTDL struct TheStruct of the global namespace
struct WMyStruct TheStruct;

list WMyOtherList a::b::MyOtherList
{
    LinkedObject    LObj  [ set(Class) ];
    LinkedObject    RObj  [ link(Class) ];
};
For setting ObjectId or stcObjectLink attributes the same way as is done in objects, structs and lists support a set of functions.
The table below shows the supported function types.
FunctionDescription
set(ClassName) Sets the attribute to the ObjectId of the passed object of type 'ClassName'.
link(ClassName) Sets the attribute to this ObjectLink.
© 2022 Mobiland AG