refactor JobTicket to remove the double layering
basically we had two lines of doubly nested capsules, due to using the IterAdaptor template. Actually, the evaluation stack within JobTicket can be considered an implementation detail and thus doesn't require an iterator interface; the intention is to use this through JobPlanning solely. Thus this reworking removes the special iterator within JobTicket, but retains the idea of exposing the "current" JobTicket through a smart pointer or operator->() work done during the FrOSCon travel
This commit is contained in:
parent
66defdc0cb
commit
b52a1a8366
2 changed files with 35 additions and 43 deletions
|
|
@ -60,8 +60,8 @@ namespace engine {
|
|||
*/
|
||||
class JobPlanning
|
||||
{
|
||||
JobTicket::iterator plannedOperations_;
|
||||
FrameCoord point_to_calculate_;
|
||||
JobTicket::ExplorationState plannedOperations_;
|
||||
FrameCoord point_to_calculate_;
|
||||
|
||||
public:
|
||||
/** by default create the bottom element of job planning,
|
||||
|
|
@ -71,12 +71,11 @@ namespace engine {
|
|||
JobPlanning()
|
||||
{ }
|
||||
|
||||
/** further job planning can be initiated by continuing
|
||||
* off a given previous planning state. This is how
|
||||
* the forks are created, expanding into a multitude
|
||||
* of prerequisites of a given job
|
||||
/** further job planning can be initiated by continuing off a given previous planning state.
|
||||
* This is how the forks are created, expanding into a multitude of prerequisites for
|
||||
* the job in question.
|
||||
*/
|
||||
JobPlanning (JobTicket::iterator const& startingPoint, FrameCoord requestedFrame)
|
||||
JobPlanning (JobTicket::ExplorationState const& startingPoint, FrameCoord requestedFrame)
|
||||
: plannedOperations_(startingPoint)
|
||||
, point_to_calculate_(requestedFrame)
|
||||
{ }
|
||||
|
|
@ -112,6 +111,9 @@ namespace engine {
|
|||
,this->point_to_calculate_);
|
||||
}
|
||||
|
||||
/** integrate another chain of prerequisites into the current evaluation line.
|
||||
* Further evaluation will start to visit prerequisites from the new starting point,
|
||||
* and return to the current evaluation chain later on exhaustion of the side chain. */
|
||||
friend void
|
||||
integrate (JobPlanning const& newStartingPoint, JobPlanning existingPlan)
|
||||
{
|
||||
|
|
@ -137,7 +139,7 @@ namespace engine {
|
|||
friend void
|
||||
iterNext (JobPlanning & plan)
|
||||
{
|
||||
++(plan.plannedOperations_);
|
||||
plan.plannedOperations_.pullNext();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -192,8 +194,6 @@ namespace engine {
|
|||
// (which is a JobPlanning) can stand-in for the sequence of prerequisites
|
||||
}
|
||||
|
||||
///TODO what elements are accepted by the explorationStack? provide conversion operator to extract those from stateCore()
|
||||
|
||||
|
||||
|
||||
/** Extension point to be picked up by ADL.
|
||||
|
|
|
|||
|
|
@ -117,15 +117,10 @@ using lib::LinkedElements;
|
|||
LinkedElements<Prerequisites> requirement_;
|
||||
|
||||
|
||||
public:
|
||||
class ExplorationState;
|
||||
friend class ExplorationState;
|
||||
|
||||
struct TraversalOfPrerequisites;
|
||||
|
||||
public:
|
||||
|
||||
typedef TraversalOfPrerequisites iterator;
|
||||
|
||||
|
||||
JobTicket()
|
||||
{
|
||||
|
|
@ -133,7 +128,7 @@ using lib::LinkedElements;
|
|||
}
|
||||
|
||||
|
||||
iterator discoverPrerequisites() const;
|
||||
ExplorationState discoverPrerequisites() const;
|
||||
|
||||
Job createJobFor (FrameCoord coordinates);
|
||||
|
||||
|
|
@ -157,42 +152,39 @@ using lib::LinkedElements;
|
|||
// using default ctor and copy operations
|
||||
|
||||
|
||||
bool
|
||||
empty() const
|
||||
{
|
||||
UNIMPLEMENTED ("detect empty/no prerequisites");
|
||||
}
|
||||
|
||||
/* === Iteration control API for IterStateWrapper== */
|
||||
|
||||
friend bool
|
||||
checkPoint (ExplorationState const& plan)
|
||||
{
|
||||
UNIMPLEMENTED ("detect end of prerequisites");
|
||||
}
|
||||
|
||||
friend JobTicket&
|
||||
yield (ExplorationState const& plan)
|
||||
{
|
||||
UNIMPLEMENTED ("access prerequisite and follow up to prerequisite JobTicket");
|
||||
}
|
||||
|
||||
friend void
|
||||
iterNext (ExplorationState & plan)
|
||||
{
|
||||
UNIMPLEMENTED ("step ahead to next prerequisite");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct JobTicket::TraversalOfPrerequisites
|
||||
: lib::IterStateWrapper<JobTicket, JobTicket::ExplorationState>
|
||||
{
|
||||
void
|
||||
push (TraversalOfPrerequisites subExploration)
|
||||
pullNext()
|
||||
{
|
||||
UNIMPLEMENTED ("step ahead to next prerequisite, maybe pop");
|
||||
}
|
||||
|
||||
void
|
||||
push (ExplorationState subExploration)
|
||||
{
|
||||
UNIMPLEMENTED ("integrate a branch of prerequisites");
|
||||
}
|
||||
|
||||
|
||||
JobTicket*
|
||||
operator->() const
|
||||
{
|
||||
UNIMPLEMENTED ("yield the current job ticket");
|
||||
// access prerequisite and follow up to prerequisite JobTicket
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline JobTicket::iterator
|
||||
|
||||
inline JobTicket::ExplorationState
|
||||
JobTicket::discoverPrerequisites() const
|
||||
{
|
||||
UNIMPLEMENTED("delve into the requirement_ datastructure");
|
||||
|
|
|
|||
Loading…
Reference in a new issue