GTGOTF_Structs.h
Go to the documentation of this file.
#ifndef _GTG_OTF_STRUCTS_H_
#define _GTG_OTF_STRUCTS_H_
#include <stdint.h>
#include "GTGList.h"
#include "GTGStack.h"
/* todo: remove this */
#define MAX_PROCESS 64
typedef struct StateType { /* Func group */
char *name;
char *alias;
int groupId;
int id;
struct gtg_list token; /* stored in the stateTypes list */
} StateType_t;
typedef struct State {
int value;
int cont;
int stateType;
gtg_stack token; /* stored in the states list */
} State_t;
/* ContainerTypes */
typedef struct ContainerType {
char *name;
char *alias;
int id;
struct gtg_list token; /* stored in the ctType list */
} ContainerType_t;
typedef struct Container {
char *name;
char *alias;
int ctType;
int id;
struct gtg_list token; /* stored in the conts list */
State_t state_stack;
} Container_t;
typedef struct EntityValue {
char *name;
char *alias;
int groupId;
int id;
struct gtg_list token; /* not used */
} EntityValue_t;
typedef struct EventType {
char *name;
char *alias;
int contType;
int id;
struct gtg_list token; /* stored in the eventTypes list */
} EventType_t;
typedef struct LinkType {
char *name;
char *alias;
int contType;
int srcType;
int destType;
int id;
struct gtg_list token; /* stored in the linkTypes lisk */
} LinkType_t;
typedef struct Link {
varPrec time;
int src;
} Link_t;
typedef struct VariableType {
char *name;
char *alias;
int contType;
int id;
struct gtg_list token; /* stored in the variableTypes list */
} VariableType_t;
typedef struct Variable {
int parent;
int type;
uint64_t value;
int id;
struct gtg_list token; /* stored in the variables list */
} Variable_t;
struct otf_color {
char *colorID;
uint8_t red;
uint8_t green;
uint8_t blue;
};
typedef struct otf_color* otf_color_t;
#define ContainerType_NIL 0
#define Container_NIL 0
#define StateType_NIL 0
#define State_NIL 0
#define EntityValue_NIL 0
#define EventType_NIL 0
#define LinkType_NIL 0
#define VariableType_NIL 0
#define Variable_NIL 0
#define init_ContainerType(var)\
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).id = ContainerType_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_Container(var) \
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).ctType = ContainerType_NIL; \
(var).id = Container_NIL; \
GTG_LIST_INIT(&(var).token); \
GTG_STACK_INIT(&(var).state_stack.token); \
}while(0)
#define init_StateType(var) \
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).groupId = 0; \
(var).id = StateType_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_EntityValue(var) \
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).groupId = 0; \
(var).id = EntityValue_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_EventType(var) \
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).contType = ContainerType_NIL; \
(var).id = EventType_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_LinkType(var) \
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).contType = ContainerType_NIL; \
(var).srcType = ContainerType_NIL; \
(var).destType = ContainerType_NIL; \
(var).id = LinkType_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_VariableType(var) \
do { \
(var).name = NULL; \
(var).alias = NULL; \
(var).contType = ContainerType_NIL; \
(var).id = VariableType_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_Variable(var) \
do { \
(var).parent = Container_NIL; \
(var).parent = VariableType_NIL; \
(var).value = 0; \
(var).id = Variable_NIL; \
GTG_LIST_INIT(&(var).token); \
}while(0)
#define init_State(var) \
do { \
(var).value = EntityValue_NIL; \
(var).cont = Container_NIL; \
(var).stateType = StateType_NIL; \
GTG_STACK_INIT(&(var).token); \
}while(0)
#define alloc_struct(ptr, type, list_head) \
do { \
ptr = (type*) malloc(sizeof(type)); \
GTG_LIST_INIT(&(ptr->token)); \
ptr->id = (gtg_list_entry((list_head)->prev, type, token)->id) + 1; \
gtg_list_add_tail(&(ptr->token), list_head); \
} while(0)
#define alloc_init_struct(type, ptr, list_head, _name_, _alias_) \
do { \
alloc_struct(ptr, type, list_head); \
(ptr)->name = (char *)malloc(sizeof(char)*(strlen(_name_)+1)); \
strcpy((ptr)->name, _name_); \
(ptr)->alias = (char *)malloc(sizeof(char)*(strlen(_alias_)+1)); \
strcpy((ptr)->alias, _alias_); \
}while(0)
#define alloc_Variable(_ptr_, _id_, _parent_, _type_, _value_) \
do { \
(_ptr_) = (Variable_t*) malloc(sizeof(Variable_t)); \
init_Variable(*(_ptr_)); \
(_ptr_)->id = _id_; \
(_ptr_)->parent = _parent_; \
(_ptr_)->type = _type_; \
(_ptr_)->value = _value_; \
}while(0)
#define alloc_State(_ptr_, _value_, _cont_, _stateType_) \
do { \
_ptr_ = (State_t*) malloc(sizeof(State_t)); \
init_State(*(_ptr_)); \
(_ptr_)->value = _value_; \
(_ptr_)->cont = _cont_; \
(_ptr_)->stateType = _stateType_; \
}while(0)
#define free_struct(_type_, _list_head_)\
do{\
_type_ *ptr, *tmp; \
gtg_list_for_each_entry_safe(ptr, tmp, &(_list_head_).token, token) { \
gtg_list_del(&(ptr->token));\
free(ptr->name);\
free(ptr->alias);\
free(ptr);\
}\
}while(0)
#endif /* _GTG_OTF_STRUCTS_H_ */
GTGList.h
EventType_t
struct EventType EventType_t
StateType_t
struct StateType StateType_t
VariableType_t
struct VariableType VariableType_t
ContainerType_t
struct ContainerType ContainerType_t
Link_t
struct Link Link_t
Variable_t
struct Variable Variable_t
State_t
struct State State_t
otf_color_t
struct otf_color * otf_color_t
Definition GTGOTF_Structs.h:121
Container_t
struct Container Container_t
EntityValue_t
struct EntityValue EntityValue_t
LinkType_t
struct LinkType LinkType_t
GTGStack.h
gtg_stack
struct gtg_list gtg_stack
Definition GTGStack.h:6
varPrec
double varPrec
Use the double precision type for time and value.
Definition GTGTypes.h:28
ContainerType
Definition GTGOTF_Structs.h:45
ContainerType::id
int id
Definition GTGOTF_Structs.h:48
ContainerType::token
struct gtg_list token
Definition GTGOTF_Structs.h:49
ContainerType::alias
char * alias
Definition GTGOTF_Structs.h:47
ContainerType::name
char * name
Definition GTGOTF_Structs.h:46
Container
Definition GTGOTF_Structs.h:53
Container::id
int id
Definition GTGOTF_Structs.h:57
Container::ctType
int ctType
Definition GTGOTF_Structs.h:56
Container::name
char * name
Definition GTGOTF_Structs.h:54
Container::alias
char * alias
Definition GTGOTF_Structs.h:55
Container::token
struct gtg_list token
Definition GTGOTF_Structs.h:58
Container::state_stack
State_t state_stack
Definition GTGOTF_Structs.h:59
EntityValue
Definition GTGOTF_Structs.h:63
EntityValue::token
struct gtg_list token
Definition GTGOTF_Structs.h:68
EntityValue::name
char * name
Definition GTGOTF_Structs.h:64
EntityValue::id
int id
Definition GTGOTF_Structs.h:67
EntityValue::alias
char * alias
Definition GTGOTF_Structs.h:65
EntityValue::groupId
int groupId
Definition GTGOTF_Structs.h:66
EventType
Definition GTGOTF_Structs.h:72
EventType::name
char * name
Definition GTGOTF_Structs.h:73
EventType::id
int id
Definition GTGOTF_Structs.h:76
EventType::alias
char * alias
Definition GTGOTF_Structs.h:74
EventType::token
struct gtg_list token
Definition GTGOTF_Structs.h:77
EventType::contType
int contType
Definition GTGOTF_Structs.h:75
LinkType
Definition GTGOTF_Structs.h:81
LinkType::srcType
int srcType
Definition GTGOTF_Structs.h:85
LinkType::contType
int contType
Definition GTGOTF_Structs.h:84
LinkType::token
struct gtg_list token
Definition GTGOTF_Structs.h:88
LinkType::alias
char * alias
Definition GTGOTF_Structs.h:83
LinkType::name
char * name
Definition GTGOTF_Structs.h:82
LinkType::destType
int destType
Definition GTGOTF_Structs.h:86
LinkType::id
int id
Definition GTGOTF_Structs.h:87
Link
Definition GTGOTF_Structs.h:91
Link::time
varPrec time
Definition GTGOTF_Structs.h:92
Link::src
int src
Definition GTGOTF_Structs.h:93
StateType
Definition GTGOTF_Structs.h:28
StateType::name
char * name
Definition GTGOTF_Structs.h:29
StateType::id
int id
Definition GTGOTF_Structs.h:32
StateType::token
struct gtg_list token
Definition GTGOTF_Structs.h:33
StateType::groupId
int groupId
Definition GTGOTF_Structs.h:31
StateType::alias
char * alias
Definition GTGOTF_Structs.h:30
State
Definition GTGOTF_Structs.h:37
State::cont
int cont
Definition GTGOTF_Structs.h:39
State::stateType
int stateType
Definition GTGOTF_Structs.h:40
State::token
gtg_stack token
Definition GTGOTF_Structs.h:41
State::value
int value
Definition GTGOTF_Structs.h:38
VariableType
Definition GTGOTF_Structs.h:98
VariableType::alias
char * alias
Definition GTGOTF_Structs.h:100
VariableType::token
struct gtg_list token
Definition GTGOTF_Structs.h:103
VariableType::name
char * name
Definition GTGOTF_Structs.h:99
VariableType::contType
int contType
Definition GTGOTF_Structs.h:101
VariableType::id
int id
Definition GTGOTF_Structs.h:102
Variable
Definition GTGOTF_Structs.h:106
Variable::token
struct gtg_list token
Definition GTGOTF_Structs.h:111
Variable::parent
int parent
Definition GTGOTF_Structs.h:107
Variable::type
int type
Definition GTGOTF_Structs.h:108
Variable::value
uint64_t value
Definition GTGOTF_Structs.h:109
Variable::id
int id
Definition GTGOTF_Structs.h:110
gtg_list
Definition GTGList.h:4
otf_color
Definition GTGOTF_Structs.h:114
otf_color::colorID
char * colorID
Definition GTGOTF_Structs.h:115
otf_color::green
uint8_t green
Definition GTGOTF_Structs.h:117
otf_color::blue
uint8_t blue
Definition GTGOTF_Structs.h:118
otf_color::red
uint8_t red
Definition GTGOTF_Structs.h:116