TEMU
2
The Terma Emulator
|
#include "temu-c/Support/Attributes.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_PropInfo |
struct | temu_ObjectIface |
Macros | |
#define | TEMU_PLUGIN_INIT void temu_pluginInit(void) |
#define | TEMU_NO_WRAP |
#define | TEMU_BUFF_DEFINED |
#define | TEMU_COMPONENT_DEFINED |
#define | temu_Object_ void |
#define | TEMU_IFACE_REFERENCE_TYPE(N) |
#define | TEMU_DYN_ARRAY_TYPE(T, P) |
#define | PROP_ASSERT(p, t) |
#define | PROP_VAL_INITIALIZER(typ, suffix, typetag, valtag) |
#define | TEMU_NULL_ARG |
#define | TEMU_QUAL_NONE 0 |
#define | TEMU_QUAL_CPU 1 |
#define | TEMU_QUAL_MACHINE 2 |
#define | TEMU_QUAL_EXTERNAL 3 |
#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 void | temu_Class |
typedef void | temu_MetaIface |
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 void(* | temu_PropWriter )(void *Obj, temu_Propval Pv, int Idx) |
typedef temu_Propval(* | temu_PropReader )(void *Obj, int Idx) |
typedef struct temu_CreateArg | temu_CreateArg |
typedef void *(* | temu_ObjectCreateFunc )(const char *Name, int Argc, const temu_CreateArg *Argv) |
typedef void(* | temu_ObjectDisposeFunc )(void *) |
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 } |
Functions | |
TEMU_API temu_IfaceRefArray | temu_ifaceRefArrayAlloc (unsigned Reserve) |
TEMU_API void | temu_ifaceRefArrayPush2 (temu_IfaceRefArray *Arr TEMU_NONNULL, void *Obj TEMU_NONNULL, void *Iface TEMU_NONNULL) |
TEMU_API void | temu_ifaceRefArrayPush (temu_IfaceRefArray *Arr TEMU_NONNULL, temu_IfaceRef Iface) |
TEMU_API unsigned | temu_ifaceRefArraySize (temu_IfaceRefArray *Arr) |
TEMU_API void | temu_ifaceRefArrayDispose (temu_IfaceRefArray *Arr) |
TEMU_API temu_Dict * | temu_dictCreate (void) |
TEMU_API void | temu_dictDispose (temu_Dict *Dict) |
TEMU_API int | temu_dictInsertValue (temu_Dict *Dict, const char *Name, temu_Propval Val) |
TEMU_API temu_Propval | temu_dictGetValue (temu_Dict *Dict, const char *Name) |
TEMU_API int | temu_dictRemoveValue (temu_Dict *Dict, const char *Name) |
TEMU_API const char * | temu_dictGetNextKey (temu_Dict *Dict, const char *Key) |
TEMU_API temu_Vector | temu_vecCreate (temu_Type Typ) |
TEMU_API void | temu_vecDispose (temu_Vector *Vec) |
TEMU_API void | temu_vecPush (temu_Vector *Vec, temu_Propval Val) |
TEMU_API void * | temu_vecGetData (temu_Vector *Vec) |
TEMU_API size_t | temu_vecGetSize (temu_Vector *Vec) |
TEMU_API temu_List | temu_listCreate (temu_Type Typ) |
TEMU_API void | temu_listDispose (temu_List *List) |
TEMU_API void | temu_listAppend (temu_List *List, temu_Propval Val) |
TEMU_API void | temu_listPrepend (temu_List *List, temu_Propval Val) |
TEMU_API temu_Propval | temu_listRemoveHead (temu_List *List) |
TEMU_API temu_Propval | temu_listRemoveTail (temu_List *List) |
TEMU_API temu_ListNode * | temu_listGetHead (temu_List *List) |
TEMU_API temu_ListNode * | temu_listGetTail (temu_List *List) |
TEMU_API temu_ListNode * | temu_listGetNext (temu_ListNode *Node) |
TEMU_API temu_ListNode * | temu_listGetPrev (temu_ListNode *Node) |
TEMU_API temu_Propval | temu_listNodeGetVal (temu_ListNode *Node) |
TEMU_API temu_Propref | temu_getPropref (const void *Obj, const char *PropName) |
TEMU_API temu_PropName | temu_getPropName (const void *Obj, const char *PropName) |
TEMU_API int | temu_getPropLength (const void *Obj, const char *PropName) |
TEMU_API int | temu_getPropDynLength (const void *Obj, const char *PropName) |
TEMU_API temu_Type | temu_getPropType (const void *Obj, const char *PropName) |
TEMU_API int | temu_objectHasProp (const void *Obj, const char *PropName) |
TEMU_API int | temu_objectHasIface (const void *Obj, const char *IfaceName) |
TEMU_API int | temu_isNumber (temu_Propval Pv) |
TEMU_API int | temu_isReal (temu_Propval Pv) |
TEMU_API int | temu_isDiscrete (temu_Propval Pv) |
TEMU_API int | temu_isUnsigned (temu_Propval Pv) |
TEMU_API int | temu_isSigned (temu_Propval Pv) |
TEMU_API int | temu_isString (temu_Propval Pv) |
TEMU_API int64_t | temu_asInteger (temu_Propval Pv) |
TEMU_API uint64_t | temu_asUnsigned (temu_Propval Pv) |
TEMU_API double | temu_asDouble (temu_Propval Pv) |
TEMU_API temu_Propval | temu_getValue (void *Obj, const char *PropName, int Idx) TEMU_NO_WRAP |
TEMU_API uint8_t | temu_getValueU8 (void *Obj, const char *PropName, int Idx) |
TEMU_API uint16_t | temu_getValueU16 (void *Obj, const char *PropName, int Idx) |
TEMU_API uint32_t | temu_getValueU32 (void *Obj, const char *PropName, int Idx) |
TEMU_API uint64_t | temu_getValueU64 (void *Obj, const char *PropName, int Idx) |
TEMU_API int8_t | temu_getValueI8 (void *Obj, const char *PropName, int Idx) |
TEMU_API int16_t | temu_getValueI16 (void *Obj, const char *PropName, int Idx) |
TEMU_API int32_t | temu_getValueI32 (void *Obj, const char *PropName, int Idx) |
TEMU_API int64_t | temu_getValueI64 (void *Obj, const char *PropName, int Idx) |
TEMU_API temu_Propval | temu_readValue (void *Obj, const char *PropName, int Idx) TEMU_NO_WRAP |
TEMU_API uint8_t | temu_readValueU8 (void *Obj, const char *PropName, int Idx) |
TEMU_API uint16_t | temu_readValueU16 (void *Obj, const char *PropName, int Idx) |
TEMU_API uint32_t | temu_readValueU32 (void *Obj, const char *PropName, int Idx) |
TEMU_API uint64_t | temu_readValueU64 (void *Obj, const char *PropName, int Idx) |
TEMU_API int8_t | temu_readValueI8 (void *Obj, const char *PropName, int Idx) |
TEMU_API int16_t | temu_readValueI16 (void *Obj, const char *PropName, int Idx) |
TEMU_API int32_t | temu_readValueI32 (void *Obj, const char *PropName, int Idx) |
TEMU_API int64_t | temu_readValueI64 (void *Obj, const char *PropName, int Idx) |
TEMU_API void | temu_setValue (void *Obj, const char *PropName, temu_Propval Val, int Idx) TEMU_NO_WRAP |
TEMU_API void | temu_setValueU8 (void *Obj, const char *PropName, uint8_t Val, int Idx) |
TEMU_API void | temu_setValueU16 (void *Obj, const char *PropName, uint16_t Val, int Idx) |
TEMU_API void | temu_setValueU32 (void *Obj, const char *PropName, uint32_t Val, int Idx) |
TEMU_API void | temu_setValueU64 (void *Obj, const char *PropName, uint64_t Val, int Idx) |
TEMU_API void | temu_setValueI8 (void *Obj, const char *PropName, int8_t Val, int Idx) |
TEMU_API void | temu_setValueI16 (void *Obj, const char *PropName, int16_t Val, int Idx) |
TEMU_API void | temu_setValueI32 (void *Obj, const char *PropName, int32_t Val, int Idx) |
TEMU_API void | temu_setValueI64 (void *Obj, const char *PropName, int64_t Val, int Idx) |
TEMU_API void | temu_writeValue (void *Obj, const char *PropName, temu_Propval Val, int Idx) TEMU_NO_WRAP |
TEMU_API void | temu_writeValueU8 (void *Obj, const char *PropName, uint8_t Val, int Idx) |
TEMU_API void | temu_writeValueU16 (void *Obj, const char *PropName, uint16_t Val, int Idx) |
TEMU_API void | temu_writeValueU32 (void *Obj, const char *PropName, uint32_t Val, int Idx) |
TEMU_API void | temu_writeValueU64 (void *Obj, const char *PropName, uint64_t Val, int Idx) |
TEMU_API void | temu_writeValueI8 (void *Obj, const char *PropName, int8_t Val, int Idx) |
TEMU_API void | temu_writeValueI16 (void *Obj, const char *PropName, int16_t Val, int Idx) |
TEMU_API void | temu_writeValueI32 (void *Obj, const char *PropName, int32_t Val, int Idx) |
TEMU_API void | temu_writeValueI64 (void *Obj, const char *PropName, int64_t Val, int Idx) |
TEMU_API temu_Propval | temu_getNamedObjectProp (const char *Obj, const char *PropName, int Idx) TEMU_NO_WRAP TEMU_DEPRECATED |
TEMU_API temu_Propval | temu_readNamedObjectProp (const char *Obj, const char *PropName, int Idx) TEMU_NO_WRAP TEMU_DEPRECATED |
TEMU_API void | temu_setNamedObjectProp (const char *Obj, const char *PropName, temu_Propval Val, int Idx) TEMU_NO_WRAP TEMU_DEPRECATED |
TEMU_API void | temu_writeNamedObjectProp (const char *Obj, const char *PropName, temu_Propval Val, int Idx) TEMU_NO_WRAP TEMU_DEPRECATED |
TEMU_API temu_Class * | temu_registerClass (const char *ClsName, temu_ObjectCreateFunc Create, temu_ObjectDisposeFunc Dispose) |
TEMU_API temu_Class * | temu_registerExternalClass (const char *ClsName) TEMU_DEPRECATED |
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) |
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) |
TEMU_API int | temu_addLoggingCategory (temu_Class *Cls, unsigned CategoryId, const char *Category) |
TEMU_API const char * | temu_getLoggingCategory (temu_Class *Cls, unsigned CategoryId) |
TEMU_API int | temu_isPseudoProperty (void *Obj, const char *PropName) |
TEMU_API int | temu_isNormalProperty (void *Obj, const char *PropName) |
TEMU_API void | temu_requireInterface (temu_Class *Cls, const char *PropName, const char *IfaceType) |
TEMU_API int | temu_addPort (temu_Class *C, const char *IfaceRefName, const char *IfaceName, const char *Doc) |
TEMU_API void | temu_addInterface (temu_Class *Cls, const char *IfaceName, const char *IfaceType, void *Iface, int DeprecatedParam, const char *Doc) |
TEMU_API void * | temu_getInterface (void *Obj, const char *IfaceName, int Idx) |
TEMU_API temu_IfaceRef | temu_getInterfaceRef (void *Obj, const char *IfaceName, int Idx) |
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) |
TEMU_API int | temu_setVTable (temu_Class *Cls, void *VTable) |
TEMU_API void * | temu_getVTableForClass (temu_Class *Cls) |
TEMU_API void * | temu_getVTable (const void *Obj) |
TEMU_API void | temu_setTimeSource (void *Obj, void *TS) |
TEMU_API int | temu_isExternal (const void *Obj) TEMU_DEPRECATED |
TEMU_API int | temu_isQualifiedAs (const void *Obj, unsigned Qualifier) |
TEMU_API int | temu_isCpu (const void *Obj) |
TEMU_API int | temu_isMachine (const void *Obj) |
TEMU_API int | temu_isMemory (const void *Obj) |
TEMU_API int | temu_isComponent (const void *Obj) |
TEMU_API void | temu_qualifyAsCpu (void *Cls) |
TEMU_API void | temu_qualifyAsMachine (void *Cls) |
TEMU_API void | temu_qualifyAsMemory (void *Cls) |
TEMU_API void | temu_qualifyAs (void *Cls, unsigned Qualifier) |
TEMU_API void | temu_objsysClear (void) |
TEMU_API void | temu_objsysClearObjects (void) |
TEMU_API void * | temu_addObject (const char *ClsName, const char *ObjName, void *Obj) TEMU_DEPRECATED |
TEMU_API void * | temu_createObject (const char *ClsName, const char *ObjName, const temu_CreateArg *Args) |
TEMU_API void | temu_disposeObject (void *Obj) |
TEMU_API temu_Class * | temu_classForName (const char *ClsName) |
TEMU_API const char * | temu_nameForClass (temu_Class *Cls) |
TEMU_API temu_Class * | temu_classForObject (const void *Obj) |
TEMU_API temu_Class * | temu_classForObjectName (const char *Obj) TEMU_DEPRECATED |
TEMU_API int | temu_propInfoForClass (temu_Class *Cls, unsigned PIIndex, unsigned PICount, temu_PropInfo *PI) |
TEMU_API void * | temu_objectForName (const char *Name) |
TEMU_API const char * | temu_nameForObject (const void *Obj) |
TEMU_API const char * | temu_nameForInterface (const void *Obj, const void *Iface) |
TEMU_API const char * | temu_typenameForInterface (const void *Obj, const void *Iface) |
TEMU_API int | temu_loadPlugin (const char *PluginName) |
TEMU_API void | temu_pluginPathAppend (const char *Path) |
TEMU_API void | temu_pluginPathRemove (const char *Path) |
TEMU_API void | temu_pluginPathPrint (void) |
TEMU_API const char * | temu_typeToName (temu_Type Typ) |
TEMU_API void ** | temu_getProcessors (void) |
TEMU_API size_t | temu_getProcessorCount (void) |
TEMU_API void ** | temu_getComponents (void) |
TEMU_API size_t | temu_getComponentCount (void) |
TEMU_API int | temu_connect (void *A, const char *PropName, void *B, const char *IfaceName) |
TEMU_API int | temu_serialiseJSON (const char *FileName) |
TEMU_API int | temu_deserialiseJSON (const char *FileName) |
TEMU_API void | temu_serialiseProp (void *Ctxt, const char *Name, temu_Type Typ, int Count, void *Data) |
TEMU_API void | temu_deserialiseProp (void *Ctxt, void *Obj, const char *Name) |
TEMU_API int | temu_checkpointGetLength (void *Ctxt, const char *Name) |
TEMU_API temu_Propval | temu_checkpointGetValue (void *Ctxt, const char *Name, int Idx) |
TEMU_API int | temu_checkSanity (int Report) |
TEMU_API int | temu_generateObjectGraph (const char *Path, int Display) |
TEMU_API int | temu_isValidObjectName (const char *Name) |
TEMU_API int | temu_isValidClassName (const char *Name) |
TEMU_API int | temu_isValidInterfaceName (const char *Name) |
TEMU_API int | temu_isValidPropertyName (const char *Name) |
TEMU_API void | temu_foreachObject (void(*Func)(void *, void *), void *Arg) |
TEMU_API void | temu_foreachClass (void(*Func)(temu_Class *, void *), void *Arg) |
TEMU_API void | temu_foreachProcessor (void(*Func)(temu_Object *, void *), void *Arg) |
TEMU_API void | temu_foreachProperty (temu_Class *C, void(*Func)(temu_Class *, const char *, void *), void *Arg) |
TEMU_API void | temu_foreachInterface (temu_Class *C, void(*Func)(temu_Class *, const char *, void *), void *Arg) |
#define PROP_VAL_INITIALIZER | ( | typ, | |
suffix, | |||
typetag, | |||
valtag | |||
) |
#define TEMU_NULL_ARG |
typedef void temu_Class |
typedef struct temu_Component temu_Component |
typedef struct temu_CreateArg temu_CreateArg |
typedef struct temu_IfaceRef temu_IfaceRef |
typedef struct temu_IfaceRefArray temu_IfaceRefArray |
typedef void temu_ListNode |
typedef void temu_MetaIface |
typedef void*(* temu_ObjectCreateFunc)(const char *Name, int Argc, const temu_CreateArg *Argv) |
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.
enum temu_Type |
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 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 void* temu_addObject | ( | const char * | ClsName, |
const char * | ObjName, | ||
void * | Obj | ||
) |
Add object with external class.
Note that external classes and objects have been deprecated and the function will be removed in TEMU3.
ClsName | Name of class used for instantiation |
ObjName | Name of object in object system |
Obj | The object to add. |
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_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 checkpointed 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 double temu_asDouble | ( | temu_Propval | Pv | ) |
temu_asDouble Converts the given property to double
Pv | The property to be converted |
TEMU_API int64_t temu_asInteger | ( | temu_Propval | Pv | ) |
temu_asInteger Converts the given propery to integer
Pv | The property to be converted |
TEMU_API uint64_t temu_asUnsigned | ( | temu_Propval | Pv | ) |
temu_asUnsigned 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 serialised property
Ctxt | Context passed to deserialise function |
Name | Name of property / key in the serialised file |
TEMU_API temu_Propval temu_checkpointGetValue | ( | void * | Ctxt, |
const char * | Name, | ||
int | Idx | ||
) |
Get value for named checkpoint 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 temu_classForName
ClsName | The name of the class |
TEMU_API temu_Class* temu_classForObject | ( | const void * | Obj | ) |
Get the class for the given object.
Obj | Pointer to the object |
TEMU_API temu_Class* temu_classForObjectName | ( | const char * | Obj | ) |
Get class for named object
Obj | Pointer to the object |
TEMU_API int temu_connect | ( | void * | A, |
const char * | PropName, | ||
void * | 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 void* 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, |
void * | 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 |
temu_dictCreate Creates a dictionary object
temu_dictDispose Delete a dictionary object
Dict | Pointer to the dictionary object to be deleted |
temu_dictGetNextKey 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 | ||
) |
temu_dictGetValue 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 | ||
) |
temu_dictInsertValue 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 |
temu_dictRemoveValue 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 | ( | void * | Obj | ) |
Dispose object. The function will call the Objects dispose function.
Obj | The object to delete. |
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(*)(void *, 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 void** temu_getComponents | ( | void | ) |
temu_getComponents Get the number of components in the current simulation
TEMU_API void* temu_getInterface | ( | void * | Obj, |
const char * | IfaceName, | ||
int | Idx | ||
) |
TEMU_API temu_IfaceRef temu_getInterfaceRef | ( | void * | Obj, |
const char * | IfaceName, | ||
int | Idx | ||
) |
temu_getInterfaceRef Retrieve a reference to an interface identified by its name
Obj | Pointer to the object containing the interface |
IfaceName | Name of the interface |
Idx | TODO |
TEMU_API const 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 temu_Propval temu_getNamedObjectProp | ( | const char * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getNamedObjectProp Get a property from an object identified by name
Obj | Object name |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API size_t temu_getProcessorCount | ( | void | ) |
temu_getProcessorCount Get the number of processors in the current simulation
TEMU_API void** temu_getProcessors | ( | void | ) |
temu_getProcessors Get the list of processors in the current simulation
TEMU_API int temu_getPropDynLength | ( | const void * | Obj, |
const char * | PropName | ||
) |
temu_getPropDynLength TODO
Obj | Pointer to the object of the property |
PropName | Name of the property |
TEMU_API int temu_getPropLength | ( | const void * | Obj, |
const char * | PropName | ||
) |
temu_getPropLength 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 void * | 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 void * | 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_getPropType 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValue 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 int16_t temu_getValueI16 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueI16 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueI32 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueI64 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueI8 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 uint16_t temu_getValueU16 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueU16 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueU32 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueU64 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 | ( | void * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_getValueU8 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 void* temu_getVTable | ( | const void * | 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 | ) |
temu_getVTableForClass 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 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, |
void *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_isComponent | ( | const void * | Obj | ) |
temu_isComponent Checks if an object is a component
Obj | The object to test |
TEMU_API int temu_isCpu | ( | const void * | Obj | ) |
Predicate for identifying CPU classes. In release without assert builds this runs in O(1) time. The predicate should never be used on external objects.
Obj | The object to test |
TEMU_API int temu_isDiscrete | ( | temu_Propval | Pv | ) |
temu_isDiscrete checks whether the numeric property is an integer-like
Pv | The property to be checked |
TEMU_API int temu_isExternal | ( | const void * | Obj | ) |
Predicate for identifying external classes The function runs in log(n) time, where n is the number of objects registered in the object system. Should not be used during normal execution.
Note that external classes / objects have been deprecated and will be removed in TEMU3.
TEMU_API int temu_isMachine | ( | const void * | Obj | ) |
Predicate for identifying CPU classes. In release without assert builds this runs in O(1) time. The predicate should never be used on external objects.
Obj | The object to test |
TEMU_API int temu_isMemory | ( | const void * | Obj | ) |
temu_isMemory Checks whether an object is a memory object
Obj | The object to test |
TEMU_API int temu_isNormalProperty | ( | void * | 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 | ) |
temu_isNumber Checks whether a property is a number
Pv | The property to be checked |
TEMU_API int temu_isPseudoProperty | ( | void * | 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 void * | 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 | ) |
temu_isReal 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 | ) |
temu_isString 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 | ||
) |
temu_listAppend 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 |
temu_listCreate Create a linked-list object
Typ | The type to be stored in the elements of the linked list |
temu_listDispose Delete a linked-list object
List | The list to be deleted |
TEMU_API temu_ListNode* temu_listGetHead | ( | temu_List * | List | ) |
temu_listGetHead 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 | ) |
temu_listGetNext 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 | ) |
temu_listGetPrev 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 | ) |
temu_listGetTail 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 | ) |
temu_listNodeGetVal 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 | ||
) |
temu_listPrepend 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 | ) |
temu_listRemoveHead 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 | ) |
temu_listRemoveHead 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 T-EMU 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 const 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 |
TEMU_API const char* temu_nameForInterface | ( | const void * | Obj, |
const void * | Iface | ||
) |
Get name for interface
Obj | Pointer to the object that contains the interface |
Iface | Pointer to the interface |
TEMU_API const char* temu_nameForObject | ( | const void * | Obj | ) |
Get the name of an object
Obj | Pointer to the object |
TEMU_API void* temu_objectForName | ( | const char * | Name | ) |
Get object for name
Name | The name of the object |
TEMU_API int temu_objectHasIface | ( | const void * | Obj, |
const char * | IfaceName | ||
) |
temu_objectHasInterface 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 void * | Obj, |
const char * | PropName | ||
) |
temu_objectHasProperty 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. Not that objects of an external class will not be de-allocated. The responsibility of that lies with the programmer.
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. PI Pointer to an array of prop info objects to fill in. |
TEMU_API void temu_qualifyAs | ( | void * | Cls, |
unsigned | Qualifier | ||
) |
Bless the class so that the isQualified predicate returns 1. Qualifiers with the MSb cleared are reserved for T-EMU internals.
Cls | The class to be blessed |
TEMU_API void temu_qualifyAsCpu | ( | void * | 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 | ( | void * | 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 | ( | void * | Cls | ) |
Bless the class so that the isMemory predicate returns 1 temu_qualifyAsMemory
Cls | The class to be blessed |
TEMU_API temu_Propval temu_readNamedObjectProp | ( | const char * | Obj, |
const char * | PropName, | ||
int | Idx | ||
) |
temu_readNamedObjectProp Get a property from an object identified by name with side-effects.
Obj | Object name |
PropName | Property name |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API temu_Propval temu_readValue | ( | void * | 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 int16_t temu_readValueI16 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 uint16_t temu_readValueU16 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 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 temu_Class* temu_registerExternalClass | ( | const char * | ClsName | ) |
Register an external class in the TEMU object system. An external class described objects that are managed outside the object system. Such classes can for example be used to bridge between two different object systems (e.g. TEMU and SMP2).
The function will be removed in TEMU3, to integrate TEMU objects and other object systems create wrapper classes that has a pointer to the external object.
ClsName | The name of the class that is to be created. |
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_setNamedObjectProp | ( | const char * | Obj, |
const char * | PropName, | ||
temu_Propval | Val, | ||
int | Idx | ||
) |
temu_setNamedObjectProp Set a property value, where the object is identified by its name
Obj | Object name |
PropName | Property name |
Val | the value to set |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API void temu_setTimeSource | ( | void * | Obj, |
void * | 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 | ( | void * | 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_setValueI16 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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_setValueU16 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 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 const char* temu_typenameForInterface | ( | const void * | 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_Vector temu_vecCreate | ( | temu_Type | Typ | ) |
temu_vecCreate Create a vector object
Typ | The type of the elements |
TEMU_API void temu_vecDispose | ( | temu_Vector * | Vec | ) |
temu_vecDispose Delete a vector object
Vec | The vector object to be deleted |
TEMU_API void* temu_vecGetData | ( | temu_Vector * | Vec | ) |
temu_vecGetData Retrieve the array of elements of a vector
Vec | The vector, whose elements are requested |
TEMU_API size_t temu_vecGetSize | ( | temu_Vector * | Vec | ) |
temu_vecGetSize 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 | ||
) |
temu_vecPush 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 void temu_writeNamedObjectProp | ( | const char * | Obj, |
const char * | PropName, | ||
temu_Propval | Val, | ||
int | Idx | ||
) |
temu_setNamedObjectProp Set a property value, where the object is identified by its name, with side-effects
Obj | Object name |
PropName | Property name |
Val | the value to set |
Idx | Index of the property. Set to 0 if the property is not an array |
TEMU_API void temu_writeValue | ( | void * | 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_writeValueI16 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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_writeValueU16 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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 | ( | void * | 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. |