Example #1
0
File: test.C Project: xyuan/IMPACT
int main()
{
  Scheduler * sched = new Scheduler;
 
  // root action
  ActionA *a = new ActionA(0, NULL, NULL, NULL, "A");
  sched->add_action(*a);
  a->declare(*sched);

  char *attr_c[] = { "c" };
  int idx_c[] = { 1 };
  ActionC *c = new ActionC(1, attr_c, idx_c, NULL, "C");
  sched->add_action(*c);
  c->declare(*sched);

  char *attr_d[] = { "d", "c" };
  int idx_d[] = { 1, 1 };
  ActionD *d = new ActionD(2, attr_d, idx_d, NULL, "D");
  sched->add_action(*d);
  d->declare(*sched);

  char *attr_b[] = { "b" };
  int idx_b[] = { 1 };
  ActionB *b = new ActionB(1, attr_b, idx_b, NULL, "B");
  sched->add_action(*b);
  b->declare(*sched);

  // action E is a container action that has its own sub-schduler
  // the sub scheduler contains action F and G
  Scheduler * subsched = new Scheduler;

  ActionF *f = new ActionF(0, NULL, NULL, NULL, "F");
  subsched->add_action(*f);
  f->declare(*subsched);

  char *attr_g[] = { "f" };
  int idx_g[] = { 1 };
  ActionG *g = new ActionG(1, attr_g, idx_g, NULL, "G");
  subsched->add_action(*g);
  g->declare(*subsched);

  char *attr_e[] = { "f" };
  int idx_e[] = { 1 };
  ActionE *e = new ActionE(subsched, 1, attr_e, idx_e, NULL, "E");
  sched->add_action(*e);
  e->declare(*sched);

  // all creation done now
  sched->schedule();

  // generate GDL file for visualization with iaSee tool
  sched->print("out.gdl");

  sched->init_actions(1);

  sched->run_actions(1, 0.1);

  sched->finalize_actions();
}