libs/ck-libs/pose/strat.C

Go to the documentation of this file.
00001 
00002 #include "pose.h"
00003 
00005 strat::strat() 
00006 {
00007 #ifndef CMK_OPTIMIZE
00008   if(pose_config.stats)
00009     localStats = (localStat *)CkLocalBranch(theLocalStats);
00010 #endif
00011   eq = NULL;
00012   userObj = NULL;
00013   parent = NULL;
00014   currentEvent = targetEvent = NULL;
00015 #ifndef SEQUENTIAL_POSE
00016   localPVT = (PVT *)CkLocalBranch(ThePVT);
00017 #endif
00018   STRAT_T = INIT_T;
00019 }
00020 
00022 void strat::init(eventQueue *q, rep *obj, sim *p, int pIdx)
00023 {
00024   eq = q;  userObj = obj;  parent = p;  initSync();
00025 }
00026 
00028 void strat::Step()
00029 {
00030   Event *ev;
00031   parent->Deactivate(); // since this is executing, there is no longer a
00032   // queued Step message, so deactivate
00033   ev = eq->currentPtr; // get event to execute
00034   currentEvent = ev; // set currentEvent
00035   if (ev->timestamp >= 0) { // make sure it's not the back sentinel
00036     ev->done = 2; // mark it executing
00037     parent->ResolveFn(ev->fnIdx, ev->msg); // execute it
00038     ev->done = 1; // mark it done
00039     eq->ShiftEvent(); // shift to next event
00040     parent->Activate();
00041     POSE_Objects[parent->thisIndex].Step();
00042   }
00043 }

Generated on Sun Jun 29 13:29:25 2008 for Charm++ by  doxygen 1.5.1