SetNameOfClass

Sets or updates the name of the class, it returns 0 on success.

Error return codes:
    0 successful
    1 argument owlClass is incorrect (not a proper handle to an active class)
    2 argument name is incorrect (nullptr or zero length name)
    3 the name of owlClass is locked
    4 name is already used by another class
    5 name is already used by a property
    6 name is already used by an instance
    7 undefined error

Syntax

//
//   Strong typing definition
//
int64_t         SetNameOfClass(
                        OwlClass                owlClass,
                        const char              * name
                    );

static  inline  int64_t SetNameOfClass(
                                OwlClass                owlClass,
                                char                    * name
                            )
{
    return  SetNameOfClass(
                    owlClass,
                    (const char*) name
                );
}


//
//   Weak typing definition
//
int64_t __declspec(dllexport) __stdcall SetNameOfClass(
                                                int64_t                 owlClass,
                                                const char              * name
                                            );

static  inline  int64_t SetNameOfClass(
                                int64_t                 owlClass,
                                char                    * name
                            )
{
    return  SetNameOfClass(
                    owlClass,
                    (const char*) name
                );
}
    

Property owlClass

Size: 64 bit / 8 byte (value)
This attribute represents a handle to the class. The term owl is comming from W3C, the classes follow the expression power of Semantic Web concepts, therefore classes support multiple inheritance. Technically classes can also be distributed over different resources, however for this the parametric library is required as an extension on the basic Geometry Kernel API.

Property name

Size: 32 bit / 4 byte (reference)
This attribute represents the name of the class (given as char array / ASCII). The name is given by the host and the attribute is not changed.

Example (based on pure API calls)

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

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

int64_t model = CreateModel();

if (model) {
    //
    //  Classes
    //
    int64_t myClass = CreateClass(model, "MyCreatedClass");

    //
    //  Datatype Properties (attributes)
    //
    int64_t propertyLength = GetPropertyByName(model, "length");

    //
    //  Instances (creating)
    //
    int64_t myInstance = CreateInstance(myClass, nullptr);

    double  length = 2.;

    SetDatatypeProperty(myInstance, propertyLength, &length, 1);

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

    char    * classNameI = nullptr;
    GetNameOfClass(myClass, &classNameI);

    SetNameOfClass(myClass, "OtherClassName");

    char    * classNameII = nullptr;
    GetNameOfClass(myClass, &classNameII);

    SetClassParent(myClass, GetClassByName(model, "Cube"), 1);

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

    SetNameOfClass(myClass, "OutOfIdeasForClassName");

    char    * classNameIII = nullptr;
    GetNameOfClass(myClass, &classNameIII);

    //
    //  The retrieved class names have the following values 
    //      classNameI   :  'MyCreatedClass'
    //      classNameII  :  'OtherClassName'
    //      classNameIII :  'OutOfIdeasForClassName'
    //

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