SimpleTimeConstMapping.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        SimpleTimeConstMapping.h
00003  *
00004  * author:      Jerome Rousselot <jerome.rousselot@csem.ch>
00005  *
00006  * copyright:   (C) 2008 Centre Suisse d'Electronique et Microtechnique (CSEM) SA
00007  *        Systems Engineering
00008  *              Real-Time Software and Networking
00009  *              Jaquet-Droz 1, CH-2002 Neuchatel, Switzerland.
00010  *
00011  *              This program is free software; you can redistribute it
00012  *              and/or modify it under the terms of the GNU General Public
00013  *              License as published by the Free Software Foundation; either
00014  *              version 2 of the License, or (at your option) any later
00015  *              version.
00016  *              For further information see file COPYING
00017  *              in the top level directory
00018  * description: This class implements a simple time-based constant mapping
00019  ***************************************************************************/
00020 
00021 #ifndef _SIMPLETIMECONSTMAPPING_H
00022 #define _SIMPLETIMECONSTMAPPING_H
00023 
00029 class SimpleTimeConstMapping: public SimpleConstMapping {
00030 
00031 protected:
00032   double myValue;
00033   simtime_t start, stop;
00034 public:
00038   SimpleTimeConstMapping(double _myValue, simtime_t _start, simtime_t _stop):
00039     SimpleConstMapping(DimensionSet(Dimension::time)), myValue(_myValue), start(_start), stop(_stop) {
00040     initializeArguments(Argument(_start), Argument(_stop), Argument(1));
00041   }
00042 
00046   double getValue(const Argument& pos) const { return myValue; }
00047 
00051   ConstMapping* constClone() const {
00052     return new SimpleTimeConstMapping(myValue, start, stop); }
00053 };
00054 
00055 #endif