GetNameOfPropertyEx

Returns the name of the property, if the property does not exist it returns nullptr.

Syntax

//
//   Strong typing definition
//
const char      * GetNameOfPropertyEx(
                        OwlModel                model,
                        RdfProperty             rdfProperty,
                        const char              ** name
                    );

static  inline  const char  * GetNameOfPropertyEx(
                                    OwlModel                model,
                                    RdfProperty             rdfProperty,
                                    char                    ** name
                                )
{
    return  GetNameOfPropertyEx(
                    model,
                    rdfProperty,
                    (const char**) name
                );
}

static  inline  const char  * GetNameOfPropertyEx(
                                    OwlModel                model,
                                    RdfProperty             rdfProperty
                                )
{
    return  GetNameOfPropertyEx(
                    model,
                    rdfProperty,
                    (const char**) nullptr              //    name
                );
}


//
//   Weak typing definition
//
const char  __declspec(dllexport) * __stdcall   GetNameOfPropertyEx(
                                                        int64_t                 model,
                                                        int64_t                 rdfProperty,
                                                        const char              ** name
                                                    );

static  inline  const char  * GetNameOfPropertyEx(
                                    int64_t                 model,
                                    int64_t                 rdfProperty,
                                    char                    ** name
                                )
{
    return  GetNameOfPropertyEx(
                    model,
                    rdfProperty,
                    (const char**) name
                );
}

static  inline  const char  * GetNameOfPropertyEx(
                                    int64_t                 model,
                                    int64_t                 rdfProperty
                                )
{
    return  GetNameOfPropertyEx(
                    model,
                    rdfProperty,
                    (const char**) nullptr              //    name
                );
}
    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property rdfProperty

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the property, this can be either a datatype property (attribute), an object property (relation) or non-defined property. The handle will be static during the life-time of the model, when the model (or part of it) is saved and opened again, the handle will most probably be different.

Property name

Size: 64 bit / 8 byte (reference)
This attribute represents the name of the property; either a datatype property or a relation (given as char array / ASCII). The name is defined in space allocated by the library, this memory will be released as soon as the model is closed, or memory release is forced by CleanMemory.

Example (based on pure API calls)

Here you can find code snippits that show how the API call GetNameOfPropertyEx can be used.

#include    "./include/engine.h"
#include    <cmath>

int64_t model = CreateModel();

if (model) {
    //
    //  The following setting makes sure all properties handled are in an ordered list
    //  In certain cases where several models are open or in case of conversion
    //  between formats this can be handy and / or time efficient.
    //
    int64_t propertyCnt = 0;
    OrderedHandles(model, nullptr, &propertyCnt, nullptr, 2, 2);

    //
    //  Classes
    //
    int64_t classCollection = GetClassByName(model, "Collection"),
            classCube = GetClassByName(model, "Cube");

    //
    //  Object Properties (relations)
    //
    int64_t propertyAbcd = CreateProperty(model, OBJECTPROPERTY_TYPE, "abcd"),
            propertyObjects = GetPropertyByName(model, "objects");
    assert(propertyAbcd == propertyCnt + 1);
    assert(propertyObjects > 0 && propertyObjects <= propertyCnt);

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyLength = GetPropertyByName(model, "length"),
            propertyEfgh = CreateProperty(model, DATATYPEPROPERTY_TYPE_DOUBLE, "efgh");
    assert(propertyLength > 0 && propertyLength <= propertyCnt);
    assert(propertyEfgh == propertyCnt + 2);

    //
    //  Instances (creating)
    //
    int64_t instanceCollection = CreateInstance(classCollection, nullptr),
            instanceCube = CreateInstance(classCube, nullptr);

    double  length = 2.,
            efgh = 1.7;

    SetDatatypeProperty(instanceCube, propertyLength, &length, 1);
    SetDatatypeProperty(instanceCollection, propertyEfgh, &efgh, 1);

    assert(GetVolume(instanceCollection, 0, 0) == 0.);

    char    * propertyNameI = nullptr;
    GetNameOfPropertyEx(model, propertyAbcd, &propertyNameI);

    char    * propertyNameII = nullptr;
    GetNameOfPropertyEx(model, propertyEfgh, &propertyNameII);

    SetNameOfPropertyEx(model, propertyAbcd, "InverseRelationControledByThirdParty");

    SetObjectProperty(instanceCube, propertyAbcd, &instanceCollection, 1);
    SetObjectProperty(instanceCollection, propertyObjects, &instanceCube, 1);

    assert(GetVolume(instanceCollection, 0, 0) == 8.);

    char    * propertyNameIII = nullptr;
    GetNameOfPropertyEx(model, propertyAbcd, &propertyNameIII);

    //
    //  The retrieved property names have the following values 
    //      propertyNameI   :  'abcd'
    //      propertyNameII  :  'efgh'
    //      propertyNameIII :  'InverseRelationControledByThirdParty'
    //

    //
    //  The resulting model can be viewed in 3D-Editor.exe
    //
    SaveModel(model, "c:\\created\\myFile.bin");
    CloseModel(model);
}