00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00027 #ifndef AIMC_SUPPORT_STROBELIST_H_
00028 #define AIMC_SUPPORT_STROBELIST_H_
00029
00030 #include <iostream>
00031
00032
00033 #include <cmath>
00034 #include <deque>
00035
00036 namespace Marsyas {
00037 using std::deque;
00038 struct StrobePoint {
00039 int time;
00040 double weight;
00041 double working_weight;
00042 StrobePoint() {
00043 time = 0;
00044 weight = 0.0;
00045 working_weight = 0.0;
00046 }
00047 };
00048
00049 class StrobeList {
00050 public:
00053 inline StrobeList() {
00054 strobes_.resize(0);
00055 };
00056
00057 inline ~StrobeList() {
00058 };
00059
00062 inline StrobePoint Strobe(int strobe_number) {
00063 return strobes_.at(strobe_number);
00064 };
00065
00068 inline void SetWeight(int strobe_number, double weight) {
00069 strobes_.at(strobe_number).weight = weight;
00070 };
00071
00074 inline void SetWorkingWeight(int strobe_number, double working_weight) {
00075 strobes_.at(strobe_number).working_weight = working_weight;
00076 };
00077
00080 inline void AddStrobe(int time, double weight) {
00081 StrobePoint s;
00082 s.time = time;
00083 s.weight = weight;
00084 strobes_.push_back(s);
00085 };
00086
00089 inline void DeleteFirstStrobe() {
00090 strobes_.pop_front();
00091 };
00092
00095 inline int strobe_count() const {
00096 return strobes_.size();
00097 };
00098
00102 inline void ShiftStrobes(int offset) {
00103 for (unsigned int i = 0; i < strobes_.size(); ++i)
00104 strobes_[i].time -= offset;
00105 };
00106
00107 void printStrobes() {
00108 for (unsigned int i = 0; i < strobes_.size(); ++i) {
00109 std::cout << strobes_[i].time << " " << strobes_[i].weight << strobes_[i].working_weight << std::endl;
00110 }
00111
00112 }
00113
00114 private:
00115 deque<StrobePoint> strobes_;
00116 };
00117 }
00118
00119 #endif