S3FC project page | S3FC home page |
00001 /* 00002 * Stone Three Foundation Class (s3fc) provides a number of utility classes. 00003 * Copyright (C) 2001 by Stone Three Signal Processing (Pty) Ltd. 00004 * 00005 * Authored by Stone Three Signal Processing (Pty) Ltd. 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 * Please see the file 'COPYING' in the source root directory. 00022 */ 00023 00036 #ifndef S3_INPLACE_FIFO_BASE_H 00037 #define S3_INPLACE_FIFO_BASE_H 00038 00039 #include <s3fc/s3_fifo_base.h> 00040 00050 template<typename T> 00051 class s3_inplace_fifo_base : public s3_fifo_base<T> 00052 { 00053 public: 00060 void push(const T& t) 00061 { 00062 T* slotptr = open_input(); 00063 *slotptr = t; 00064 close_input(slotptr); 00065 } 00074 virtual T pop() 00075 { 00076 T t; 00077 T* slotptr = open_output(); 00078 t = *slotptr; 00079 close_output(slotptr); 00080 return t; 00081 } 00094 virtual T* open_input() = 0; 00105 virtual T* nbl_open_input() = 0; 00119 virtual void close_input(const T* t = 0) = 0; 00132 virtual T* open_output() = 0; 00143 virtual T* nbl_open_output() = 0; 00157 virtual void close_output(const T* t = 0) = 0; 00158 00159 }; 00160 00161 #endif
Send comments to: s3fc@stonethree.com |
|