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_ */
Variable::parent
int parent
Definition: GTGOTF_Structs.h:107
Variable::type
int type
Definition: GTGOTF_Structs.h:108
gtg_list
Definition: GTGList.h:4
ContainerType::id
int id
Definition: GTGOTF_Structs.h:48
EntityValue::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:79
EntityValue
Definition: GTGOTF2_Structs.h:74
Variable::id
int id
Definition: GTGOTF_Structs.h:110
VariableType
Definition: GTGOTF2_Structs.h:109
EntityValue::id
int id
Definition: GTGOTF_Structs.h:67
otf_color_t
struct otf_color * otf_color_t
Definition: GTGOTF_Structs.h:121
varPrec
double varPrec
Use the double precision type for time and value.
Definition: GTGTypes.h:28
EventType::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:88
VariableType::id
int id
Definition: GTGOTF_Structs.h:102
LinkType::name
char * name
Definition: GTGOTF_Structs.h:82
State::token
gtg_stack token
Definition: GTGOTF2_Structs.h:48
LinkType
Definition: GTGOTF2_Structs.h:92
Variable_t
struct Variable Variable_t
Link::src
int src
Definition: GTGOTF2_Structs.h:104
Variable::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:122
EntityValue_t
struct EntityValue EntityValue_t
Container::name
char * name
Definition: GTGOTF_Structs.h:54
LinkType::contType
int contType
Definition: GTGOTF_Structs.h:84
LinkType::srcType
int srcType
Definition: GTGOTF_Structs.h:85
ContainerType::alias
char * alias
Definition: GTGOTF_Structs.h:47
Container::ctType
int ctType
Definition: GTGOTF_Structs.h:56
StateType::id
int id
Definition: GTGOTF_Structs.h:32
LinkType::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:99
VariableType::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:114
Container_t
struct Container Container_t
EventType::name
char * name
Definition: GTGOTF_Structs.h:73
GTGList.h
LinkType::id
int id
Definition: GTGOTF_Structs.h:87
LinkType::destType
int destType
Definition: GTGOTF_Structs.h:86
ContainerType::name
char * name
Definition: GTGOTF_Structs.h:46
Container
Definition: GTGOTF2_Structs.h:61
EventType::alias
char * alias
Definition: GTGOTF_Structs.h:74
Variable::value
uint64_t value
Definition: GTGOTF2_Structs.h:120
Container::state_stack
State_t state_stack
Definition: GTGOTF2_Structs.h:68
ContainerType
Definition: GTGOTF2_Structs.h:52
LinkType_t
struct LinkType LinkType_t
LinkType::alias
char * alias
Definition: GTGOTF_Structs.h:83
EventType::id
int id
Definition: GTGOTF_Structs.h:76
GTGStack.h
Container::id
int id
Definition: GTGOTF_Structs.h:57
State_t
struct State State_t
Container::alias
char * alias
Definition: GTGOTF_Structs.h:55
ContainerType_t
struct ContainerType ContainerType_t
EventType_t
struct EventType EventType_t
otf_color::green
uint8_t green
Definition: GTGOTF2_Structs.h:128
VariableType::name
char * name
Definition: GTGOTF_Structs.h:99
EntityValue::name
char * name
Definition: GTGOTF_Structs.h:64
Link::time
varPrec time
Definition: GTGOTF2_Structs.h:103
State::cont
int cont
Definition: GTGOTF_Structs.h:39
State::stateType
int stateType
Definition: GTGOTF_Structs.h:40
EntityValue::groupId
int groupId
Definition: GTGOTF2_Structs.h:77
StateType::alias
char * alias
Definition: GTGOTF_Structs.h:30
otf_color::colorID
char * colorID
Definition: GTGOTF2_Structs.h:126
Link_t
struct Link Link_t
EventType
Definition: GTGOTF2_Structs.h:83
otf_color
Definition: GTGOTF2_Structs.h:125
VariableType::contType
int contType
Definition: GTGOTF_Structs.h:101
State::value
int value
Definition: GTGOTF_Structs.h:38
ContainerType::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:57
otf_color::blue
uint8_t blue
Definition: GTGOTF2_Structs.h:129
EntityValue::alias
char * alias
Definition: GTGOTF_Structs.h:65
otf_color::red
uint8_t red
Definition: GTGOTF2_Structs.h:127
StateType::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:40
State
Definition: GTGOTF2_Structs.h:44
VariableType::alias
char * alias
Definition: GTGOTF_Structs.h:100
EventType::contType
int contType
Definition: GTGOTF_Structs.h:75
Container::token
struct gtg_list token
Definition: GTGOTF2_Structs.h:67
StateType::name
char * name
Definition: GTGOTF_Structs.h:29
StateType
Definition: GTGOTF2_Structs.h:35
StateType::groupId
int groupId
Definition: GTGOTF2_Structs.h:38
StateType_t
struct StateType StateType_t
Variable
Definition: GTGOTF2_Structs.h:117
VariableType_t
struct VariableType VariableType_t
Link
Definition: GTGOTF2_Structs.h:102