Clement Deschamps
Builds for 1 pipeline passed in 1 minute 0 seconds

model: add a end_of_simulation callback

... ... @@ -50,6 +50,7 @@ typedef struct Model Model;
typedef void (*eoe_cb)(Model *model);
typedef void (*sos_cb)(Model *model);
typedef void (*eos_cb)(Model *model);
struct Model
{
... ... @@ -57,6 +58,7 @@ struct Model
char *name;
eoe_cb end_of_elaboration;
sos_cb start_of_simulation;
eos_cb end_of_simulation;
Method *methods;
Socket *sockets;
Model *next;
... ... @@ -67,10 +69,12 @@ const char *tlm2c_model_get_name(Model *model);
void model_add_method(Model *model, Method *method);
void model_register_end_of_elaboration(Model *model, eoe_cb cb);
void model_register_start_of_simulation(Model *model, sos_cb cb);
void model_register_end_of_simulation(Model *model, eos_cb cb);
void model_add_socket(Model *model, Socket *socket);
void model_destroy(Model *model);
void model_end_of_elaboration(Model *model);
void model_start_of_simulation(Model *model);
void model_end_of_simulation(Model *model);
void model_notify(Model *model);
Model *get_models(void);
... ...
... ... @@ -120,6 +120,11 @@ void model_register_start_of_simulation(Model *model, eoe_cb cb)
model->start_of_simulation = cb;
}
void model_register_end_of_simulation(Model *model, eoe_cb cb)
{
model->end_of_simulation = cb;
}
void default_end_of_elaboration(Model *model)
{
/* Nothing to do. */
... ... @@ -153,6 +158,11 @@ void model_start_of_simulation(Model *model)
model->start_of_simulation(model);
}
void model_end_of_simulation(Model *model)
{
model->end_of_simulation(model);
}
void model_notify(Model *model)
{
method_notification(model->methods);
... ... @@ -184,3 +194,14 @@ void tlm2c_start_of_simulation(void)
model = model->next;
}
}
void tlm2c_end_of_simulation(void)
{
Model *model = head;
while (model != NULL)
{
model_end_of_simulation(model);
model = model->next;
}
}
... ...