00001 #ifndef _BAC_DEVIO_MEM_H_ 00002 #define _BAC_DEVIO_MEM_H_ 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) European Southern Observatory, 2003 00006 * 00007 *This library is free software; you can redistribute it and/or 00008 *modify it under the terms of the GNU Lesser General Public 00009 *License as published by the Free Software Foundation; either 00010 *version 2.1 of the License, or (at your option) any later version. 00011 * 00012 *This library is distributed in the hope that it will be useful, 00013 *but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 *Lesser General Public License for more details. 00016 * 00017 *You should have received a copy of the GNU Lesser General Public 00018 *License along with this library; if not, write to the Free Software 00019 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * "@(#) $Id: baciDevIOMem.h,v 1.101 2008/10/09 06:18:16 cparedes Exp $" 00022 * 00023 * who when what 00024 * -------- -------- ---------------------------------------------- 00025 * bjeram 2003-06-02 renamed to DevIOMem 00026 * bjeram 2003-05-30 replaced void* value_m with T& 00027 * bjeram 25/02/02 created 00028 */ 00029 00030 /************************************************************************ 00031 * 00032 *---------------------------------------------------------------------- 00033 */ 00034 00040 #ifndef __cplusplus 00041 #error This is a C++ include file and cannot be used from plain C 00042 #endif 00043 00044 #include <baciDevIO.h> 00045 00046 template <class T> class DevIOMem : public DevIO<T> 00047 { 00048 public: 00049 00054 DevIOMem(T &value) : value_m(value) {}; 00055 00056 virtual ~DevIOMem() {}; 00057 00058 virtual bool initializeValue(){ return true; } 00059 00063 virtual T read(ACS::Time& timestamp) 00064 { 00065 timestamp = getTimeStamp(); 00066 return value_m; 00067 } 00068 00072 virtual void write(const T& value, ACS::Time& timestamp) 00073 { 00074 timestamp = getTimeStamp(); 00075 value_m = value; 00076 } 00077 00078 private: 00079 T &value_m; 00080 }; 00081 00082 #endif 00083 00084