00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MARSYAS_TM_TIMER_H
00020 #define MARSYAS_TM_TIMER_H
00021
00022 #include "common_header.h"
00023 #include "TmParam.h"
00024 #include "TmControlValue.h"
00025 #include "EvEvent.h"
00026 #include "Heap.h"
00027
00028 #include <map>
00029 #include <iostream>
00030 #include <string>
00031 #include <vector>
00032
00033 namespace Marsyas
00034 {
00042 class marsyas_EXPORT TmTimer
00043 {
00044 private:
00046 Heap<EvEvent, EvEventDispatchComparator> pq_;
00048 std::map<std::string, EvEvent*> events_;
00049 std::map<std::string, EvEvent*>::iterator events_iter_;
00050
00051 protected:
00053 std::string type_;
00054
00056 std::string name_;
00057
00059 unsigned long cur_time_;
00060
00061
00062
00063
00064 protected:
00070 void init();
00071
00072 public:
00073
00076 TmTimer(std::string type, std::string name);
00080 TmTimer(const TmTimer& t);
00081 virtual ~TmTimer();
00082
00086 std::string getType();
00090 std::string getName();
00094 std::string getPrefix();
00095
00096
00097
00101 mrs_natural getTime();
00102
00108 void tick();
00112 virtual void updtime();
00113
00114
00122 virtual mrs_natural readTimeSrc()=0;
00123
00131 virtual void trigger();
00141 virtual mrs_natural intervalsize(std::string interval)=0;
00142
00147 virtual void updtimer(std::string cname, TmControlValue value);
00148
00152 void updtimer(TmParam& param);
00153
00157 void updtimer(std::vector<TmParam> params);
00158
00164 void post(std::string event_time, Repeat rep, EvEvent* me);
00169 void post(std::string event_time, EvEvent* me);
00175 void post(EvEvent* e);
00176
00180 bool eventPending();
00181
00190 void dispatch();
00191
00192
00193
00194
00195 };
00196
00197 }
00198
00199 #endif