monitoring.h
Go to the documentation of this file.
00001 #ifndef MONITORING_H
00002 #define MONITORING_H
00003 
00004 #include <deque>
00005 #include <vector>
00006 #include <string>
00007 #include <iostream>
00008 
00009 #include "search_engine.h"
00010 #include "globals.h"
00011 #include "state.h"
00012 #include "operator.h"
00013 
00015 class FullPlanTrace
00016 {
00017    public:
00019       explicit FullPlanTrace(const TimeStampedState & s);
00020 
00022       class FullPlanStep
00023       {
00024          public:
00025             FullPlanStep(const TimeStampedState & p, const Operator* o, const TimeStampedState & s)
00026                : predecessor(p), op(o), state(s) {}
00027 
00028             TimeStampedState predecessor;
00029             const Operator* op;
00030             TimeStampedState state;
00031       };
00032 
00034       bool isApplicable(const Operator* op) const;
00035 
00037 
00040       FullPlanTrace applyOperator(const Operator* op) const;
00041 
00043       bool canLetTimePass() const;
00044 
00046 
00049       FullPlanTrace letTimePass() const;
00050 
00052       bool satisfiesGoal() const;
00053 
00055       double lastTimestamp() const;
00056 
00058       void outputPlan(ostream & os) const;
00059 
00060       void dumpLastState() const;
00061 
00063       double getLastTimestamp() const;
00064 
00065    protected:
00067       std::deque<FullPlanStep> plan;
00068 
00069 };
00070 
00071 class MonitorEngine
00072 {
00073     protected:
00074         MonitorEngine();
00075         static MonitorEngine* instance;
00076 
00077         static void readPlanFromFile(const string & filename, vector<string> & plan);
00078 
00079     public:
00080         ~MonitorEngine();
00081 
00082         static MonitorEngine* getInstance();
00083 
00085         static bool validatePlan(const string & filename);
00086 
00087         bool validatePlan(std::vector<std::string> & plan);
00088 
00090         bool validatePlan(const std::vector< std::vector<PlanStep> > & plan);
00092         bool validatePlanOld(const std::vector< std::vector<PlanStep> > & plan) __attribute__((deprecated));
00093 };
00094 
00095 class PlanStepCompareStartTime
00096 {
00097    public:
00098       bool operator()(const std::vector<PlanStep> & s1, const std::vector<PlanStep> & s2) const {
00099           if(s1.empty())
00100               return false;
00101           if(s2.empty())
00102               return true;
00103          return s1.front().start_time < s2.front().start_time;
00104       }
00105 };
00106 
00107 #endif
00108 


tfd_modules
Author(s): Maintained by Christian Dornhege (see AUTHORS file).
autogenerated on Mon Oct 6 2014 07:52:06