pelib  2.0.0
include/pelib/Task.hpp
Go to the documentation of this file.
00001 /*
00002  Copyright 2015 Nicolas Melot
00003 
00004  This file is part of Pelib.
00005 
00006  Pelib is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  Pelib is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with Pelib. If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 
00021 #include <string>
00022 #include <set>
00023 
00024 #ifndef PELIB_TASK
00025 #define PELIB_TASK
00026 
00027 namespace pelib
00028 {
00029         // Forward declaration
00031         class Link;
00032 
00034         class Task
00035         {
00036                 public:
00040                         Task(const std::string &id, bool is_streaming = true);
00042                         Task(const Task&);
00043 
00045                         virtual ~Task();
00046                         
00048                         virtual double
00049                         getFrequency() const;
00050 
00052                         virtual void
00053                         setFrequency(double frequency);
00054 
00056                         virtual double
00057                         getWidth() const;
00058 
00060                         virtual void
00061                         setWidth(double width);
00062 
00064                         virtual std::string
00065                         getModule() const;
00066 
00068                         virtual void
00069                         setModule(const std::string &name);
00070 
00072                         virtual std::string
00073                         getName() const;
00074 
00076                         virtual std::string
00077                         getEfficiencyString() const;
00078 
00080                         virtual void
00081                         setEfficiencyString(const std::string &efficiencyString);
00082 
00087                         virtual double
00088                         getEfficiency(int p, double def = very_small) const;
00089                         
00091                         virtual double
00092                         getWorkload() const;
00093 
00095                         virtual void
00096                         setWorkload(double workload);
00097                         
00099                         virtual double
00100                         getMaxWidth() const;
00101 
00103                         virtual void
00104                         setMaxWidth(double maxWidth);
00105 
00107                         virtual double
00108                         getStartTime() const;
00109 
00111                         virtual void
00112                         setStartTime(double startTime);
00113 
00118                         virtual double
00119                         runtime(double width = 1, double frequency = 1) const;
00120 
00122                         virtual bool
00123                         operator<(const Task &other) const;
00124 
00126                         virtual const std::set<const Link*>&
00127                         getProducers() const;
00128 
00130                         virtual const std::set<const Link*>&
00131                         getConsumers() const;
00132 
00134                         virtual std::set<const Link*>&
00135                         getProducers();
00136 
00138                         virtual std::set<const Link*>&
00139                         getConsumers();
00140 
00142                         virtual bool
00143                         operator==(const Task &other) const;
00144 
00145                         bool
00146                         isStreaming() const;
00147                         
00148                 protected:
00150                         double frequency, width;
00152                         double workload, maxWidth;
00154                         float start_time;
00155                         bool streaming;
00157                         std::string name, module, efficiencyString;
00159                         std::set<const Link*> consumers, producers;
00160 
00162                         static const float very_small;
00163                         
00164                 private:
00165         };
00166 }
00167 
00168 #endif