TEMU  4.4
The Terma Emulator
Objsys.h File Reference
#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>
Include dependency graph for Objsys.h:
This graph shows which files directly or indirectly include this file:

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
}
 

Functions

TEMU_API temu_IfaceRefArray temu_ifaceRefArrayAlloc (unsigned Reserve)
 
TEMU_API void temu_ifaceRefArrayPush2 (temu_IfaceRefArray *Arr TEMU_NONNULL, temu_Object_ *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 temu_IfaceRef temu_ifaceRefArrayGet (temu_IfaceRefArray *Arr, unsigned idx)
 
TEMU_API void temu_ifaceRefArrayDispose (temu_IfaceRefArray *Arr)
 
TEMU_API temu_Dicttemu_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)
 
const TEMU_API 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_ListNodetemu_listGetHead (temu_List *List)
 
TEMU_API temu_ListNodetemu_listGetTail (temu_List *List)
 
TEMU_API temu_ListNodetemu_listGetNext (temu_ListNode *Node)
 
TEMU_API temu_ListNodetemu_listGetPrev (temu_ListNode *Node)
 
TEMU_API temu_Propval temu_listNodeGetVal (temu_ListNode *Node)
 
TEMU_API temu_Propref temu_getPropref (const temu_Object_ *Obj, const char *PropName)
 
TEMU_API temu_PropAccessor temu_getPropAccessor (temu_Object *Obj, const char *PropName, int PropIdx)
 
TEMU_API temu_PropName temu_getPropName (const temu_Object_ *Obj, const char *PropName)
 
TEMU_API int temu_getPropLength (const temu_Object_ *Obj, const char *PropName)
 
TEMU_API int temu_getPropDynLength (const temu_Object_ *Obj, const char *PropName)
 
TEMU_API temu_Type temu_getPropType (const temu_Object_ *Obj, const char *PropName)
 
TEMU_API int temu_objectHasProp (const temu_Object_ *Obj, const char *PropName)
 
TEMU_API int temu_objectHasIface (const temu_Object_ *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 (temu_Object_ *Obj, const char *PropName, int Idx) TEMU_NO_WRAP
 
TEMU_API uint8_t temu_getValueU8 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint16_t temu_getValueU16 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint32_t temu_getValueU32 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint64_t temu_getValueU64 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int8_t temu_getValueI8 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int16_t temu_getValueI16 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int32_t temu_getValueI32 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int64_t temu_getValueI64 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API temu_Propval temu_readValue (temu_Object_ *Obj, const char *PropName, int Idx) TEMU_NO_WRAP
 
TEMU_API uint8_t temu_readValueU8 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint16_t temu_readValueU16 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint32_t temu_readValueU32 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint64_t temu_readValueU64 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int8_t temu_readValueI8 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int16_t temu_readValueI16 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int32_t temu_readValueI32 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int64_t temu_readValueI64 (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API void temu_setValue (temu_Object_ *Obj, const char *PropName, temu_Propval Val, int Idx) TEMU_NO_WRAP
 
TEMU_API void temu_setValueU8 (temu_Object_ *Obj, const char *PropName, uint8_t Val, int Idx)
 
TEMU_API void temu_setValueU16 (temu_Object_ *Obj, const char *PropName, uint16_t Val, int Idx)
 
TEMU_API void temu_setValueU32 (temu_Object_ *Obj, const char *PropName, uint32_t Val, int Idx)
 
TEMU_API void temu_setValueU64 (temu_Object_ *Obj, const char *PropName, uint64_t Val, int Idx)
 
TEMU_API void temu_setValueI8 (temu_Object_ *Obj, const char *PropName, int8_t Val, int Idx)
 
TEMU_API void temu_setValueI16 (temu_Object_ *Obj, const char *PropName, int16_t Val, int Idx)
 
TEMU_API void temu_setValueI32 (temu_Object_ *Obj, const char *PropName, int32_t Val, int Idx)
 
TEMU_API void temu_setValueI64 (temu_Object_ *Obj, const char *PropName, int64_t Val, int Idx)
 
TEMU_API void temu_writeValue (temu_Object_ *Obj, const char *PropName, temu_Propval Val, int Idx) TEMU_NO_WRAP
 
TEMU_API void temu_writeValueU8 (temu_Object_ *Obj, const char *PropName, uint8_t Val, int Idx)
 
TEMU_API void temu_writeValueU16 (temu_Object_ *Obj, const char *PropName, uint16_t Val, int Idx)
 
TEMU_API void temu_writeValueU32 (temu_Object_ *Obj, const char *PropName, uint32_t Val, int Idx)
 
TEMU_API void temu_writeValueU64 (temu_Object_ *Obj, const char *PropName, uint64_t Val, int Idx)
 
TEMU_API void temu_writeValueI8 (temu_Object_ *Obj, const char *PropName, int8_t Val, int Idx)
 
TEMU_API void temu_writeValueI16 (temu_Object_ *Obj, const char *PropName, int16_t Val, int Idx)
 
TEMU_API void temu_writeValueI32 (temu_Object_ *Obj, const char *PropName, int32_t Val, int Idx)
 
TEMU_API void temu_writeValueI64 (temu_Object_ *Obj, const char *PropName, int64_t Val, int Idx)
 
TEMU_API void temu_writeValueObj (temu_Object *Obj, const char *PropName, temu_Object *Val, int Idx)
 
TEMU_API temu_Classtemu_registerClass (const char *ClsName, temu_ObjectCreateFunc Create, temu_ObjectDisposeFunc Dispose)
 
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)
 
const TEMU_API char * temu_getLoggingCategory (temu_Class *Cls, unsigned CategoryId)
 
TEMU_API int temu_isPseudoProperty (temu_Object_ *Obj, const char *PropName)
 
TEMU_API int temu_isNormalProperty (temu_Object_ *Obj, const char *PropName)
 
TEMU_API void temu_requireInterface (temu_Class *Cls, const char *PropName, const char *IfaceType)
 
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)
 
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)
 
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 (temu_Object_ *Obj, const char *IfaceName, int Idx)
 
TEMU_API temu_IfaceRef temu_getInterfaceRef (temu_Object_ *Obj, const char *IfaceName, int Idx)
 
const TEMU_API char * temu_getInterfaceName (temu_Object *Obj, void *Iface)
 
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 temu_Object_ *Obj)
 
TEMU_API void temu_setTimeSource (temu_Object_ *Obj, temu_TimeSource_ *TS)
 
TEMU_API int temu_isQualifiedAs (const temu_Object_ *Obj, unsigned Qualifier)
 
TEMU_API int temu_isCpu (const temu_Object_ *Obj)
 
TEMU_API int temu_isMachine (const temu_Object_ *Obj)
 
TEMU_API int temu_isMemory (const temu_Object_ *Obj)
 
TEMU_API int temu_isComponent (const temu_Object_ *Obj)
 
TEMU_API void temu_qualifyAsCpu (temu_Class *Cls)
 
TEMU_API void temu_qualifyAsMachine (temu_Class *Cls)
 
TEMU_API void temu_qualifyAsMemory (temu_Class *Cls)
 
TEMU_API void temu_qualifyAs (temu_Class *Cls, unsigned Qualifier)
 
TEMU_API void temu_objsysClear (void)
 
TEMU_API void temu_objsysClearObjects (void)
 
TEMU_API temu_Object_temu_createObject (const char *ClsName, const char *ObjName, const temu_CreateArg *Args)
 
TEMU_API void temu_disposeObject (temu_Object_ *Obj)
 
TEMU_API temu_Classtemu_classForName (const char *ClsName)
 
const TEMU_API char * temu_nameForClass (temu_Class *Cls)
 
TEMU_API temu_Classtemu_classForObject (const temu_Object_ *Obj)
 
TEMU_API int temu_classHasCommand (const temu_Class *Cls, const char *CmdName)
 
TEMU_API int temu_propInfoForClass (temu_Class *Cls, unsigned PIIndex, unsigned PICount, temu_PropInfo *PI)
 
TEMU_API temu_Object_temu_objectForName (const char *Name)
 
const TEMU_API char * temu_nameForObject (const temu_Object_ *Obj)
 
const TEMU_API char * temu_nameForInterface (const temu_Object_ *Obj, const void *Iface)
 
TEMU_API int temu_indexForInterface (const temu_Object_ *Obj, const void *Iface)
 
const TEMU_API char * temu_typenameForInterface (const temu_Object_ *Obj, const void *Iface)
 
TEMU_API int temu_loadPlugin (const char *PluginName)
 
TEMU_API int temu_loadPluginGlobal (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)
 
const TEMU_API char * temu_typeToName (temu_Type Typ)
 
TEMU_API temu_Object_ ** temu_getProcessors (void)
 
TEMU_API size_t temu_getProcessorCount (void)
 
TEMU_API temu_Component ** temu_getComponents (void)
 
TEMU_API size_t temu_getComponentCount (void)
 
TEMU_API int temu_connect (temu_Object_ *A, const char *PropName, temu_Object_ *B, const char *IfaceName)
 
TEMU_API int temu_serialiseJSON (const char *FileName)
 
TEMU_API int temu_deserialiseJSON (const char *FileName)
 
TEMU_API int temu_inlineDeserialiseJSON (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, temu_Object_ *Obj, const char *Name)
 
TEMU_API int temu_snapshotGetLength (void *Ctxt, const char *Name)
 
TEMU_API int temu_checkpointGetLength (void *Ctxt, const char *Name)
 
TEMU_API temu_Propval temu_snapshotGetValue (void *Ctxt, const char *Name, int Idx)
 
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)(temu_Object_ *, 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)
 
TEMU_API void * temu_registerInterfaceType (const char *Name)
 
TEMU_API void * temu_getInterfaceType (const char *Name)
 
TEMU_API int temu_addScalarProperty (temu_Class *Cls, const char *Name, int offset, temu_Type T, const char *Doc)
 
TEMU_API int temu_addArrayProperty (temu_Class *Cls, const char *Name, int offset, temu_Type T, int NumElems, const char *Doc)
 
TEMU_API int temu_addScalarPseudoProperty (temu_Class *Cls, const char *Name, temu_Type T, const char *Doc)
 
TEMU_API int temu_addArrayPseudoProperty (temu_Class *Cls, const char *Name, temu_Type T, int NumElems, const char *Doc)
 
TEMU_API int temu_writeProp (temu_Object_ *Obj, const char *Name, int idx, temu_Propval *PV)
 
TEMU_API temu_Propval temu_readProp (temu_Object_ *Obj, const char *Name, int idx)
 
TEMU_API uint64_t temu_getValueUnsigned (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int64_t temu_getValueSigned (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API double temu_getValueDouble (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API uint64_t temu_readValueUnsigned (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API int64_t temu_readValueSigned (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API double temu_readValueDouble (temu_Object_ *Obj, const char *PropName, int Idx)
 
TEMU_API void temu_setValueUnsigned (temu_Object_ *Obj, const char *PropName, uint64_t Val, int Idx)
 
TEMU_API void temu_setValueSigned (temu_Object_ *Obj, const char *PropName, int64_t Val, int Idx)
 
TEMU_API void temu_setValueDouble (temu_Object_ *Obj, const char *PropName, double Val, int Idx)
 
TEMU_API void temu_writeValueUnsigned (temu_Object_ *Obj, const char *PropName, uint64_t Val, int Idx)
 
TEMU_API void temu_writeValueSigned (temu_Object_ *Obj, const char *PropName, int64_t Val, int Idx)
 
TEMU_API void temu_writeValueDouble (temu_Object_ *Obj, const char *PropName, double Val, int Idx)
 
TEMU_API temu_Propval temu_signedPropval (temu_Type T, int64_t I)
 
TEMU_API temu_Propval temu_unsignedPropval (temu_Type T, uint64_t U)
 
TEMU_API temu_Propval temu_floatingPointPropval (temu_Type T, double V)
 
TEMU_API int temu_objectHasCmd (const temu_Object_ *Obj, const char *CmdName)
 

Macro Definition Documentation

◆ PROP_ASSERT

#define PROP_ASSERT (   p,
 
)

◆ PROP_VAL_INITIALIZER

#define PROP_VAL_INITIALIZER (   typ,
  suffix,
  typetag,
  valtag 
)
Value:
static inline temu_Propval temu_makeProp##suffix(typ val) \
{ \
temu_Propval pv; \
pv.Typ = typetag; \
pv.valtag = val; \
return pv; \
} \
static inline typ temu_propValue##suffix(temu_Propval pv) \
{ \
PROP_ASSERT(pv.Typ, typetag); \
typ val = pv.valtag; \
return val; \
}

◆ TEMU_BUFF_DEFINED

#define TEMU_BUFF_DEFINED

◆ TEMU_COMPONENT_DEFINED

#define TEMU_COMPONENT_DEFINED

◆ TEMU_DYN_ARRAY_TYPE

#define TEMU_DYN_ARRAY_TYPE (   T,
 
)

◆ TEMU_IFACE_REFERENCE_TYPE

#define TEMU_IFACE_REFERENCE_TYPE (   N)

Easy way of declaring typed interface references and interface reference arrays.

◆ TEMU_NO_WRAP

#define TEMU_NO_WRAP

◆ TEMU_NULL_ARG

#define TEMU_NULL_ARG
Value:
{ \
NULL, \
{ \
teTY_Invalid \
} \
}

◆ TEMU_OBJECT_IFACE_TYPE

#define TEMU_OBJECT_IFACE_TYPE   "ObjectIface"

◆ TEMU_PLUGIN_INIT

#define TEMU_PLUGIN_INIT   TEMU_API void temu_pluginInit(void)

◆ TEMU_QUAL_CLOCK

#define TEMU_QUAL_CLOCK   6

◆ TEMU_QUAL_COMPONENT

#define TEMU_QUAL_COMPONENT   5

◆ TEMU_QUAL_CPU

#define TEMU_QUAL_CPU   1

◆ TEMU_QUAL_MACHINE

#define TEMU_QUAL_MACHINE   2

◆ TEMU_QUAL_MEMORY

#define TEMU_QUAL_MEMORY   4

◆ TEMU_QUAL_NONE

#define TEMU_QUAL_NONE   0

◆ TEMU_QUAL_USER

#define TEMU_QUAL_USER   65536

Typedef Documentation

◆ temu_Class

typedef struct temu_Class temu_Class

◆ temu_Component

◆ temu_CreateArg

Generic constructor argument

The object constructors takes an array of key/value pairs as parameters. The values are passed using either:

  • Registered argument in the Class.new command method.
  • Explicitly to temu_createObject().
  • Args parameter to object-create global command.

The object create function would typically scan through the array, finding relevant matching keys.

◆ temu_Dict

typedef void temu_Dict

◆ temu_IfaceRef

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.

◆ 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.

Note
It is not the intention that the fields in the array are manipulated directly. Instead, use the temu_ifaceRefArray* functions.

◆ temu_ListNode

typedef void temu_ListNode

◆ temu_MetaIface

typedef void temu_MetaIface

◆ temu_Object

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.

Note
While the convention in C is safe, in {cpp} it is the responsibility of the user to ensure that the derived type is a standard layout type.

◆ temu_ObjectCreateFunc

typedef void*(* temu_ObjectCreateFunc) (const char *Name, int Argc, const temu_CreateArg *Argv)

◆ temu_ObjectDisposeFunc

typedef void(* temu_ObjectDisposeFunc) (void *)

◆ 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.

◆ temu_PropReader

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.

◆ temu_Propref

typedef struct temu_Propref temu_Propref

Typed property reference.

The property reference contains a type tag and a raw pointer to the property.

◆ temu_Propval

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.

◆ temu_PropWriter

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.

◆ temu_TimeSource

◆ temu_Type

typedef enum temu_Type 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.

◆ temu_TypeObject

typedef void temu_TypeObject

Enumeration Type Documentation

◆ temu_Type

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.

Function Documentation

◆ temu_addArrayProperty()

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

Parameters
ClsClass pointer
NameName of property
offsetOffset from object pointer
TProperty type
NumElemsArray length
DocDocumentation string
Returns
0 if the property was added

◆ temu_addArrayPseudoProperty()

TEMU_API int temu_addArrayPseudoProperty ( temu_Class Cls,
const char *  Name,
temu_Type  T,
int  NumElems,
const char *  Doc 
)

Add an array pseudo-property

Parameters
ClsClass pointer
NameName of property
TProperty type
NumElemsArray length
DocDocumentation string
Returns
0 if the property was added

◆ temu_addInterface()

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.

Parameters
Cls_nameName of class to add interface to
IfacenameInterface name
IfaceTypeInterface type
IfacePointer to the interface structure.

◆ temu_addInterfaceArray()

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].

Parameters
ClsClass pointer
IfaceNamename of interface
IfaceTypename of interface type
IfacePointer to array of interfaces
CountNumber of interfaces in array
SizeSize of one interface (e.g. sizeof(uartiface[0]))
DocDocumentation comment for interface

◆ temu_addInterfaceReference()

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.

Parameters
ClsThe class object
PropNameName of the property to add.
OffsetOffset in bytes from the start of the class to the value the property refers to.
TypeNameInterface type name.
CountSet to > 1 to indicate that the property is an array, the value is the length of the array.
FlagsFlags for property, 1 implies property is mandatory to set.
WrProperty write function. This function can have side-effects.
RdProperty read function. This function can have side-effects.
DocDocumentation string

◆ temu_addLoggingCategory()

TEMU_API int temu_addLoggingCategory ( temu_Class Cls,
unsigned  CategoryId,
const char *  Category 
)

temu_addLogginCategory adds a logging category to the class

Parameters
Clsthe class
CategoryIdThe category id. Valid range is [8,16)
CategoryThe category name
Returns
0 for success, 1 indicates failure.

◆ temu_addPort()

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.

Parameters
CThe class object
IfaceRefNamethe name of the interface reference property
IfaceNameName of interface that is the inverse of the interface ref property.
DocDocumentation string
Returns
0 on success, non-zero otherwise.

◆ temu_addProperty()

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.

Parameters
ClsThe class object
PropNameName of the property to add.
OffsetOffset in bytes from the start of the class to the value the property refers to.
TypType of the property.
CountSet to > 1 to indicate that the property is an array, the value is the length of the array.
WrProperty write function. This function can have side-effects.
RdProperty read function. This function can have side-effects.
DocDocumentation string

◆ temu_addPseudoInterfaceReference()

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.

Parameters
ClsThe class object
PropNameName of the property to add.
TypeNameInterface type name.
CountSet to > 1 to indicate that the property is an array, the value is the length of the array.
FlagsFlags for property, 1 implies property is mandatory to set.
WrProperty write function. This function can have side-effects.
RdProperty read function. This function can have side-effects.
SetProperty set function. Non-semantic.
GetProperty get function. Non-semantic.
DocDocumentation string

◆ temu_addPseudoProperty()

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.

Parameters
Clsclass to add pseudo property to
PropNamename of pseudo property
TypType of property
Countnumber of elements, 1 for a scalar.
WrProperty write function (semantic effect)
RdProperty read function (semantic effect)
SetProperty set function (non-semantic)
GetProperty get function (non-semantic)
DocDocumentation string

◆ temu_addScalarProperty()

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

Parameters
ClsClass pointer
NameName of property
offsetOffset from object pointer
TProperty type
DocDocumentation string
Returns
0 if the property was added

◆ temu_addScalarPseudoProperty()

TEMU_API int temu_addScalarPseudoProperty ( temu_Class Cls,
const char *  Name,
temu_Type  T,
const char *  Doc 
)

Add a scalar (one element) pseudo-property

Parameters
ClsClass pointer
NameName of property
TProperty type
DocDocumentation string
Returns
0 if the property was added

◆ temu_asDouble()

TEMU_API double temu_asDouble ( temu_Propval  Pv)

Converts the given property to double

Parameters
PvThe property to be converted
Returns
Returns the property as an unsigned integer

◆ temu_asInteger()

TEMU_API int64_t temu_asInteger ( temu_Propval  Pv)

Converts the given propery to integer

Parameters
PvThe property to be converted
Returns
Returns the property as integer

◆ temu_asUnsigned()

TEMU_API uint64_t temu_asUnsigned ( temu_Propval  Pv)

Converts the given property to unsigned integer

Parameters
PvThe property to be converted
Returns
Returns the property as an unsigned integer

◆ temu_checkpointGetLength()

TEMU_API int temu_checkpointGetLength ( void *  Ctxt,
const char *  Name 
)

Get number of entries for the serialized property

Parameters
CtxtContext passed to deserialise function
NameName of property / key in the serialized file
Returns
Length of the property in elements. Negative on error.

◆ temu_checkpointGetValue()

TEMU_API temu_Propval temu_checkpointGetValue ( void *  Ctxt,
const char *  Name,
int  Idx 
)

Get value for named snapshot value

Parameters
CtxtContext is passed to deserialise interface function
NameName of the saved value
IdxIndex of the saved value (if array)
Returns
Property value with the contents saved to the snapshot

◆ temu_checkSanity()

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.

Parameters
Reportset to 1 to have the function report connectivity issues on stdout, 2 to report on stderr, and 0 to not report at all.
Returns
Returns 0 if the object system is connected. Returns non-zero if the object system is not properly connected.

◆ temu_classForName()

TEMU_API temu_Class* temu_classForName ( const char *  ClsName)

Get the class pointer for the named class

Parameters
ClsNameThe name of the class
Returns
Pointer to the class if found, otherwise NULL

◆ temu_classForObject()

TEMU_API temu_Class* temu_classForObject ( const temu_Object_ Obj)

Get the class for the given object.

Parameters
ObjPointer to the object
Returns
Pointer to the class type object

◆ temu_classHasCommand()

TEMU_API int temu_classHasCommand ( const temu_Class Cls,
const char *  CmdName 
)

Query whether the class has a specific command implemented

Parameters
Clsclass to query for a command.
CmdNameCommand name class is expected to implement.
Returns
0 if command is not implemented by class, 1 if implemented.

◆ temu_connect()

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).

Parameters
AThe object to connect.
PropNameThe name of the property in object A
BThe object to connect to.
IfaceNameThe name of the interface in object B
Returns
0 on success, otherwise non-zero

◆ temu_createObject()

TEMU_API temu_Object_* temu_createObject ( const char *  ClsName,
const char *  ObjName,
const temu_CreateArg Args 
)

Create object with class and name.

Parameters
ClsNameName of class used for instantiation
ObjNameName of object in object system
ArgsNamed 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.
Returns
Allocated object. Result is NULL in case of: class does not exist, object already allocated with the given name, out of memory.

◆ temu_deserialiseJSON()

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.

Parameters
FileNameThe filename that contains the JSON data
Returns
0 on success, otherwise non-zero

◆ temu_deserialiseProp()

TEMU_API void temu_deserialiseProp ( void *  Ctxt,
temu_Object_ Obj,
const char *  Name 
)

temu_deserialiseProp Deserialize a serialized property

Parameters
CtxtAn opaque context, this is the same context as is passed to the deserialise interface function.
ObjObject being deserialised
NameThe name of the property

◆ temu_dictCreate()

TEMU_API temu_Dict* temu_dictCreate ( void  )

Creates a dictionary object

Returns
A pointer to the dictionary object

◆ temu_dictDispose()

TEMU_API void temu_dictDispose ( temu_Dict Dict)

Delete a dictionary object

Parameters
DictPointer to the dictionary object to be deleted

◆ temu_dictGetNextKey()

const TEMU_API char* temu_dictGetNextKey ( temu_Dict Dict,
const char *  Key 
)

Given a specific key of a dictionary, the next key is provided by this function

Parameters
DictThe dictionary that contains the keys
KeyThe key, whose next value in the dict to be provided
Returns
The key that comes after Key, or nullptr on failure

◆ temu_dictGetValue()

TEMU_API temu_Propval temu_dictGetValue ( temu_Dict Dict,
const char *  Name 
)

Retrieve a dictionary value by name

Parameters
DictPointer to the dictionary object
NameThe name associated with the value to be retrieved
Returns
The value

◆ temu_dictInsertValue()

TEMU_API int temu_dictInsertValue ( temu_Dict Dict,
const char *  Name,
temu_Propval  Val 
)

Inserts a name/value pair to a dictionary

Parameters
DictPointer to the dictionary object
NameThe name to be inserted
ValThe value to be inserted
Returns
0 on success. Other values indicate failures (e.g. the key is already used)

◆ temu_dictRemoveValue()

TEMU_API int temu_dictRemoveValue ( temu_Dict Dict,
const char *  Name 
)

Erase a name/value pair from a dictionary by name

Parameters
DictPointer to the dictionary object
NameThe name of the pair to be removed
Returns
0 on success. Other values indicate errors (e.g. key was unavailable in the dictionary)

◆ temu_disposeObject()

TEMU_API void temu_disposeObject ( temu_Object_ Obj)

Dispose object. The function will call the Objects dispose function.

Parameters
ObjThe object to delete.

◆ temu_floatingPointPropval()

TEMU_API temu_Propval temu_floatingPointPropval ( temu_Type  T,
double  V 
)

Create a floating point propval of the given type

Parameters
TType ID, must be a teTY_Float or teTY_Double
VValue
Returns
Property value with the given type and value.

◆ temu_foreachClass()

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.

Parameters
FuncFunction to call
ArgArgument passed as the last parameter to Func

◆ temu_foreachInterface()

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.

Parameters
CClass to iterate properties
FuncFunction to call
ArgArgument passed as the last parameter to Func

◆ temu_foreachObject()

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.

Parameters
FuncFunction to call
ArgArgument passed as the last parameter to Func

◆ temu_foreachProcessor()

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.

Parameters
FuncFunction to call
ArgArgument passed as the last parameter to Func

◆ temu_foreachProperty()

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.

Parameters
CClass to iterate properties
FuncFunction to call
ArgArgument passed as the last parameter to Func

◆ temu_generateObjectGraph()

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.

Parameters
PathDestination file to write the graph to. NULL indicates stdout.
DisplayIf non-zero, the function will attempt to display the graph by running it through dot and .
Returns
0 if the generation was successful. Non-zero in case of failure.

◆ temu_getComponentCount()

TEMU_API size_t temu_getComponentCount ( void  )

temu_getComponentCount Get the number of components in the current simulation

Returns
The number of components in the current simulation

◆ temu_getComponents()

TEMU_API temu_Component** temu_getComponents ( void  )

temu_getComponents Get the number of components in the current simulation

Returns
An array of the pointers to the components in the current simulation, the length of the array can be obtained from temu_getComponentCount()

◆ temu_getInterface()

TEMU_API void* temu_getInterface ( temu_Object_ Obj,
const char *  IfaceName,
int  Idx 
)

◆ temu_getInterfaceName()

const TEMU_API char* temu_getInterfaceName ( temu_Object Obj,
void *  Iface 
)

temu_getInterfaceName Get Interface Name of the Obj

Parameters
ObjPointer to the object containing the interface
IfaceInterface to be find w.r.t. Object
Returns
The name of the interface

◆ temu_getInterfaceRef()

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

Parameters
ObjPointer to the object containing the interface
IfaceNameName of the interface
IdxInterface index
Returns
The interface reference as a temu_IfaceRef object

◆ temu_getInterfaceType()

TEMU_API void* temu_getInterfaceType ( const char *  Name)

◆ temu_getLoggingCategory()

const TEMU_API char* temu_getLoggingCategory ( temu_Class Cls,
unsigned  CategoryId 
)

temu_getLogginCategory adds a logging category to the class

Parameters
Clsthe class
CategoryIdThe category id. Valid range is [8,16)
Returns
Pointer to the category string, NULL for failure.

◆ temu_getProcessorCount()

TEMU_API size_t temu_getProcessorCount ( void  )

temu_getProcessorCount Get the number of processors in the current simulation

Returns
The number of processors in the current simulation

◆ temu_getProcessors()

TEMU_API temu_Object_** temu_getProcessors ( void  )

temu_getProcessors Get the list of processors in the current simulation

Returns
An array of processor pointers, the length can be obtained from temu_getProcessorCount()

◆ temu_getPropAccessor()

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].

Parameters
ObjAn object of a class with the relevant property registered.
PropNameThe name of the property to be queried.
PropIdxIndex in property array.
Returns
A struct containing prop accessor data.

◆ temu_getPropDynLength()

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.

Parameters
ObjPointer to the object of the property
PropNameName of the property
Returns
Dynamic length of property

◆ temu_getPropLength()

TEMU_API int temu_getPropLength ( const temu_Object_ Obj,
const char *  PropName 
)

Returns property length/size if a property is an array

Parameters
ObjPointer to the object of the property
PropNameName of the property
Returns
The length of the property

◆ temu_getPropName()

TEMU_API temu_PropName temu_getPropName ( const temu_Object_ Obj,
const char *  PropName 
)

Get a reference to a named property.

Parameters
ObjAn object of a class with the relevant property registered.
PropNameThe name of the property to be queried.
Returns
Prop name object, note that the returned name string is not the same as the passed string. The returned string has a lifetime bound to the class, hence it can be returned without any problems.

◆ temu_getPropref()

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.

Parameters
ObjAn object of a class with the relevant property registered.
PropNameThe name of the property to be queried.
Returns
Object of the property reference

◆ temu_getPropType()

TEMU_API temu_Type temu_getPropType ( const temu_Object_ Obj,
const char *  PropName 
)

Get the type of a property

Parameters
ObjPointer to the object of the property
PropNameName of the property
Returns
Property type

◆ temu_getValue()

TEMU_API temu_Propval temu_getValue ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Get the value of a property from an object

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueDouble()

TEMU_API double temu_getValueDouble ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Get property (without side effects)

Parameters
ObjObject pointer
PropNameName of property
IdxIndex in property array (set to 0 if scalar)
Returns
The property value converted to double

◆ temu_getValueI16()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueI32()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueI64()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueI8()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueSigned()

TEMU_API int64_t temu_getValueSigned ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Get property (without side effects)

Parameters
ObjObject pointer
PropNameName of property
IdxIndex in property array (set to 0 if scalar)
Returns
The property value converted to signed

◆ temu_getValueU16()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueU32()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueU64()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueU8()

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

Parameters
ObjThe object that contains the property
PropNameProperty name
IdxIndex of the property. Set to 0 if the property is not an array
Returns
The value of the property

◆ temu_getValueUnsigned()

TEMU_API uint64_t temu_getValueUnsigned ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Get property (without side effects)

Parameters
ObjObject pointer
PropNameName of property
IdxIndex in property array (set to 0 if scalar)
Returns
The property value converted to unsigned

◆ temu_getVTable()

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.

Parameters
ObjThe object in question
Returns
Pointer to the vtable in question

◆ temu_getVTableForClass()

TEMU_API void* temu_getVTableForClass ( temu_Class Cls)

Get the VTable pointer for a class

Parameters
ClsThe class, for which the vtable is to be retrieved
Returns
Pointer to the vtable in question

◆ temu_ifaceRefArrayAlloc()

TEMU_API temu_IfaceRefArray temu_ifaceRefArrayAlloc ( unsigned  Reserve)

Allocate interface array.

Parameters
ReserveNumber of entries to reserve initially.
Returns
The allocated interface array.

◆ temu_ifaceRefArrayDispose()

TEMU_API void temu_ifaceRefArrayDispose ( temu_IfaceRefArray Arr)

◆ temu_ifaceRefArrayGet()

TEMU_API temu_IfaceRef temu_ifaceRefArrayGet ( temu_IfaceRefArray Arr,
unsigned  idx 
)

Get the index of the interface reference array.

Parameters
ArrThe interface reference array
idxis the index of the array
Returns
The interface array with in bounds.

◆ temu_ifaceRefArrayPush()

TEMU_API void temu_ifaceRefArrayPush ( temu_IfaceRefArray *Arr  TEMU_NONNULL,
temu_IfaceRef  Iface 
)

Push an interface reference to the interface array.

Parameters
ArrThe interface reference array
IfaceThe interface reference (object-interface pointer pair)

◆ temu_ifaceRefArrayPush2()

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.

Parameters
ArrThe interface reference array.
ObjThe object implementing the relevant interface
IfacePointer to the interface struct.

◆ temu_ifaceRefArraySize()

TEMU_API unsigned temu_ifaceRefArraySize ( temu_IfaceRefArray Arr)

Get the length of a dynamically allocated interface array.

Parameters
ArrThe interface array to get the size from.
Returns
The length in number of entries.

◆ temu_indexForInterface()

TEMU_API int temu_indexForInterface ( const temu_Object_ Obj,
const void *  Iface 
)

Get index for interface

Parameters
ObjPointer to the object that contains the interface
IfacePointer to the interface
Returns
Index of interface if it is in an iface array. Otherwise it returns -1. Consequently the function only have valid result for interface arrays.

◆ temu_inlineDeserialiseJSON()

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.

Parameters
FileNameThe filename that contains the JSON data
Returns
0 on success, otherwise non-zero

◆ temu_isComponent()

TEMU_API int temu_isComponent ( const temu_Object_ Obj)

temu_isComponent Checks if an object is a component

Parameters
ObjThe object to test
Returns
0 for false, non-zero for true

◆ temu_isCpu()

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.

Parameters
ObjThe object to test
Returns
0 for false, non-zero for true

◆ temu_isDiscrete()

TEMU_API int temu_isDiscrete ( temu_Propval  Pv)

Checks whether the numeric property is an integer-like

Parameters
PvThe property to be checked
Returns
0 for false, non-zero for true

◆ temu_isMachine()

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..

Parameters
ObjThe object to test
Returns
0 for false, non-zero for true

◆ temu_isMemory()

TEMU_API int temu_isMemory ( const temu_Object_ Obj)

temu_isMemory Checks whether an object is a memory object

Parameters
ObjThe object to test
Returns
0 for false, non-zero for true

◆ temu_isNormalProperty()

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)

Parameters
ObjThe object that contains the property
PropNameThe property name
Returns
0 for false, non-zero for true

◆ temu_isNumber()

TEMU_API int temu_isNumber ( temu_Propval  Pv)

Checks whether a property is a number

Parameters
PvThe property to be checked
Returns
0 for false, non-zero for true

◆ temu_isPseudoProperty()

TEMU_API int temu_isPseudoProperty ( temu_Object_ Obj,
const char *  PropName 
)

temu_isPseudoProperty Checks whether a property is a pseudo-property

Parameters
ObjThe object that contains the property
PropNameThe property name
Returns
0 for false, non-zero for true

◆ temu_isQualifiedAs()

TEMU_API int temu_isQualifiedAs ( const temu_Object_ Obj,
unsigned  Qualifier 
)

temu_isQualifiedAs Check if an object is qualified as Qualifier

Parameters
ObjThe object to be checked
QualifierThe qualification to be checked
Returns
0 for false, non-zero for true

◆ temu_isReal()

TEMU_API int temu_isReal ( temu_Propval  Pv)

Checks whether a property is a real number

Parameters
PvThe property to be checked
Returns
0 for false, non-zero for true

◆ temu_isSigned()

TEMU_API int temu_isSigned ( temu_Propval  Pv)

◆ temu_isString()

TEMU_API int temu_isString ( temu_Propval  Pv)

Checks whether a property is a string

Parameters
PvThe property to be checked
Returns
0 for false, non-zero for true

◆ temu_isUnsigned()

TEMU_API int temu_isUnsigned ( temu_Propval  Pv)

◆ temu_isValidClassName()

TEMU_API int temu_isValidClassName ( const char *  Name)

◆ temu_isValidInterfaceName()

TEMU_API int temu_isValidInterfaceName ( const char *  Name)

◆ temu_isValidObjectName()

TEMU_API int temu_isValidObjectName ( const char *  Name)

◆ temu_isValidPropertyName()

TEMU_API int temu_isValidPropertyName ( const char *  Name)

◆ temu_listAppend()

TEMU_API void temu_listAppend ( temu_List List,
temu_Propval  Val 
)

Add an element to the end of a linked-list

Parameters
ListThe list, to which the element to be added
ValThe element to be added

◆ temu_listCreate()

TEMU_API temu_List temu_listCreate ( temu_Type  Typ)

Create a linked-list object

Parameters
TypThe type to be stored in the elements of the linked list
Returns
A newly created list.

◆ temu_listDispose()

TEMU_API void temu_listDispose ( temu_List List)

Delete a linked-list object

Parameters
ListThe list to be deleted

◆ temu_listGetHead()

TEMU_API temu_ListNode* temu_listGetHead ( temu_List List)

Get the first element of a linked-list

Parameters
ListThe list, whose first element is requested
Returns
Pointer to the first element of the linked-list

◆ temu_listGetNext()

TEMU_API temu_ListNode* temu_listGetNext ( temu_ListNode Node)

Get the next element of a linked list

Parameters
NodeThe node, whose next element is requested
Returns
The next element if available, otherwise nullptr

◆ temu_listGetPrev()

TEMU_API temu_ListNode* temu_listGetPrev ( temu_ListNode Node)

Get the previous element of a linked list

Parameters
NodeThe node, whose next element is requested
Returns
The previous element if available, otherwise nullptr

◆ temu_listGetTail()

TEMU_API temu_ListNode* temu_listGetTail ( temu_List List)

Get the last element of a linked-list

Parameters
ListThe list, whose last element is requested
Returns
Pointer to the last element of the linked-list

◆ temu_listNodeGetVal()

TEMU_API temu_Propval temu_listNodeGetVal ( temu_ListNode Node)

Get value of a linked-list node

Parameters
NodeThe node, from which the value to be extracted
Returns
The value extracted from the node

◆ temu_listPrepend()

TEMU_API void temu_listPrepend ( temu_List List,
temu_Propval  Val 
)

Add an element to the beginning of a linked-list

Parameters
ListThe list, to which the element to be added
ValThe element to be added

◆ temu_listRemoveHead()

TEMU_API temu_Propval temu_listRemoveHead ( temu_List List)

Removes the first element of a linked-list

Parameters
ListThe list, from which the first element to be removed
Returns
The element that was removed from the list

◆ temu_listRemoveTail()

TEMU_API temu_Propval temu_listRemoveTail ( temu_List List)

Removes the last element of a linked-list

Parameters
ListThe list, from which the last element to be removed
Returns
The element that was removed from the list

◆ temu_loadPlugin()

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.

Parameters
PluginNameA path or plugin name
Returns
0 on success, non-zero otherwise.

◆ temu_loadPluginGlobal()

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.

Parameters
PluginNameA path or plugin name
Returns
0 on success, non-zero otherwise.

◆ temu_nameForClass()

const TEMU_API char* temu_nameForClass ( temu_Class Cls)

temu_nameForClass Get the class name from its object

Parameters
ClsPointer to the object of the class in question
Returns
The name of the class as a C-string

◆ temu_nameForInterface()

const TEMU_API char* temu_nameForInterface ( const temu_Object_ Obj,
const void *  Iface 
)

Get name for interface

Parameters
ObjPointer to the object that contains the interface
IfacePointer to the interface
Returns
The name of the interface as C-string

◆ temu_nameForObject()

const TEMU_API char* temu_nameForObject ( const temu_Object_ Obj)

Get the name of an object

Parameters
ObjPointer to the object
Returns
Name of the object as C-string

◆ temu_objectForName()

TEMU_API temu_Object_* temu_objectForName ( const char *  Name)

Get object for name

Parameters
NameThe name of the object
Returns
Pointer to the object

◆ temu_objectHasCmd()

TEMU_API int temu_objectHasCmd ( const temu_Object_ Obj,
const char *  CmdName 
)

Check if object has a command

Parameters
ObjObject pointer
CmdNameName of command
Returns
0 in case command does not exist. Otherwise 1.

◆ temu_objectHasIface()

TEMU_API int temu_objectHasIface ( const temu_Object_ Obj,
const char *  IfaceName 
)

Check if the object has a named interface

Parameters
ObjPointer to the object to query
IfaceNameInterface name to look for
Returns
0 if the interface does not exist, otherwise the interface exists

◆ temu_objectHasProp()

TEMU_API int temu_objectHasProp ( const temu_Object_ Obj,
const char *  PropName 
)

Check if the object has a named property

Parameters
ObjPointer to the object of the property
PropNameName of the property
Returns
0 if the property does not exist, otherwise the property is valid

◆ temu_objsysClear()

TEMU_API void temu_objsysClear ( void  )

Erase all classes, interfaces, properties and objects registered in the object system.

◆ temu_objsysClearObjects()

TEMU_API void temu_objsysClearObjects ( void  )

Erase all objects, but do not delete classes.

◆ temu_pluginPathAppend()

TEMU_API void temu_pluginPathAppend ( const char *  Path)

temu_pluginPathAppend Add a path to the list of paths, where T-emu searches for plugins

Parameters
PathThe path to append

◆ temu_pluginPathPrint()

TEMU_API void temu_pluginPathPrint ( void  )

temu_pluginPathPrint Print the list of paths, where T-emu searches for plugins

◆ temu_pluginPathRemove()

TEMU_API void temu_pluginPathRemove ( const char *  Path)

temu_pluginPathRemove Remove a path from the list of paths, where T-emu searches for plugins

Parameters
Pathto remove

◆ temu_propInfoForClass()

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:

temu_PropInfo PI; unsigned i = 0; int r;
while ((r = temu_propInfoForClass(C, i, 1, &PI)) == 1) {
// ...
i += r;
}
Parameters
ClsThe class to inspect
PIIndexThe property index to read from.
PICountSize of PI array in number of entries. \Param PI Pointer to an array of prop info objects to fill in.
Returns
Number of read PI entries. In case PI is NULL, the total number of PIs for the class.

◆ temu_qualifyAs()

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.

Parameters
ClsThe class to be blessed

◆ temu_qualifyAsCpu()

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.

Parameters
ClsThe class to be blessed

◆ temu_qualifyAsMachine()

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.

Parameters
ClsThe class to be blessed

◆ temu_qualifyAsMemory()

TEMU_API void temu_qualifyAsMemory ( temu_Class Cls)

Bless the class so that the isMemory predicate returns 1

Parameters
ClsThe class to be blessed

◆ temu_readProp()

TEMU_API temu_Propval temu_readProp ( temu_Object_ Obj,
const char *  Name,
int  idx 
)

Read property (with side effects)

Parameters
ObjObject pointer
NameName of property
idxIndex in property array (set to 0 if scalar)
Returns
The read value, set to teTY_Invalid for failures

◆ temu_readValue()

TEMU_API temu_Propval temu_readValue ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Read a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
IdxIndex of property, set to 0 if it is not an array.
Returns
The property value corresponding to the name. In case of the property not being found, the Typ field of the returned property will be teTY_Invalid.

◆ temu_readValueDouble()

TEMU_API double temu_readValueDouble ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Read property (with side effects)

Parameters
ObjObject pointer
PropNameName of property
IdxIndex in property array (set to 0 if scalar)
Returns
The property value converted to double

◆ temu_readValueI16()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueI32()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueI64()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueI8()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueSigned()

TEMU_API int64_t temu_readValueSigned ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Read property (with side effects)

Parameters
ObjObject pointer
PropNameName of property
IdxIndex in property array (set to 0 if scalar)
Returns
The property value converted to signed

◆ temu_readValueU16()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueU32()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueU64()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueU8()

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.

Parameters
ObjObject pointer
PropNameName of property to read
IdxIndex in property array, set to 0 if the property is not an array
Returns
The read out property value.

◆ temu_readValueUnsigned()

TEMU_API uint64_t temu_readValueUnsigned ( temu_Object_ Obj,
const char *  PropName,
int  Idx 
)

Read property (with side effects)

Parameters
ObjObject pointer
PropNameName of property
IdxIndex in property array (set to 0 if scalar)
Returns
The property value converted to unsigned

◆ temu_registerClass()

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.

Parameters
ClsNameThe name of the class that is to be created.
CreateA constructor, the constructor is responsible for allocation and initialisation of the object.
DisposeA destructor, this function is responsible for deleting the objects of the class.
Returns
A pointer to the class object that can be further used to register properties and interfaces.

◆ temu_registerInterfaceType()

TEMU_API void* temu_registerInterfaceType ( const char *  Name)

◆ temu_requireInterface()

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.

Parameters
ClsClass pointer
PropNameName of interface reference property
IfaceTypeType required to connect the property

◆ temu_serialiseJSON()

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.

Parameters
FileNameThe filename, to which the JSON data is to be stored
Returns
0 on success, otherwise non-zero

◆ temu_serialiseProp()

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.

Parameters
CtxtThe context object that has the property (same as passed to serialise function in the interface)
NameThe name of the property
TypThe type of the property
Count0 if the property is not an array, otherwise the element number in the property
DataSerialized data

◆ temu_setTimeSource()

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.

Parameters
ObjObject to set time source in.
TSTime source object (CPU or clock model)

◆ temu_setValue()

TEMU_API void temu_setValue ( temu_Object_ Obj,
const char *  PropName,
temu_Propval  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueDouble()

TEMU_API void temu_setValueDouble ( temu_Object_ Obj,
const char *  PropName,
double  Val,
int  Idx 
)

Set floating point property (without side effects)

Parameters
ObjObject pointer
PropNameName of property
ValThe new property value
IdxIndex in property array (set to 0 if scalar)

◆ temu_setValueI16()

TEMU_API void temu_setValueI16 ( temu_Object_ Obj,
const char *  PropName,
int16_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueI32()

TEMU_API void temu_setValueI32 ( temu_Object_ Obj,
const char *  PropName,
int32_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueI64()

TEMU_API void temu_setValueI64 ( temu_Object_ Obj,
const char *  PropName,
int64_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueI8()

TEMU_API void temu_setValueI8 ( temu_Object_ Obj,
const char *  PropName,
int8_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueSigned()

TEMU_API void temu_setValueSigned ( temu_Object_ Obj,
const char *  PropName,
int64_t  Val,
int  Idx 
)

Set signed property (without side effects)

Parameters
ObjObject pointer
PropNameName of property
ValThe new property value
IdxIndex in property array (set to 0 if scalar)

◆ temu_setValueU16()

TEMU_API void temu_setValueU16 ( temu_Object_ Obj,
const char *  PropName,
uint16_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueU32()

TEMU_API void temu_setValueU32 ( temu_Object_ Obj,
const char *  PropName,
uint32_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueU64()

TEMU_API void temu_setValueU64 ( temu_Object_ Obj,
const char *  PropName,
uint64_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueU8()

TEMU_API void temu_setValueU8 ( temu_Object_ Obj,
const char *  PropName,
uint8_t  Val,
int  Idx 
)

Set a raw property value without side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_setValueUnsigned()

TEMU_API void temu_setValueUnsigned ( temu_Object_ Obj,
const char *  PropName,
uint64_t  Val,
int  Idx 
)

Set unsigned property (without side effects)

Parameters
ObjObject pointer
PropNameName of property
ValThe new property value
IdxIndex in property array (set to 0 if scalar)

◆ temu_setVTable()

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.

Parameters
ClsThe class, for which the vtable to be set
VTablePointer to the vtable to be used
Returns
0 on success, non-zero otherwise.

◆ temu_signedPropval()

TEMU_API temu_Propval temu_signedPropval ( temu_Type  T,
int64_t  I 
)

Create a signed propval of the given type

Parameters
TType ID, must be a signed integer type tag
IInteger value
Returns
Property value with the given type and value.

◆ temu_snapshotGetLength()

TEMU_API int temu_snapshotGetLength ( void *  Ctxt,
const char *  Name 
)

Get number of entries for the serialized property

Parameters
CtxtContext passed to deserialise function
NameName of property / key in the serialized file
Returns
Length of the property in elements. Negative on error.

◆ temu_snapshotGetValue()

TEMU_API temu_Propval temu_snapshotGetValue ( void *  Ctxt,
const char *  Name,
int  Idx 
)

Get value for named snapshot value

Parameters
CtxtContext is passed to deserialise interface function
NameName of the saved value
IdxIndex of the saved value (if array)
Returns
Property value with the contents saved to the snapshot

◆ temu_typenameForInterface()

const TEMU_API char* temu_typenameForInterface ( const temu_Object_ Obj,
const void *  Iface 
)

Get type name for interface

Parameters
ObjPointer to the object that contains the interface
IfacePointer to the interface
Returns
The name of the type as C-string

◆ temu_typeToName()

const TEMU_API char* temu_typeToName ( temu_Type  Typ)

Get a string representing the type tag.

Parameters
TypThe type, whose name is required
Returns
The name as a C-string

◆ temu_unsignedPropval()

TEMU_API temu_Propval temu_unsignedPropval ( temu_Type  T,
uint64_t  U 
)

Create an unsigned propval of the given type

Parameters
TType ID, must be an unsigned integer type tag
UInteger value
Returns
Property value with the given type and value.

◆ temu_vecCreate()

TEMU_API temu_Vector temu_vecCreate ( temu_Type  Typ)

Create a vector object

Parameters
TypThe type of the elements
Returns
the vector object created

◆ temu_vecDispose()

TEMU_API void temu_vecDispose ( temu_Vector Vec)

Delete a vector object

Parameters
VecThe vector object to be deleted

◆ temu_vecGetData()

TEMU_API void* temu_vecGetData ( temu_Vector Vec)

Retrieve the array of elements of a vector

Parameters
VecThe vector, whose elements are requested
Returns
Returns a pointer to the first element of the vector

◆ temu_vecGetSize()

TEMU_API size_t temu_vecGetSize ( temu_Vector Vec)

Get the number of elements of a vector

Parameters
VecThe vector, whose size to be retrieved
Returns
The number of elements in Vec

◆ temu_vecPush()

TEMU_API void temu_vecPush ( temu_Vector Vec,
temu_Propval  Val 
)

Add an element to a vector object

Parameters
VecThe vector, to which the element to be added
ValThe element to be added

◆ temu_writeProp()

TEMU_API int temu_writeProp ( temu_Object_ Obj,
const char *  Name,
int  idx,
temu_Propval PV 
)

Write property (with side effects)

Parameters
ObjObject pointer
NameName of property
idxIndex in property array (set to 0 if scalar)
PVPointer to propval
Returns
0 if the property was written

◆ temu_writeValue()

TEMU_API void temu_writeValue ( temu_Object_ Obj,
const char *  PropName,
temu_Propval  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueDouble()

TEMU_API void temu_writeValueDouble ( temu_Object_ Obj,
const char *  PropName,
double  Val,
int  Idx 
)

Write floating point property (with side effects)

Parameters
ObjObject pointer
PropNameName of property
ValThe new property value
IdxIndex in property array (set to 0 if scalar)

◆ temu_writeValueI16()

TEMU_API void temu_writeValueI16 ( temu_Object_ Obj,
const char *  PropName,
int16_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueI32()

TEMU_API void temu_writeValueI32 ( temu_Object_ Obj,
const char *  PropName,
int32_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueI64()

TEMU_API void temu_writeValueI64 ( temu_Object_ Obj,
const char *  PropName,
int64_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueI8()

TEMU_API void temu_writeValueI8 ( temu_Object_ Obj,
const char *  PropName,
int8_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueObj()

TEMU_API void temu_writeValueObj ( temu_Object Obj,
const char *  PropName,
temu_Object Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueSigned()

TEMU_API void temu_writeValueSigned ( temu_Object_ Obj,
const char *  PropName,
int64_t  Val,
int  Idx 
)

Write signed property (with side effects)

Parameters
ObjObject pointer
PropNameName of property
ValThe new property value
IdxIndex in property array (set to 0 if scalar)

◆ temu_writeValueU16()

TEMU_API void temu_writeValueU16 ( temu_Object_ Obj,
const char *  PropName,
uint16_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueU32()

TEMU_API void temu_writeValueU32 ( temu_Object_ Obj,
const char *  PropName,
uint32_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueU64()

TEMU_API void temu_writeValueU64 ( temu_Object_ Obj,
const char *  PropName,
uint64_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueU8()

TEMU_API void temu_writeValueU8 ( temu_Object_ Obj,
const char *  PropName,
uint8_t  Val,
int  Idx 
)

Write a property value with side-effects

Parameters
ObjObject pointer
PropNameName of property to read.
ValThe value to set. It must be of the correct type.
IdxIndex of property, set to 0 if it is not an array.

◆ temu_writeValueUnsigned()

TEMU_API void temu_writeValueUnsigned ( temu_Object_ Obj,
const char *  PropName,
uint64_t  Val,
int  Idx 
)

Write unsigned property (with side effects)

Parameters
ObjObject pointer
PropNameName of property
ValThe new property value
IdxIndex in property array (set to 0 if scalar)
temu_PropInfo
Definition: Objsys.h:1885
temu_Propval
Definition: Objsys.h:388
temu_propInfoForClass
TEMU_API int temu_propInfoForClass(temu_Class *Cls, unsigned PIIndex, unsigned PICount, temu_PropInfo *PI)
temu_Propval::Typ
temu_Type Typ
Value type.
Definition: Objsys.h:389