Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/sched/Repeat.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2005 George Tzanetakis <gtzan@cs.uvic.ca>
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #ifndef MARSYAS_REPEAT_H
00020 #define MARSYAS_REPEAT_H
00021 
00022 #include <marsyas/common_header.h>
00023 #include <marsyas/Conversions.h>
00024 
00025 #include <string>
00026 
00027 namespace Marsyas
00028 {
00036 class marsyas_EXPORT Repeat {
00037 private:
00038   bool infinite_;
00039   std::string interval_;
00040   mrs_natural count_;
00041 
00042 public:
00044   Repeat();
00048   Repeat(std::string time_interval);
00053   Repeat(std::string time_interval, mrs_natural rep_count);
00054 
00055   virtual ~Repeat();
00056 
00062   void set(bool inf, std::string time_interval, mrs_natural rep_count);
00063 
00069   mrs_natural interval2samples(mrs_real srate);
00070 
00074   virtual bool repeat();
00075 
00076   bool isInfinite() {return infinite_;}
00077   mrs_natural getCount() {return count_;}
00078   std::string getInterval() {return interval_;}
00079 
00080   void setInfinite(bool inf) {infinite_=inf;}
00081   void setCount(mrs_natural count) {count_=count;}
00082   void setInterval(std::string interval) {interval_=interval;}
00083 
00084   void operator++() {++count_;}
00085   void operator++(int) {count_++;};
00086   void operator--() {if(count_>0) {--count_;}}
00087   void operator--(int) {if(count_>0) {count_--;}};
00088   // the usual stream IO
00089 //    friend ostream& operator<<(ostream&, Scheduler&);
00090 //    friend istream& operator>>(istream&, Scheduler&);
00091 };
00092 
00093 }//namespace Marsyas
00094 
00095 #endif