TEMU
4.4
The Terma Emulator
|
#include "temu-c/Support/Attributes.h"
#include "temu-c/Support/Temu2Compat.h"
#include "temu-c/Support/Temu3Compat.h"
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | temu_Buff |
struct | temu_Object |
struct | temu_IfaceRef |
struct | temu_IfaceRefArray |
struct | temu_Propref |
struct | temu_PropName |
struct | temu_Vector |
struct | temu_List |
struct | temu_Propval |
struct | temu_CreateArg |
struct | temu_Class |
struct | temu_PropAccessor |
struct | temu_PropInfo |
struct | temu_ObjectIface |
Macros | |
#define | TEMU_PLUGIN_INIT TEMU_API void temu_pluginInit(void) |
#define | TEMU_NO_WRAP |
#define | TEMU_BUFF_DEFINED |
#define | TEMU_COMPONENT_DEFINED |
#define | TEMU_IFACE_REFERENCE_TYPE(N) |
#define | TEMU_DYN_ARRAY_TYPE(T, P) |
#define | TEMU_NULL_ARG |
#define | PROP_ASSERT(p, t) |
#define | PROP_VAL_INITIALIZER(typ, suffix, typetag, valtag) |
#define | TEMU_QUAL_NONE 0 |
#define | TEMU_QUAL_CPU 1 |
#define | TEMU_QUAL_MACHINE 2 |
#define | TEMU_QUAL_MEMORY 4 |
#define | TEMU_QUAL_COMPONENT 5 |
#define | TEMU_QUAL_CLOCK 6 |
#define | TEMU_QUAL_USER 65536 |
#define | TEMU_OBJECT_IFACE_TYPE "ObjectIface" |
Typedefs | |
typedef struct temu_Component | temu_Component |
typedef struct temu_Class | temu_Class |
typedef void | temu_MetaIface |
typedef struct temu_TimeSource | temu_TimeSource |
typedef struct temu_Object | temu_Object |
typedef struct temu_IfaceRef | temu_IfaceRef |
typedef struct temu_IfaceRefArray | temu_IfaceRefArray |
typedef enum temu_Type | temu_Type |
typedef struct temu_Propref | temu_Propref |
typedef void | temu_Dict |
typedef void | temu_ListNode |
typedef struct temu_Propval | temu_Propval |
typedef struct temu_CreateArg | temu_CreateArg |
typedef void *(* | temu_ObjectCreateFunc) (const char *Name, int Argc, const temu_CreateArg *Argv) |
typedef void(* | temu_ObjectDisposeFunc) (void *) |
typedef void(* | temu_PropWriter) (void *Obj, temu_Propval Pv, int Idx) |
typedef temu_Propval(* | temu_PropReader) (void *Obj, int Idx) |
typedef struct temu_PropAccessor | temu_PropAccessor |
typedef void | temu_TypeObject |
Enumerations | |
enum | temu_Type { teTY_Invalid, teTY_Intptr, teTY_Uintptr, teTY_Float, teTY_Double, teTY_U8, teTY_U16, teTY_U32, teTY_U64, teTY_I8, teTY_I16, teTY_I32, teTY_I64, teTY_Obj, teTY_InternalPtr, teTY_IfaceRef, teTY_IfaceRefArray, teTY_String, teTY_Buffer, teTY_Dict, teTY_Vector, teTY_List } |
#define PROP_ASSERT | ( | p, | |
t | |||
) |
#define PROP_VAL_INITIALIZER | ( | typ, | |
suffix, | |||
typetag, | |||
valtag | |||
) |
#define TEMU_BUFF_DEFINED |
#define TEMU_COMPONENT_DEFINED |
#define TEMU_DYN_ARRAY_TYPE | ( | T, | |
P | |||
) |
#define TEMU_IFACE_REFERENCE_TYPE | ( | N | ) |
Easy way of declaring typed interface references and interface reference arrays.
#define TEMU_NO_WRAP |
#define TEMU_NULL_ARG |
#define TEMU_OBJECT_IFACE_TYPE "ObjectIface" |
#define TEMU_PLUGIN_INIT TEMU_API void temu_pluginInit(void) |
#define TEMU_QUAL_CLOCK 6 |
#define TEMU_QUAL_COMPONENT 5 |
#define TEMU_QUAL_CPU 1 |
#define TEMU_QUAL_MACHINE 2 |
#define TEMU_QUAL_MEMORY 4 |
#define TEMU_QUAL_NONE 0 |
#define TEMU_QUAL_USER 65536 |
typedef struct temu_Class temu_Class |
typedef struct temu_Component temu_Component |
typedef struct temu_CreateArg temu_CreateArg |
Generic constructor argument
The object constructors takes an array of key/value pairs as parameters. The values are passed using either:
Class.new
command method.temu_createObject()
.object-create
global command.The object create function would typically scan through the array, finding relevant matching keys.
typedef void temu_Dict |
typedef struct temu_IfaceRef temu_IfaceRef |
Generic interface
In TEMU interfaces are referred to using an object / interface pointer pair. The object is in general passed as the first parameter to functions in the interface. This type provides a generic interface reference where the interface pointer itself is type erased.
While the type is rarely used by itself, it is commonly returned by the TEMU API. To convert to / from this type from / to typed interface references, it is possible to either memcopy or cast field by field.
typedef struct temu_IfaceRefArray temu_IfaceRefArray |
Dynamic interface reference array
In some cases, the number of objects we know about is unknown. To solve that TEMU provides a vector like type.
temu_ifaceRefArray*
functions. typedef void temu_ListNode |
typedef void temu_MetaIface |
typedef struct temu_Object temu_Object |
Root object type for all TEMU objects.
The TEMU object system is used for defining models in TEMU. All models must derive from temu_Object
.
Inheritance in C is done by placing a temu_Object
field as the first field in the derived struct.
TEMU by convention use the name Super
for the parent field name.
The type contains a UserData
void pointer that can be used by for example simulator integrators. The UserData
field can be written by the user. The field is guaranteed to not be modified by the TEMU runtime.
typedef void*(* temu_ObjectCreateFunc) (const char *Name, int Argc, const temu_CreateArg *Argv) |
typedef void(* temu_ObjectDisposeFunc) (void *) |
typedef struct temu_PropAccessor temu_PropAccessor |
! Generic property accessor
This struct serves as a generic accessor for properties. The intention for this is to be able to cache property accessors, without having to disambiguate between properties and pseudo properties.
The accessor is queried by the temu_getPropAccessor function, and is then used by calling the functions:
readProp
writeProp
getProp
setProp
Depending on whether read, write, get or set semantics is needed.
typedef temu_Propval(* temu_PropReader) (void *Obj, int Idx) |
A prop reader function is provided when properties are registered, it is responsible for reading the property when temu_readValue is called. The function can be used to introduce side-effects on reads unlike the getValue which will never have side-effects and only returns the raw value.
typedef struct temu_Propref temu_Propref |
Typed property reference.
The property reference contains a type tag and a raw pointer to the property.
typedef struct temu_Propval temu_Propval |
Generic property value.
As properties can be of any normal type, the propval struct provides a sum type/tagged union which contain both the type tag and the property value.
typedef void(* temu_PropWriter) (void *Obj, temu_Propval Pv, int Idx) |
A prop writer function is provided when properties are registered, it is responsible for writing the property when temu_writeValue is called. The function can be used to introduce side-effects on writes unlike the setValue which will never have side-effects and only sets the raw value.
typedef struct temu_TimeSource temu_TimeSource |
Type tag
The TEMU object system uses type tags to track which type is registered and in use at runtime. Type tags are used in for example the property registration functions.
typedef void temu_TypeObject |
enum temu_Type |
Type tag
The TEMU object system uses type tags to track which type is registered and in use at runtime. Type tags are used in for example the property registration functions.
Enumerator | |
---|---|
teTY_Invalid | Invalid value 0. |
teTY_Intptr | Pointer sized signed integer (intptr_t) |
teTY_Uintptr | Pointer sized unsigned integer (uintptr_t) |
teTY_Float | Single precision floating point value. |
teTY_Double | Double precision floating point value. |
teTY_U8 | 8-bit fixed width unsigned integer |
teTY_U16 | 16-bit fixed width unsigned integer |
teTY_U32 | 32-bit fixed width unsigned integer |
teTY_U64 | 64-bit fixed width unsigned integer |
teTY_I8 | 8-bit fixed width signed integer |
teTY_I16 | 16-bit fixed width signed integer |
teTY_I32 | 32-bit fixed width signed integer |
teTY_I64 | 64-bit fixed width signed integer |
teTY_Obj | Pointer to temu_Object. |
teTY_InternalPtr | Internal pointer. |
teTY_IfaceRef | Interface reference. |
teTY_IfaceRefArray | Dynamic object/interface array. |
teTY_String | C-string, useful for serialization. |
teTY_Buffer | Buffer (see Buffer.h) |
teTY_Dict | Dictionary. |
teTY_Vector | Vector (i.e. dynamic array) |
teTY_List | List. |
TEMU_API int temu_addArrayProperty | ( | temu_Class * | Cls, |
const char * | Name, | ||
int | offset, | ||
temu_Type | T, | ||
int | NumElems, | ||
const char * | Doc | ||
) |
Add a fixed length array property without setters / getters
Cls | Class pointer |
Name | Name of property |
offset | Offset from object pointer |
T | Property type |
NumElems | Array length |
Doc | Documentation string |
TEMU_API int temu_addArrayPseudoProperty | ( | temu_Class * | Cls, |
const char * | Name, | ||
temu_Type | T, | ||
int | NumElems, | ||
const char * | Doc | ||
) |
Add an array pseudo-property
Cls | Class pointer |
Name | Name of property |
T | Property type |
NumElems | Array length |
Doc | Documentation string |
TEMU_API void temu_addInterface | ( | temu_Class * | Cls, |
const char * | IfaceName, | ||
const char * | IfaceType, | ||
void * | Iface, | ||
int | DeprecatedParam, | ||
const char * | Doc | ||
) |
Register interface with the named class.
Cls_name | Name of class to add interface to |
Ifacename | Interface name |
IfaceType | Interface type |
Iface | Pointer to the interface structure. |
TEMU_API void temu_addInterfaceArray | ( | temu_Class * | Cls, |
const char * | IfaceName, | ||
const char * | IfaceType, | ||
void * | Iface, | ||
size_t | Count, | ||
size_t | Size, | ||
const char * | Doc | ||
) |
Add an array of interfaces to a class
Interface arrays are especially useful when e.g. multiple "network ports" are available, although they can be added manually with distinct names (e.g. uartaiface, uartbiface, etc), the interface array registration allows for the addition of several interfaces at once. Individual interfaces are then referred to with normal index syntax, e.g. obj:uartiface[0].
Cls | Class pointer |
IfaceName | name of interface |
IfaceType | name of interface type |
Iface | Pointer to array of interfaces |
Count | Number of interfaces in array |
Size | Size of one interface (e.g. sizeof(uartiface[0])) |
Doc | Documentation comment for interface |
TEMU_API void temu_addInterfaceReference | ( | temu_Class * | Cls, |
const char * | PropName, | ||
int | Offset, | ||
const char * | TypeName, | ||
int | Count, | ||
unsigned | Flags, | ||
temu_PropWriter | Wr, | ||
temu_PropReader | Rd, | ||
const char * | Doc | ||
) |
Add a interface reference property.
Cls | The class object |
PropName | Name of the property to add. |
Offset | Offset in bytes from the start of the class to the value the property refers to. |
TypeName | Interface type name. |
Count | Set to > 1 to indicate that the property is an array, the value is the length of the array. |
Flags | Flags for property, 1 implies property is mandatory to set. |
Wr | Property write function. This function can have side-effects. |
Rd | Property read function. This function can have side-effects. |
Doc | Documentation string |
TEMU_API int temu_addLoggingCategory | ( | temu_Class * | Cls, |
unsigned | CategoryId, | ||
const char * | Category | ||
) |
temu_addLogginCategory adds a logging category to the class
Cls | the class |
CategoryId | The category id. Valid range is [8,16) |
Category | The category name |
TEMU_API int temu_addPort | ( | temu_Class * | C, |
const char * | IfaceRefName, | ||
const char * | IfaceName, | ||
const char * | Doc | ||
) |
Make interface reference property and an interface inverses
A port is a bidirectional interface. Thus, if an interface reference is connected to another objects interface, the remote object will be told to issue a reverse connection. This is convenient as it simplifies device connection during system configuration and construction. That is, instead of calling the connect two times with the inverse connections explicitly, only one call is needed.
C | The class object |
IfaceRefName | the name of the interface reference property |
IfaceName | Name of interface that is the inverse of the interface ref property. |
Doc | Documentation string |
TEMU_API void temu_addProperty | ( | temu_Class * | Cls, |
const char * | PropName, | ||
int | Offset, | ||
temu_Type | Typ, | ||
int | Count, | ||
temu_PropWriter | Wr, | ||
temu_PropReader | Rd, | ||
const char * | Doc | ||
) |
Add a property to a class.
Cls | The class object |
PropName | Name of the property to add. |
Offset | Offset in bytes from the start of the class to the value the property refers to. |
Typ | Type of the property. |
Count | Set to > 1 to indicate that the property is an array, the value is the length of the array. |
Wr | Property write function. This function can have side-effects. |
Rd | Property read function. This function can have side-effects. |
Doc | Documentation string |
TEMU_API void temu_addPseudoInterfaceReference | ( | temu_Class * | Cls, |
const char * | PropName, | ||
const char * | TypeName, | ||
int | Count, | ||
unsigned | Flags, | ||
temu_PropWriter | Wr, | ||
temu_PropReader | Rd, | ||
temu_PropWriter | Set, | ||
temu_PropReader | Get, | ||
const char * | Doc | ||
) |
Add a interface reference property.
Cls | The class object |
PropName | Name of the property to add. |
TypeName | Interface type name. |
Count | Set to > 1 to indicate that the property is an array, the value is the length of the array. |
Flags | Flags for property, 1 implies property is mandatory to set. |
Wr | Property write function. This function can have side-effects. |
Rd | Property read function. This function can have side-effects. |
Set | Property set function. Non-semantic. |
Get | Property get function. Non-semantic. |
Doc | Documentation string |
TEMU_API void temu_addPseudoProperty | ( | temu_Class * | Cls, |
const char * | PropName, | ||
temu_Type | Typ, | ||
int | Count, | ||
temu_PropWriter | Wr, | ||
temu_PropReader | Rd, | ||
temu_PropWriter | Set, | ||
temu_PropReader | Get, | ||
const char * | Doc | ||
) |
Add property without storage
A pseudo property does not have backing storage (and therefore no offset). They exist to provide access to computed properties.
Pseudo properties also work fine with C++ types with non-standard layout.
Pseudo properties are snapshotted if the set and get functions are implemented. The set and get should implement read and write without semantic effect. That is, if the property is a register, then the read and write should have the effect of an actual register access (including event rescheduling etc), while for a get/set, only the value of the register is modified, event restoration is done differently.
Cls | class to add pseudo property to |
PropName | name of pseudo property |
Typ | Type of property |
Count | number of elements, 1 for a scalar. |
Wr | Property write function (semantic effect) |
Rd | Property read function (semantic effect) |
Set | Property set function (non-semantic) |
Get | Property get function (non-semantic) |
Doc | Documentation string |
TEMU_API int temu_addScalarProperty | ( | temu_Class * | Cls, |
const char * | Name, | ||
int | offset, | ||
temu_Type | T, | ||
const char * | Doc | ||
) |
Add a scalar (one element) property without setters / getters
Cls | Class pointer |
Name | Name of property |
offset | Offset from object pointer |
T | Property type |
Doc | Documentation string |
TEMU_API int temu_addScalarPseudoProperty | ( | temu_Class * | Cls, |
const char * | Name, | ||
temu_Type | T, | ||
const char * | Doc | ||
) |
Add a scalar (one element) pseudo-property
Cls | Class pointer |
Name | Name of property |
T | Property type |
Doc | Documentation string |
TEMU_API double temu_asDouble | ( | temu_Propval | Pv | ) |
Converts the given property to double
Pv | The property to be converted |
TEMU_API int64_t temu_asInteger | ( | temu_Propval | Pv | ) |
Converts the given propery to integer
Pv | The property to be converted |
TEMU_API uint64_t temu_asUnsigned | ( | temu_Propval | Pv | ) |
Converts the given property to unsigned integer
Pv | The property to be converted |
TEMU_API int temu_checkpointGetLength | ( | void * | Ctxt, |
const char * | Name | ||
) |
Get number of entries for the serialized property
Ctxt | Context passed to deserialise function |
Name | Name of property / key in the serialized file |
TEMU_API temu_Propval temu_checkpointGetValue | ( | void * | Ctxt, |
const char * | Name, | ||
int | Idx | ||
) |
Get value for named snapshot value
Ctxt | Context is passed to deserialise interface function |
Name | Name of the saved value |
Idx | Index of the saved value (if array) |
TEMU_API int temu_checkSanity | ( | int | Report | ) |
Check object system sanity.
The function traverses all objects and their properties and ensures that all (scalar) interface properties are connected. An object can override the default check by implementing the checkSanity function in the ObjectIface.
Report | set to 1 to have the function report connectivity issues on stdout, 2 to report on stderr, and 0 to not report at all. |
TEMU_API temu_Class* temu_classForName | ( | const char * | ClsName | ) |
Get the class pointer for the named class
ClsName | The name of the class |
TEMU_API temu_Class* temu_classForObject | ( | const temu_Object_ * | Obj | ) |
Get the class for the given object.
Obj | Pointer to the object |
TEMU_API int temu_classHasCommand | ( | const temu_Class * | Cls, |
const char * | CmdName | ||
) |
Query whether the class has a specific command implemented
Cls | class to query for a command. |
CmdName | Command name class is expected to implement. |
TEMU_API int temu_connect | ( | temu_Object_ * | A, |
const char * | PropName, | ||
temu_Object_ * | B, | ||
const char * | IfaceName | ||
) |
Connect an interface property in object A to the interface in object B. If A.PropName is an interface array, B,B:IfaceName will be appended to it. For dynamic arrays, it is pushed to the end, for static arrays, it is placed in the first null slot (unless, the indexing syntax is used in the property name).
A | The object to connect. |
PropName | The name of the property in object A |
B | The object to connect to. |
IfaceName | The name of the interface in object B |
TEMU_API temu_Object_* temu_createObject | ( | const char * | ClsName, |
const char * | ObjName, | ||
const temu_CreateArg * | Args | ||
) |
Create object with class and name.
ClsName | Name of class used for instantiation |
ObjName | Name of object in object system |
Args | Named argument pairs to pass into constructor. The list of args should be terminated by a TEMU_NULL_ARG. In case no arguments are passed, pass in NULL. |
TEMU_API int temu_deserialiseJSON | ( | const char * | FileName | ) |
De-serialise the simulation state.
The function clears the whole internal object system, reads the JSON file FileName and creates all the objects.
If a class implements the ObjectIface, the (optional) deserialise procedure will be called.
FileName | The filename that contains the JSON data |
TEMU_API void temu_deserialiseProp | ( | void * | Ctxt, |
temu_Object_ * | Obj, | ||
const char * | Name | ||
) |
temu_deserialiseProp Deserialize a serialized property
Ctxt | An opaque context, this is the same context as is passed to the deserialise interface function. |
Obj | Object being deserialised |
Name | The name of the property |
Creates a dictionary object
Delete a dictionary object
Dict | Pointer to the dictionary object to be deleted |
Given a specific key of a dictionary, the next key is provided by this function
Dict | The dictionary that contains the keys |
Key | The key, whose next value in the dict to be provided |
TEMU_API temu_Propval temu_dictGetValue | ( | temu_Dict * | Dict, |
const char * | Name | ||
) |
Retrieve a dictionary value by name
Dict | Pointer to the dictionary object |
Name | The name associated with the value to be retrieved |
TEMU_API int temu_dictInsertValue | ( | temu_Dict * | Dict, |
const char * | Name, | ||
temu_Propval | Val | ||
) |
Inserts a name/value pair to a dictionary
Dict | Pointer to the dictionary object |
Name | The name to be inserted |
Val | The value to be inserted |
Erase a name/value pair from a dictionary by name
Dict | Pointer to the dictionary object |
Name | The name of the pair to be removed |
TEMU_API void temu_disposeObject | ( | temu_Object_ * | Obj | ) |
Dispose object. The function will call the Objects dispose function.
Obj | The object to delete. |
TEMU_API temu_Propval temu_floatingPointPropval | ( | temu_Type | T, |
double | V | ||
) |
Create a floating point propval of the given type
T | Type ID, must be a teTY_Float or teTY_Double |
V | Value |
TEMU_API void temu_foreachClass | ( | void(*)(temu_Class *, void *) | Func, |
void * | Arg | ||
) |
Call function on every class in the object system The function is called with the metaclass pointer and the argument. NOTE: This function is experimental.
Func | Function to call |
Arg | Argument passed as the last parameter to Func |
TEMU_API void temu_foreachInterface | ( | temu_Class * | C, |
void(*)(temu_Class *, const char *, void *) | Func, | ||
void * | Arg | ||
) |
Call function on every interface in a class. The function is called with the class pointer, interface name and the argument. NOTE: This function is experimental.
C | Class to iterate properties |
Func | Function to call |
Arg | Argument passed as the last parameter to Func |
TEMU_API void temu_foreachObject | ( | void(*)(temu_Object_ *, void *) | Func, |
void * | Arg | ||
) |
Call function on every object in the object system The function is called with the object pointer and the argument. NOTE: This function is experimental.
Func | Function to call |
Arg | Argument passed as the last parameter to Func |
TEMU_API void temu_foreachProcessor | ( | void(*)(temu_Object_ *, void *) | Func, |
void * | Arg | ||
) |
Call function on every processor in the object system The function is called with the CPU pointer and the argument. NOTE: This function is experimental.
Func | Function to call |
Arg | Argument passed as the last parameter to Func |
TEMU_API void temu_foreachProperty | ( | temu_Class * | C, |
void(*)(temu_Class *, const char *, void *) | Func, | ||
void * | Arg | ||
) |
Call function on every property in a class. The function is called with the class pointer, property name and the argument. NOTE: This function is experimental.
C | Class to iterate properties |
Func | Function to call |
Arg | Argument passed as the last parameter to Func |
TEMU_API int temu_generateObjectGraph | ( | const char * | Path, |
int | Display | ||
) |
Print the current object graph as a dot file
Pass NULL (or nullptr) to generate to stdout. And set Display to non-zero to automatically display the generated dot-file.
Path | Destination file to write the graph to. NULL indicates stdout. |
Display | If non-zero, the function will attempt to display the graph by running it through dot and . |
TEMU_API size_t temu_getComponentCount | ( | void | ) |
temu_getComponentCount Get the number of components in the current simulation
TEMU_API temu_Component** temu_getComponents | ( | void | ) |
temu_getComponents Get the number of components in the current simulation
TEMU_API void* temu_getInterface | ( | temu_Object_ * | Obj, |
const char * | IfaceName, | ||
int | Idx | ||
) |
const TEMU_API char* temu_getInterfaceName | ( | temu_Object * | Obj, |
void * | Iface | ||
) |
temu_getInterfaceName Get Interface Name of the Obj
Obj | Pointer to the object containing the interface |
Iface | Interface to be find w.r.t. Object |
TEMU_API temu_IfaceRef temu_getInterfaceRef | ( | temu_Object_ * | Obj, |
const char * | IfaceName, | ||
int | Idx | ||
) |
Retrieve a reference to an interface identified by its name and index
Obj | Pointer to the object containing the interface |
IfaceName | Name of the interface |
Idx | Interface index |
TEMU_API void* temu_getInterfaceType | ( | const char * | Name | ) |
const TEMU_API char* temu_getLoggingCategory | ( | temu_Class * | Cls, |
unsigned | CategoryId | ||
) |
temu_getLogginCategory adds a logging category to the class
Cls | the class |
CategoryId | The category id. Valid range is [8,16) |
TEMU_API size_t temu_getProcessorCount | ( | void | ) |
temu_getProcessorCount Get the number of processors in the current simulation
TEMU_API temu_Object_** temu_getProcessors | ( | void | ) |
temu_getProcessors Get the list of processors in the current simulation
TEMU_API temu_PropAccessor temu_getPropAccessor | ( | temu_Object * | Obj, |
const char * | PropName, | ||
int | PropIdx | ||
) |
Get a reference to the named property
This is useful as a replacement of temu_getPropref and temu_getPropName. The resulting data structure lets you automatically disambiguate between properties and pseudo properties.
The index used will be PropIdx, or K if the PropName string has an array suffix [K]
.
Obj | An object of a class with the relevant property registered. |
PropName | The name of the property to be queried. |
PropIdx | Index in property array. |
TEMU_API int temu_getPropDynLength | ( | const temu_Object_ * | Obj, |
const char * | PropName | ||
) |
Get the dynamic length of the property
Normally, the temu_getPropLength()
would return 1 for a dynamic array. This means that there is one dynamic array. In case the length of the dynamic array is needed, this function can be used.
Obj | Pointer to the object of the property |
PropName | Name of the property |
TEMU_API int temu_getPropLength | ( | const temu_Object_ * | Obj, |
const char * | PropName | ||
) |
Returns property length/size if a property is an array
Obj | Pointer to the object of the property |
PropName | Name of the property |
TEMU_API temu_PropName temu_getPropName | ( | const temu_Object_ * | Obj, |
const char * | PropName | ||
) |
Get a reference to a named property.
Obj | An object of a class with the relevant property registered. |
PropName | The name of the property to be queried. |
TEMU_API temu_Propref temu_getPropref | ( | const temu_Object_ * | Obj, |
const char * | PropName | ||
) |
Get a reference to the named property. The propref is a typetag and a pointer to the raw value, as such it does not work with delegated properties in components, nor with pseudo properties.
Obj | An object of a class with the relevant property registered. |
PropName | The name of the property to be queried. |
TEMU_API temu_Type temu_getPropType | ( | const temu_Object_ * | Obj, |
const char * | PropName | ||
) |
Get the type of a property
Obj | Pointer to the object of the property |
PropName | Name of the property |
TEMU_API temu_Propval temu_getValue | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API double temu_getValueDouble | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get property (without side effects)
Obj | Object pointer |
PropName | Name of property |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API int16_t temu_getValueI16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an int16
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API int32_t temu_getValueI32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an int32
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API int64_t temu_getValueI64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an int64
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API int8_t temu_getValueI8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an int8
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API int64_t temu_getValueSigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get property (without side effects)
Obj | Object pointer |
PropName | Name of property |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API uint16_t temu_getValueU16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an uint16
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API uint32_t temu_getValueU32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an uint32
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API uint64_t temu_getValueU64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an uint64
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API uint8_t temu_getValueU8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get the value of a property from an object if it is an uint8
Obj | The object that contains the property |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API uint64_t temu_getValueUnsigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Get property (without side effects)
Obj | Object pointer |
PropName | Name of property |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API void* temu_getVTable | ( | const temu_Object_ * | Obj | ) |
Get the VTable pointer for an object. This only works for internal objects that inherits from temu_Object.
Obj | The object in question |
TEMU_API void* temu_getVTableForClass | ( | temu_Class * | Cls | ) |
Get the VTable pointer for a class
Cls | The class, for which the vtable is to be retrieved |
TEMU_API temu_IfaceRefArray temu_ifaceRefArrayAlloc | ( | unsigned | Reserve | ) |
Allocate interface array.
Reserve | Number of entries to reserve initially. |
TEMU_API void temu_ifaceRefArrayDispose | ( | temu_IfaceRefArray * | Arr | ) |
TEMU_API temu_IfaceRef temu_ifaceRefArrayGet | ( | temu_IfaceRefArray * | Arr, |
unsigned | idx | ||
) |
Get the index of the interface reference array.
Arr | The interface reference array |
idx | is the index of the array |
TEMU_API void temu_ifaceRefArrayPush | ( | temu_IfaceRefArray *Arr | TEMU_NONNULL, |
temu_IfaceRef | Iface | ||
) |
Push an interface reference to the interface array.
Arr | The interface reference array |
Iface | The interface reference (object-interface pointer pair) |
TEMU_API void temu_ifaceRefArrayPush2 | ( | temu_IfaceRefArray *Arr | TEMU_NONNULL, |
temu_Object_ *Obj | TEMU_NONNULL, | ||
void *Iface | TEMU_NONNULL | ||
) |
Push an object and raw interface pointer to an interface array.
Arr | The interface reference array. |
Obj | The object implementing the relevant interface |
Iface | Pointer to the interface struct. |
TEMU_API unsigned temu_ifaceRefArraySize | ( | temu_IfaceRefArray * | Arr | ) |
Get the length of a dynamically allocated interface array.
Arr | The interface array to get the size from. |
TEMU_API int temu_indexForInterface | ( | const temu_Object_ * | Obj, |
const void * | Iface | ||
) |
Get index for interface
Obj | Pointer to the object that contains the interface |
Iface | Pointer to the interface |
TEMU_API int temu_inlineDeserialiseJSON | ( | const char * | FileName | ) |
De-serialise the simulation state.
This function directly restores properties on already created objects. It does not clear the objects system. Thus pointers to objects remains stable after a snapshot restore.
If a class implements the ObjectIface, the (optional) deserialise procedure will be called.
FileName | The filename that contains the JSON data |
TEMU_API int temu_isComponent | ( | const temu_Object_ * | Obj | ) |
temu_isComponent Checks if an object is a component
Obj | The object to test |
TEMU_API int temu_isCpu | ( | const temu_Object_ * | Obj | ) |
Predicate for identifying CPU classes. In release without assert builds this runs in O(1) time.
Obj | The object to test |
TEMU_API int temu_isDiscrete | ( | temu_Propval | Pv | ) |
Checks whether the numeric property is an integer-like
Pv | The property to be checked |
TEMU_API int temu_isMachine | ( | const temu_Object_ * | Obj | ) |
Predicate for identifying CPU classes. In release without assert builds this runs in O(1) time..
Obj | The object to test |
TEMU_API int temu_isMemory | ( | const temu_Object_ * | Obj | ) |
temu_isMemory Checks whether an object is a memory object
Obj | The object to test |
TEMU_API int temu_isNormalProperty | ( | temu_Object_ * | Obj, |
const char * | PropName | ||
) |
temu_isNormalProperty Checks whether a property is a normal property (not a pseudo-property)
Obj | The object that contains the property |
PropName | The property name |
TEMU_API int temu_isNumber | ( | temu_Propval | Pv | ) |
Checks whether a property is a number
Pv | The property to be checked |
TEMU_API int temu_isPseudoProperty | ( | temu_Object_ * | Obj, |
const char * | PropName | ||
) |
temu_isPseudoProperty Checks whether a property is a pseudo-property
Obj | The object that contains the property |
PropName | The property name |
TEMU_API int temu_isQualifiedAs | ( | const temu_Object_ * | Obj, |
unsigned | Qualifier | ||
) |
temu_isQualifiedAs Check if an object is qualified as Qualifier
Obj | The object to be checked |
Qualifier | The qualification to be checked |
TEMU_API int temu_isReal | ( | temu_Propval | Pv | ) |
Checks whether a property is a real number
Pv | The property to be checked |
TEMU_API int temu_isSigned | ( | temu_Propval | Pv | ) |
TEMU_API int temu_isString | ( | temu_Propval | Pv | ) |
Checks whether a property is a string
Pv | The property to be checked |
TEMU_API int temu_isUnsigned | ( | temu_Propval | Pv | ) |
TEMU_API int temu_isValidClassName | ( | const char * | Name | ) |
TEMU_API int temu_isValidInterfaceName | ( | const char * | Name | ) |
TEMU_API int temu_isValidObjectName | ( | const char * | Name | ) |
TEMU_API int temu_isValidPropertyName | ( | const char * | Name | ) |
TEMU_API void temu_listAppend | ( | temu_List * | List, |
temu_Propval | Val | ||
) |
Add an element to the end of a linked-list
List | The list, to which the element to be added |
Val | The element to be added |
Create a linked-list object
Typ | The type to be stored in the elements of the linked list |
Delete a linked-list object
List | The list to be deleted |
TEMU_API temu_ListNode* temu_listGetHead | ( | temu_List * | List | ) |
Get the first element of a linked-list
List | The list, whose first element is requested |
TEMU_API temu_ListNode* temu_listGetNext | ( | temu_ListNode * | Node | ) |
Get the next element of a linked list
Node | The node, whose next element is requested |
TEMU_API temu_ListNode* temu_listGetPrev | ( | temu_ListNode * | Node | ) |
Get the previous element of a linked list
Node | The node, whose next element is requested |
TEMU_API temu_ListNode* temu_listGetTail | ( | temu_List * | List | ) |
Get the last element of a linked-list
List | The list, whose last element is requested |
TEMU_API temu_Propval temu_listNodeGetVal | ( | temu_ListNode * | Node | ) |
Get value of a linked-list node
Node | The node, from which the value to be extracted |
TEMU_API void temu_listPrepend | ( | temu_List * | List, |
temu_Propval | Val | ||
) |
Add an element to the beginning of a linked-list
List | The list, to which the element to be added |
Val | The element to be added |
TEMU_API temu_Propval temu_listRemoveHead | ( | temu_List * | List | ) |
Removes the first element of a linked-list
List | The list, from which the first element to be removed |
TEMU_API temu_Propval temu_listRemoveTail | ( | temu_List * | List | ) |
Removes the last element of a linked-list
List | The list, from which the last element to be removed |
TEMU_API int temu_loadPlugin | ( | const char * | PluginName | ) |
Load a plugin. When a plugin is loaded the temu_pluginInit function will be called. This function should create and define any classes that the plugin provides.
The function loads plugins following the operating system's loading rules. This means in particular that first, the plugin will be found in the RPATH location of libTEMUSupport (which refers to the TEMU lib directory). Secondly, it will look in the LD_LIBRARY_PATH and other standard load directories.
In practice, it will look for lib<Plugin>.so in the TEMU plugin paths, or libTEMU<Plugin>.so in the same paths. It will then fallback on attempting to load libTEMU<Plugin>.so from the system load paths. If the plugin name contains a slash '/' it will be treated as a path and not a plugin name.
PluginName | A path or plugin name |
TEMU_API int temu_loadPluginGlobal | ( | const char * | PluginName | ) |
Load a plugin. When a plugin is loaded the temu_pluginInit function will be called. This function should create and define any classes that the plugin provides.
The plugin will be made available globally for the linker (e.g. using RTLD_GLOBAL).
This is not recommended for normal TEMU plugins.
The function loads plugins following the operating system's loading rules. This means in particular that first, the plugin will be found in the RPATH location of libTEMUSupport (which refers to the TEMU lib directory). Secondly, it will look in the LD_LIBRARY_PATH and other standard load directories.
In practice, it will look for lib<Plugin>.so in the TEMU plugin paths, or libTEMU<Plugin>.so in the same paths. It will then fallback on attempting to load libTEMU<Plugin>.so from the system load paths. If the plugin name contains a slash '/' it will be treated as a path and not a plugin name.
PluginName | A path or plugin name |
const TEMU_API char* temu_nameForClass | ( | temu_Class * | Cls | ) |
temu_nameForClass Get the class name from its object
Cls | Pointer to the object of the class in question |
const TEMU_API char* temu_nameForInterface | ( | const temu_Object_ * | Obj, |
const void * | Iface | ||
) |
Get name for interface
Obj | Pointer to the object that contains the interface |
Iface | Pointer to the interface |
const TEMU_API char* temu_nameForObject | ( | const temu_Object_ * | Obj | ) |
Get the name of an object
Obj | Pointer to the object |
TEMU_API temu_Object_* temu_objectForName | ( | const char * | Name | ) |
Get object for name
Name | The name of the object |
TEMU_API int temu_objectHasCmd | ( | const temu_Object_ * | Obj, |
const char * | CmdName | ||
) |
Check if object has a command
Obj | Object pointer |
CmdName | Name of command |
TEMU_API int temu_objectHasIface | ( | const temu_Object_ * | Obj, |
const char * | IfaceName | ||
) |
Check if the object has a named interface
Obj | Pointer to the object to query |
IfaceName | Interface name to look for |
TEMU_API int temu_objectHasProp | ( | const temu_Object_ * | Obj, |
const char * | PropName | ||
) |
Check if the object has a named property
Obj | Pointer to the object of the property |
PropName | Name of the property |
TEMU_API void temu_objsysClear | ( | void | ) |
Erase all classes, interfaces, properties and objects registered in the object system.
TEMU_API void temu_objsysClearObjects | ( | void | ) |
Erase all objects, but do not delete classes.
TEMU_API void temu_pluginPathAppend | ( | const char * | Path | ) |
temu_pluginPathAppend Add a path to the list of paths, where T-emu searches for plugins
Path | The path to append |
TEMU_API void temu_pluginPathPrint | ( | void | ) |
temu_pluginPathPrint Print the list of paths, where T-emu searches for plugins
TEMU_API void temu_pluginPathRemove | ( | const char * | Path | ) |
temu_pluginPathRemove Remove a path from the list of paths, where T-emu searches for plugins
Path | to remove |
TEMU_API int temu_propInfoForClass | ( | temu_Class * | Cls, |
unsigned | PIIndex, | ||
unsigned | PICount, | ||
temu_PropInfo * | PI | ||
) |
Get property info for class
It is possible to extract low level property info data using this function. This can be useful if integrating in another simulator or if integrating the system in e.g. a GUI in which you need to provide object introspection.
The function can be called with the PI array set to NULL to return the number of properties in the class.
You can read out all property fields using the following sequence:
Cls | The class to inspect |
PIIndex | The property index to read from. |
PICount | Size of PI array in number of entries. \Param PI Pointer to an array of prop info objects to fill in. |
TEMU_API void temu_qualifyAs | ( | temu_Class * | Cls, |
unsigned | Qualifier | ||
) |
Bless the class so that the isQualified predicate returns 1. Qualifiers with the MSb cleared are reserved for TEMU internals.
Cls | The class to be blessed |
TEMU_API void temu_qualifyAsCpu | ( | temu_Class * | Cls | ) |
Bless the class so that the isCpu predicate returns 1. There are certain assumptions that CPU classes must meet. These assumptions are not stable yet, so do not use this in user code.
Cls | The class to be blessed |
TEMU_API void temu_qualifyAsMachine | ( | temu_Class * | Cls | ) |
Bless the class so that the isMachine predicate returns 1. There are certain assumptions that machine classes must meet. These assumptions are not stable yet, so do not use this in user code.
Cls | The class to be blessed |
TEMU_API void temu_qualifyAsMemory | ( | temu_Class * | Cls | ) |
Bless the class so that the isMemory predicate returns 1
Cls | The class to be blessed |
TEMU_API temu_Propval temu_readProp | ( | temu_Object_ * | Obj, |
const char * | Name, | ||
int | idx | ||
) |
Read property (with side effects)
Obj | Object pointer |
Name | Name of property |
idx | Index in property array (set to 0 if scalar) |
TEMU_API temu_Propval temu_readValue | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API double temu_readValueDouble | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read property (with side effects)
Obj | Object pointer |
PropName | Name of property |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API int16_t temu_readValueI16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API int32_t temu_readValueI32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API int64_t temu_readValueI64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API int8_t temu_readValueI8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API int64_t temu_readValueSigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read property (with side effects)
Obj | Object pointer |
PropName | Name of property |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API uint16_t temu_readValueU16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API uint32_t temu_readValueU32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API uint64_t temu_readValueU64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API uint8_t temu_readValueU8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read typed properties.
The readValue[U|I][8|16|32|64] function reads a typed property. The accessor will fail with a fatal error if the read type is not the same as the property type. If the property type is unknown, use the temu_readValue function instead.
Obj | Object pointer |
PropName | Name of property to read |
Idx | Index in property array, set to 0 if the property is not an array |
TEMU_API uint64_t temu_readValueUnsigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
Read property (with side effects)
Obj | Object pointer |
PropName | Name of property |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API temu_Class* temu_registerClass | ( | const char * | ClsName, |
temu_ObjectCreateFunc | Create, | ||
temu_ObjectDisposeFunc | Dispose | ||
) |
Register a class in the TEMU object system. With these classes, the TEMU object system is responsible for allocation and de-allocation.
ClsName | The name of the class that is to be created. |
Create | A constructor, the constructor is responsible for allocation and initialisation of the object. |
Dispose | A destructor, this function is responsible for deleting the objects of the class. |
TEMU_API void* temu_registerInterfaceType | ( | const char * | Name | ) |
TEMU_API void temu_requireInterface | ( | temu_Class * | Cls, |
const char * | PropName, | ||
const char * | IfaceType | ||
) |
Associate the interface reference property with an interface type.
Setting the type, prevents the connect command / function to assign the connection if the target interface type is not the same as the property interface reference type.
Cls | Class pointer |
PropName | Name of interface reference property |
IfaceType | Type required to connect the property |
TEMU_API int temu_serialiseJSON | ( | const char * | FileName | ) |
Serialise the simulation state to the given file name.
The serialisation writes a JSON formatted file and calls the serialise procedure in the (optional) ObjectIface if it is implemented.
The serialisation interface can for example be used to write out memory buffers to separate files as such data should not be written to a JSON file.
FileName | The filename, to which the JSON data is to be stored |
TEMU_API void temu_serialiseProp | ( | void * | Ctxt, |
const char * | Name, | ||
temu_Type | Typ, | ||
int | Count, | ||
void * | Data | ||
) |
Serialise an explicit property, this can be called from the serialisiation interface. Note that the availability of pseudo properties makes this function and the serialise interface more or less obsolete.
Ctxt | The context object that has the property (same as passed to serialise function in the interface) |
Name | The name of the property |
Typ | The type of the property |
Count | 0 if the property is not an array, otherwise the element number in the property |
Data | Serialized data |
TEMU_API void temu_setTimeSource | ( | temu_Object_ * | Obj, |
temu_TimeSource_ * | TS | ||
) |
Set time source object for models. Typically TS is a CPU. You can only set the time source for an internal class.
Obj | Object to set time source in. |
TS | Time source object (CPU or clock model) |
TEMU_API void temu_setValue | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
temu_Propval | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueDouble | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
double | Val, | ||
int | Idx | ||
) |
Set floating point property (without side effects)
Obj | Object pointer |
PropName | Name of property |
Val | The new property value |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API void temu_setValueI16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int16_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueI32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int32_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueI64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int64_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueI8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int8_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueSigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int64_t | Val, | ||
int | Idx | ||
) |
Set signed property (without side effects)
Obj | Object pointer |
PropName | Name of property |
Val | The new property value |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API void temu_setValueU16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint16_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueU32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint32_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueU64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint64_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueU8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint8_t | Val, | ||
int | Idx | ||
) |
Set a raw property value without side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_setValueUnsigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint64_t | Val, | ||
int | Idx | ||
) |
Set unsigned property (without side effects)
Obj | Object pointer |
PropName | Name of property |
Val | The new property value |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API int temu_setVTable | ( | temu_Class * | Cls, |
void * | VTable | ||
) |
Set the VTable pointer.
Temu classes, provides the ability to, for internal objects query for a VTable manually in O(1) time. In practice this can be any pointer, but it is typically used to register performance sensitive interfaces. E.g. the CPU and machine classes have their own VTable types that refer to a number of interfaces they implement.
Cls | The class, for which the vtable to be set |
VTable | Pointer to the vtable to be used |
TEMU_API temu_Propval temu_signedPropval | ( | temu_Type | T, |
int64_t | I | ||
) |
Create a signed propval of the given type
T | Type ID, must be a signed integer type tag |
I | Integer value |
TEMU_API int temu_snapshotGetLength | ( | void * | Ctxt, |
const char * | Name | ||
) |
Get number of entries for the serialized property
Ctxt | Context passed to deserialise function |
Name | Name of property / key in the serialized file |
TEMU_API temu_Propval temu_snapshotGetValue | ( | void * | Ctxt, |
const char * | Name, | ||
int | Idx | ||
) |
Get value for named snapshot value
Ctxt | Context is passed to deserialise interface function |
Name | Name of the saved value |
Idx | Index of the saved value (if array) |
const TEMU_API char* temu_typenameForInterface | ( | const temu_Object_ * | Obj, |
const void * | Iface | ||
) |
Get type name for interface
Obj | Pointer to the object that contains the interface |
Iface | Pointer to the interface |
Get a string representing the type tag.
Typ | The type, whose name is required |
TEMU_API temu_Propval temu_unsignedPropval | ( | temu_Type | T, |
uint64_t | U | ||
) |
Create an unsigned propval of the given type
T | Type ID, must be an unsigned integer type tag |
U | Integer value |
TEMU_API temu_Vector temu_vecCreate | ( | temu_Type | Typ | ) |
Create a vector object
Typ | The type of the elements |
TEMU_API void temu_vecDispose | ( | temu_Vector * | Vec | ) |
Delete a vector object
Vec | The vector object to be deleted |
TEMU_API void* temu_vecGetData | ( | temu_Vector * | Vec | ) |
Retrieve the array of elements of a vector
Vec | The vector, whose elements are requested |
TEMU_API size_t temu_vecGetSize | ( | temu_Vector * | Vec | ) |
Get the number of elements of a vector
Vec | The vector, whose size to be retrieved |
TEMU_API void temu_vecPush | ( | temu_Vector * | Vec, |
temu_Propval | Val | ||
) |
Add an element to a vector object
Vec | The vector, to which the element to be added |
Val | The element to be added |
TEMU_API int temu_writeProp | ( | temu_Object_ * | Obj, |
const char * | Name, | ||
int | idx, | ||
temu_Propval * | PV | ||
) |
Write property (with side effects)
Obj | Object pointer |
Name | Name of property |
idx | Index in property array (set to 0 if scalar) |
PV | Pointer to propval |
TEMU_API void temu_writeValue | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
temu_Propval | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueDouble | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
double | Val, | ||
int | Idx | ||
) |
Write floating point property (with side effects)
Obj | Object pointer |
PropName | Name of property |
Val | The new property value |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API void temu_writeValueI16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int16_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueI32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int32_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueI64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int64_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueI8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int8_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueObj | ( | temu_Object * | Obj, |
const char * | PropName, | ||
temu_Object * | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueSigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
int64_t | Val, | ||
int | Idx | ||
) |
Write signed property (with side effects)
Obj | Object pointer |
PropName | Name of property |
Val | The new property value |
Idx | Index in property array (set to 0 if scalar) |
TEMU_API void temu_writeValueU16 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint16_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueU32 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint32_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueU64 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint64_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueU8 | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint8_t | Val, | ||
int | Idx | ||
) |
Write a property value with side-effects
Obj | Object pointer |
PropName | Name of property to read. |
Val | The value to set. It must be of the correct type. |
Idx | Index of property, set to 0 if it is not an array. |
TEMU_API void temu_writeValueUnsigned | ( | temu_Object_ * | Obj, |
const char * | PropName, | ||
uint64_t | Val, | ||
int | Idx | ||
) |
Write unsigned property (with side effects)
Obj | Object pointer |
PropName | Name of property |
Val | The new property value |
Idx | Index in property array (set to 0 if scalar) |