Пример #1
0
int main (int argc, char **argv)
{
  poti_init ();
  poti_header ();
  poti_DefineContainerType ("PROCESS", "0", "PROCESS");
  poti_DefineEventType ("EV", "PROCESS", "EV");

  poti_CreateContainer (0, "p1", "PROCESS", "0", "p1");

  poti_NewEvent(2.43, "p1", "EV", "PrimeiroEvento");
  poti_NewEvent(2.87, "p1", "EV", "SegundoEvento");

  //change the timestamp of destroy to be larger than that of latest NewEvent
  poti_DestroyContainer (1.34, "PROCESS", "p1");

  poti_close();
  return 0;
}
Пример #2
0
void create_poti_event (paje_line line)
{
  int identifier = atoi(line.word[0]); 
  PajeEventId eventId = getPajeEventId (identifier);
  switch (eventId) {
  case PajeDefineContainerTypeEventId:
    poti_DefineContainerType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			     line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineEventTypeEventId:
    poti_DefineEventType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineStateTypeEventId:
    poti_DefineStateType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineVariableTypeEventId:
    poti_DefineVariableType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			    line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			    line.word[getPajeFieldPosition(identifier,PAJE_Name)],
			    line.word[getPajeFieldPosition(identifier,PAJE_Color)]);
    break;
  case PajeDefineLinkTypeEventId:
    poti_DefineLinkType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			line.word[getPajeFieldPosition(identifier,PAJE_StartContainerType)],
			line.word[getPajeFieldPosition(identifier,PAJE_EndContainerType)],
			line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineEntityValueEventId:
    poti_DefineEntityValue(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			   line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			   line.word[getPajeFieldPosition(identifier,PAJE_Name)],
			   line.word[getPajeFieldPosition(identifier,PAJE_Color)]);
    break;
  case PajeCreateContainerEventId:
    poti_CreateContainer(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
			 line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Container)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDestroyContainerEventId:
    poti_DestroyContainer(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
			  line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			  line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeNewEventEventId:
    poti_NewEvent(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		  line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Value)]);
    break;
  case PajeSetStateEventId:
    poti_SetState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		  line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Value)]);
    break;
  case PajePushStateEventId:
    poti_PushState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		   line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Value)]);
    break;
  case PajePopStateEventId:
    poti_PopState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		  line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Type)]);
    break;
  case PajeResetStateEventId:
    poti_ResetState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		    line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		    line.word[getPajeFieldPosition(identifier,PAJE_Type)]);
    break;
  case PajeSetVariableEventId:
    poti_SetVariable(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		     line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		     strtod(line.word[getPajeFieldPosition(identifier,PAJE_Value)],NULL));
    break;
  case PajeAddVariableEventId:
    poti_AddVariable(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		     line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		     strtod(line.word[getPajeFieldPosition(identifier,PAJE_Value)],NULL));
    break;
  case PajeSubVariableEventId:
    poti_SubVariable(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		     line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		     strtod(line.word[getPajeFieldPosition(identifier,PAJE_Value)],NULL));
    break;
  case PajeStartLinkEventId:
    poti_StartLink(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		   line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		   line.word[getPajeFieldPosition(identifier,PAJE_StartContainer)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Value)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Key)]);
    break;
  case PajeEndLinkEventId:
    poti_EndLink(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		 line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		 line.word[getPajeFieldPosition(identifier,PAJE_EndContainer)],
		 line.word[getPajeFieldPosition(identifier,PAJE_Value)],
		 line.word[getPajeFieldPosition(identifier,PAJE_Key)]);
    break;
  default:
    break;
  }
}