Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Attempt to correct error tests
[simgrid.git] / src / instr / instr_private.h
index b6c49e6..9220a77 100644 (file)
@@ -55,25 +55,36 @@ typedef enum {
   TYPE_EVENT
 } e_entity_types;
 
-typedef struct s_type *type_t;
-typedef struct s_type {
+//--------------------------------------------------
+class s_type;
+typedef s_type *type_t;
+class s_type {
+  public:
   char *id;
   char *name;
   char *color;
   e_entity_types kind;
-  struct s_type *father;
+  s_type *father;
   xbt_dict_t children;
   xbt_dict_t values; //valid for all types except variable and container
-}s_type_t;
+};
 
-typedef struct s_val *val_t;
-typedef struct s_val {
+typedef s_type s_type_t;
+
+//--------------------------------------------------
+class s_val;
+typedef s_val *val_t;
+
+class s_val {
+  public:
   char *id;
   char *name;
   char *color;
   type_t father;
-}s_val_t;
+};
+typedef s_val s_val_t;
 
+//--------------------------------------------------
 typedef enum {
   INSTR_HOST,
   INSTR_LINK,
@@ -85,101 +96,152 @@ typedef enum {
   INSTR_MSG_TASK
 } e_container_types;
 
-typedef struct s_container *container_t;
-typedef struct s_container {
+//--------------------------------------------------
+class s_container;
+typedef s_container *container_t;
+
+class s_container {
+  public: 
   sg_netpoint_t netpoint;
   char *name;     /* Unique name of this container */
   char *id;       /* Unique id of this container */
   type_t type;    /* Type of this container */
   int level;      /* Level in the hierarchy, root level is 0 */
   e_container_types kind; /* This container is of what kind */
-  struct s_container *father;
+  s_container *father;
   xbt_dict_t children;
-}s_container_t;
+};
+typedef s_container s_container_t;
+
+//--------------------------------------------------
+class paje_event;
+typedef paje_event *paje_event_t;
 
-typedef struct paje_event *paje_event_t;
-typedef struct paje_event {
+class paje_event {
+  public:
   double timestamp;
   e_event_type event_type;
-  void (*print) (paje_event_t event);
-  void (*free) (paje_event_t event);
+  virtual void print(){};
   void *data;
-} s_paje_event_t;
+  virtual ~paje_event();
+};
+typedef paje_event s_paje_event_t;
 
-typedef struct s_defineContainerType *defineContainerType_t;
-typedef struct s_defineContainerType {
+class DefineContainerEvent : public paje_event
+{
+  public:
   type_t type;
-}s_defineContainerType_t;
+  void print() override;
+  DefineContainerEvent(type_t);
+};
+
+//--------------------------------------------------
+
+
+//--------------------------------------------------
 
-typedef struct s_defineVariableType *defineVariableType_t;
-typedef struct s_defineVariableType {
+class DefineVariableTypeEvent : public paje_event 
+{
+  public:
   type_t type;
-}s_defineVariableType_t;
+   DefineVariableTypeEvent(type_t type);
+   void print() override;
+};
+//--------------------------------------------------
 
-typedef struct s_defineStateType *defineStateType_t;
-typedef struct s_defineStateType {
+class DefineStateTypeEvent : public paje_event  {
   type_t type;
-}s_defineStateType_t;
+  public:
+  DefineStateTypeEvent(type_t type);
+  void print();// override;
+};
 
-typedef struct s_defineEventType *defineEventType_t;
-typedef struct s_defineEventType {
+class DefineEventTypeEvent : public paje_event  {
   type_t type;
-}s_defineEventType_t;
+  public: 
+  DefineEventTypeEvent(type_t type);
+  void print() override;
+};
 
-typedef struct s_defineLinkType *defineLinkType_t;
-typedef struct s_defineLinkType {
+class DefineLinkTypeEvent : public paje_event  {
   type_t type;
   type_t source;
   type_t dest;
-}s_defineLinkType_t;
+  public:
+  DefineLinkTypeEvent(type_t type, type_t source, type_t dest);
+  void print() override;
+};
 
-typedef struct s_defineEntityValue *defineEntityValue_t;
-typedef struct s_defineEntityValue {
+class DefineEntityValueEvent : public paje_event  {
   val_t value;
-}s_defineEntityValue_t;
+  public:
+  DefineEntityValueEvent (val_t type);
+  void print() override;
+};
 
-typedef struct s_createContainer *createContainer_t;
-typedef struct s_createContainer {
+class CreateContainerEvent : public paje_event  {
+  public:
   container_t container;
-}s_createContainer_t;
+  explicit CreateContainerEvent (container_t container);
+  void print() override;
+};
 
-typedef struct s_destroyContainer *destroyContainer_t;
-typedef struct s_destroyContainer {
+class DestroyContainerEvent : public paje_event  {
+  public:
   container_t container;
-}s_destroyContainer_t;
+  DestroyContainerEvent (container_t container);
+  void print() override;
+};
 
-typedef struct s_setVariable *setVariable_t;
-typedef struct s_setVariable {
+
+class SetVariableEvent : public paje_event  {
   container_t container;
   type_t type;
   double value;
-}s_setVariable_t;
+  public:
+  SetVariableEvent (double timestamp, container_t container, type_t type, double value);
+  void print() override;
+};
+
 
-typedef struct s_addVariable *addVariable_t;
-typedef struct s_addVariable {
+class AddVariableEvent:public paje_event {
   container_t container;
   type_t type;
   double value;
-}s_addVariable_t;
+  public:
+  AddVariableEvent (double timestamp, container_t container, type_t type, double value);
+  void print() override;
+};
+
+//--------------------------------------------------
 
-typedef struct s_subVariable *subVariable_t;
-typedef struct s_subVariable {
+
+class SubVariableEvent : public paje_event  {
+  public:
   container_t container;
   type_t type;
-  double value;
-}s_subVariable_t;
-
-typedef struct s_setState *setState_t;
-typedef struct s_setState {
+  double value; 
+  public:
+  SubVariableEvent(double timestamp, container_t container, type_t type, double value);
+  void print() override;
+};
+//--------------------------------------------------
+
+class SetStateEvent : public paje_event  {
+  public:
   container_t container;
   type_t type;
   val_t value;
   const char* filename;
   int linenumber;
-}s_setState_t;
+  public:
+  SetStateEvent (double timestamp, container_t container, type_t type, val_t value);
+  void print() override;
+};
 
-typedef struct s_pushState *pushState_t;
-typedef struct s_pushState {
+
+class PushStateEvent : public paje_event  {
+  public:
   container_t container;
   type_t type;
   val_t value;
@@ -187,46 +249,70 @@ typedef struct s_pushState {
   const char* filename;
   int linenumber;
   void* extra;
-}s_pushState_t;
+  public:
+  PushStateEvent (double timestamp, container_t container, type_t type, val_t value);
+  PushStateEvent (double timestamp, container_t container, type_t type, val_t value,
+                                             void* extra);
+  void print() override;
+};
 
-typedef struct s_popState *popState_t;
-typedef struct s_popState {
+class PopStateEvent : public paje_event  {
   container_t container;
   type_t type;
   xbt_dynar_t extra;
-}s_popState_t;
+  public:
+  PopStateEvent (double timestamp, container_t container, type_t type);
+  void print() override;
+};
 
-typedef struct s_resetState *resetState_t;
-typedef struct s_resetState {
+class ResetStateEvent : public paje_event  {
   container_t container;
   type_t type;
-}s_resetState_t;
+  public:
+  ResetStateEvent (double timestamp, container_t container, type_t type);
+  void print() override;
+};
 
-typedef struct s_startLink *startLink_t;
-typedef struct s_startLink {
+class StartLinkEvent : public paje_event  {
+  public:
   container_t container;
   type_t type;
   container_t sourceContainer;
   char *value;
   char *key;
   int size;
-}s_startLink_t;
+  public:
+  StartLinkEvent (double timestamp, container_t container, type_t type, container_t sourceContainer,
+                                    const char *value, const char *key);
+  StartLinkEvent (double timestamp, container_t container, type_t type,
+                                            container_t sourceContainer, const char *value, const char *key, int size);
+  void print() override;
+};
 
-typedef struct s_endLink *endLink_t;
-typedef struct s_endLink {
+class EndLinkEvent : public paje_event  {
   container_t container;
   type_t type;
   container_t destContainer;
   char *value;
   char *key;
-}s_endLink_t;
+  public:
+  EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
+                                  const char *value, const char *key);
+  void print() override;
+};
+
 
-typedef struct s_newEvent *newEvent_t;
-typedef struct s_newEvent {
+class NewEvent : public paje_event  {
+  public:
   container_t container;
   type_t type;
   val_t value;
-}s_newEvent_t;
+  public:
+  NewEvent (double timestamp, container_t container, type_t type, val_t value);
+  void print() override;
+
+};
+
 
 extern XBT_PRIVATE xbt_dict_t created_categories;
 extern XBT_PRIVATE xbt_dict_t declared_marks;
@@ -239,34 +325,10 @@ extern XBT_PRIVATE double TRACE_last_timestamp_to_dump;
 XBT_PRIVATE void TRACE_header(int basic, int size);
 
 /* from paje.c */
-XBT_PRIVATE void TRACE_paje_init();
 XBT_PRIVATE void TRACE_paje_start();
 XBT_PRIVATE void TRACE_paje_end();
 XBT_PRIVATE void TRACE_paje_dump_buffer (int force);
-XBT_PUBLIC(void) new_pajeDefineContainerType(type_t type);
-XBT_PUBLIC(void) new_pajeDefineVariableType(type_t type);
-XBT_PUBLIC(void) new_pajeDefineStateType(type_t type);
-XBT_PUBLIC(void) new_pajeDefineEventType(type_t type);
-XBT_PUBLIC(void) new_pajeDefineLinkType(type_t type, type_t source, type_t dest);
-XBT_PUBLIC(void) new_pajeDefineEntityValue (val_t type);
-XBT_PUBLIC(void) new_pajeCreateContainer (container_t container);
-XBT_PUBLIC(void) new_pajeDestroyContainer (container_t container);
-XBT_PUBLIC(void) new_pajeSetVariable (double timestamp, container_t container, type_t type, double value);
-XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, type_t type, double value);
-XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value);
-XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value);
-XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value);
-XBT_PUBLIC(void) new_pajePushStateWithExtra (double timestamp, container_t container, type_t type, val_t value,
-                                             void* extra);
-XBT_PUBLIC(void) new_pajePopState (double timestamp, container_t container, type_t type);
-XBT_PUBLIC(void) new_pajeResetState (double timestamp, container_t container, type_t type);
-XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer,
-                                    const char *value, const char *key);
-XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type,
-                                            container_t sourceContainer, const char *value, const char *key, int size);
-XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer,
-                                  const char *value, const char *key);
-XBT_PUBLIC(void) new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value);
+
 
 /* from instr_config.c */
 XBT_PRIVATE bool TRACE_needs_platform ();