About
A maxon::DataType object represents a registered data type of the MAXON API. It is used to check the type of some given data at run time or to write generic template code.
Creation
The maxon::DataType object representing a specific data type can be accessed with maxon::GetDataType():
Definition: datatypebase.h:772
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
- Note
- Further utility functions can be found in the maxon::DataTypeLib.
Conversion
The maxon::DataType object is used to register and apply specific conversions from and to the defined data type.
Available conversion types are:
maxon::DataType::AddConversion<maxon::Vector, IntegerTriplet>(
{
triplet.
_a = 10; triplet._b = 20; triplet._c = 30;
if (dt)
{
maxon::Generic* const generic = reinterpret_cast<maxon::Generic*>(&vec);
}
[datatypes_datatype_declaration]
Definition: custom_datatype.h:25
maxon::Int _a
Definition: custom_datatype.h:29
Definition: datatypebase.h:1800
Result< void > Convert(Generic &dest, const ConstDataPtr &src, CONVERSION_FLAGS ignore=CONVERSION_FLAGS::NONE) const
PyObject * src
Definition: abstract.h:305
CONVERSION_FLAGS
Definition: datatypebase.h:62
Float64 Float
Definition: apibase.h:197
return OK
Definition: apibase.h:2690
@ WIDENING_LOSSY
The conversion contains a widening conversion which is always possible, but it might result in loss o...
@ NONE
When no other flags are set, the conversion is a one-to-one correspondence (such as from Float to Tim...
char ** ptr
Definition: pycore_dtoa.h:13
#define iferr_return
Definition: resultbase.h:1519
DataType Comparison
Two maxon:DataType objects can be compared using the "==" operator or with some more sophisticated functions:
Value Comparison
Using the maxon::DataType object it is also possible two compare two object of this data type:
{
if (!dt)
{
}
else
{
}
}
Bool IsEqual(const void *s1, const void *s2, EQUALITY equality) const
Definition: datatypebase.h:547
COMPARERESULT Compare(const void *s1, const void *s2) const
Definition: datatypebase.h:555
Py_UCS4 * res
Definition: unicodeobject.h:1113
COMPARERESULT
Data type for comparison results.
Definition: compare.h:21
@ DEEP
A deep equality-test shall be done. For pointers or (non-copy-on-write) references the referenced obj...
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
Construct
The maxon::DataType object can be used to create new object instances of the define type:
- maxon::DataType::Create(): Returns a new instance of the type.
- maxon::DataType::Construct(): Creates multiple instances of the type.
- maxon::DataType::MoveConstruct(): Moves constructs multiple instances of the type.
- maxon::DataType::Destruct(): Destroys multiple instances of the type.
- maxon::DataType::MoveFrom(): Moves multiple instances of the type to a target location.
- maxon::DataType::CopyFrom(): Copies multiple instances of the type to the target location.
{
if (!dt)
if (!(isIntDataType || isUIntDataType))
}
Py_ssize_t count
Definition: abstract.h:640
void Construct(void *dest) const
Definition: datatypebase.h:426
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:188
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:181
Interfaces
Also interfaces are registered as a maxon::DataType.
- maxon::DataType::GetImplementation(): Returns the interface implementation of this type.
- maxon::DataType::GetInterfaces(): Returns the interfaces of this object type.
Disc I/O
Data stored in an object of a given maxon::DataType can be written to a file. How this is done is described by a maxon::DataSerializeInterface object.
Properties
The maxon::DataType object gives access to various properties of the described data type:
const char const char * name
Definition: abstract.h:195
String ToString(const FormatStatement *formatStatement=nullptr) const
const Id & GetId() const
Definition: datatypebase.h:828
Definition: apibaseid.h:253
Definition: string.h:1235
The maxon::DataType object also provides information on the type of data:
Int GetAlignment() const
Definition: datatypebase.h:843
Int GetSize() const
Definition: datatypebase.h:837
VALUEKIND GetValueKind() const
Definition: datatypebase.h:267
Py_ssize_t size
Definition: bytesobject.h:86
Int alignment
Definition: apibase.h:738
VALUEKIND
Definition: apibase.h:2315
It is possible to register a data type using MAXON_DATATYPE_REGISTER_STRUCT. This will inform Cinema 4D about public members of the type. The maxon::DataType object can be used to list these public members.
See also maxon::TypeArguments and maxon::Member.
{
if (tupleData)
{
{
}
}
}
Py_ssize_t i
Definition: abstract.h:645
PyObject * args
Definition: abstract.h:159
const TupleDataType & GetTupleType() const
Definition: datatypebase.h:969
VALUEKIND GetValueKind() const
Definition: datatypebase.h:850
const TypeArguments & GetTypeArguments() const
Definition: datatypebase.h:935
Definition: datatypelib.h:768
enum PyUnicode_Kind kind
Definition: unicodeobject.h:669
@ STRUCT
The data type has an underlying TupleDataType with named members.
Member represents a member of struct-like types or function signatures. A member is just a pair of a ...
Definition: datatypelib.h:353
InternedId name
The name of the member, this may be empty where anonymous members are allowed.
Definition: datatypelib.h:407
DataType type
The type of the member.
Definition: datatypelib.h:406
Definition: datatypelib.h:429
Further Reading