Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibMemCache.h

Go to the documentation of this file.
00001 /*
00002  * Copyright: (C) 2000 Bruce W. Forsberg
00003  *
00004  *   This library is free software; you can redistribute it and/or
00005  *   modify it under the terms of the GNU Lesser General Public
00006  *   License as published by the Free Software Foundation; either
00007  *   version 2.1 of the License, or any later version.
00008  *
00009  *   This library is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *   Lesser General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU Lesser General Public
00015  *   License along with this library; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00017  *
00018  *   Bruce Forsberg  forsberg@adnc.com
00019  *
00020  */
00021 
00022 
00023 #ifndef _AFLIBMEMCACHE_H
00024 #define _AFLIBMEMCACHE_H
00025 
00050 class aflibData;
00051 class aflibMemNode;
00052 
00053 #include <map>
00054 
00055 
00056 class aflibMemCache {
00057 
00058 public:
00059 
00060    aflibMemCache();
00061 
00062    virtual
00063    ~aflibMemCache();
00064 
00065    bool
00066    getCacheEnable();
00067 
00068    void
00069    setCacheEnable(bool enable);
00070 
00071    long long
00072    getCacheMax() const;
00073 
00074    long long
00075    getCacheTotal() const;
00076 
00077    long long
00078    getCacheLocal() const;
00079 
00080    void
00081    clearCache();
00082 
00083 protected:
00084 
00085    void
00086    lookupData(
00087       long long& position,
00088       int& num_samples);
00089 
00090    void
00091    fillDataFromCache(
00092       aflibData& data,
00093       long long& position,
00094       int& num_samples,
00095       long long orig_position,
00096       int orig_num_samples);
00097 
00098 private:
00099 
00100    aflibMemCache(aflibMemCache& op);
00101 
00102    const aflibMemCache&
00103    operator=(const aflibMemCache& op);
00104 
00105    void
00106    calcPosition(
00107       long long& position,
00108       int&       num_samples,
00109       map< long long, aflibMemNode* >::iterator it);
00110 
00111    void
00112    reduceCache();
00113 
00114    bool
00115    checkExistingNode(
00116       long long position,
00117       aflibData& data);
00118 
00119    void
00120    createNewNode(
00121       int start_element,
00122       int stop_element,
00123       long long position,
00124       aflibData& data); 
00125 
00126    void
00127    cacheData(
00128       long long position,
00129       aflibData& data);
00130 
00131 long long _cache_counter;
00132 long long _cache_size_max;
00133 static long long _cache_size_total;
00134 long long _cache_size_local;
00135 bool      _enable;
00136 map< long long, aflibMemNode* >  _node_array;
00137 
00138 
00139 };
00140 
00141 #endif
00142 
00143 

Generated at Sun May 13 16:18:53 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001