TarzaNN
TarzaNN neural network simulator
|
00001 /* 00002 * HistoryList.h 00003 * NNLearn 00004 * 00005 * Created by Albert Rothenstein on 11-03-10. 00006 * Copyright 2011 __MyCompanyName__. All rights reserved. 00007 * 00008 */ 00009 00010 00011 #ifndef HISTORYLIST_H_INCLUDED 00012 #define HISTORYLIST_H_INCLUDED 00013 #include <QList> 00014 00015 template <typename T> 00016 class HistoryList: QList<T> { 00017 public: 00018 HistoryList (int max): QList<T>(){ 00019 maxSize=max; 00020 } 00021 void push_back ( const T & value ){ 00022 if(maxSize>0 && QList<T>::size()>=maxSize) 00023 QList<T>::removeFirst(); 00024 QList<T>::push_back(value); 00025 } 00026 int size(){ 00027 int a= QList<T>::size(); 00028 return a; 00029 } 00030 private: 00031 int maxSize; 00032 }; 00033 #endif //HISTORYLIST_H_INCLUDED 00034 00035 00036 00037 00038 00039