00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MARSYAS_SCHEDULER_H
00020 #define MARSYAS_SCHEDULER_H
00021
00022 #include "TmTimer.h"
00023 #include "TmTime.h"
00024 #include "TmControlValue.h"
00025 #include "TmParam.h"
00026 #include <string>
00027 #include <vector>
00028
00029 namespace Marsyas
00030 {
00039 class Scheduler {
00040 protected:
00041
00042 TmTimer** timers_;
00043 int timers_count_;
00044
00045
00046 public:
00047
00048
00049
00050 Scheduler();
00051 virtual ~Scheduler();
00052
00053
00054 void setName(std::string name);
00055 std::string getType();
00056 std::string getName();
00057 std::string getPrefix();
00058
00059 void tick();
00060 bool eventPending();
00061
00062 void addTimer(TmTimer* t);
00063 void addTimer(std::string class_name, std::string identifier);
00064 void addTimer(std::string class_name, std::string identifier, std::vector<TmParam> params);
00065
00066 void updtimer(std::string tmr_id, TmControlValue value);
00067 void updtimer(std::string tmr_id, TmParam& param);
00068 void updtimer(std::string tmr_id, std::vector<TmParam> params);
00069
00070 static void split_cname(std::string cname, std::string* head, std::string* tail);
00071 bool removeTimer(std::string name);
00072 void removeAll();
00073 private:
00074 void appendTimer(TmTimer* s);
00075 TmTimer* findTimer(std::string name);
00076 public:
00077
00078 void post(std::string event_time, Repeat rep, EvEvent* me);
00079 void post(std::string event_time, EvEvent* me);
00080
00081
00082 void post(TmTime t, Repeat r, EvEvent* me);
00083 void post(std::string time, std::string timer_name, Repeat r, EvEvent* me);
00084
00085 mrs_natural getTime(std::string timer);
00086
00087
00088
00089
00090 };
00091
00092 }
00093
00094 #endif