1 /*
2  * Copyright (C) 2002 - David W. Durham
3  *
4  * This file is part of ReZound, an audio editing application, but
5  * could be used for other applications which could use the PoolFile
6  * class's functionality.
7  *
8  * PoolFile is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published
10  * by the Free Software Foundation; either version 2 of the License,
11  * or (at your option) any later version.
12  *
13  * PoolFile is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
21  */
22 
23 #ifndef __TPoolAccesser_H__
24 #define __TPoolAccesser_H__
25 
26 #include "../../config/common.h"
27 
28 #include "TStaticPoolAccesser.h"
29 
30 template <class pool_element_t,class pool_file_t> class TPoolAccesser : public TStaticPoolAccesser<pool_element_t,pool_file_t>
31 {
32 public:
33 	// ??? I REALLY don't think that I should have to re-typedef these from the base class... but it suppresses the warnings I get with gcc3.1.1
34 	typedef typename TStaticPoolAccesser<pool_element_t,pool_file_t>::l_addr_t l_addr_t;
35 	typedef typename TStaticPoolAccesser<pool_element_t,pool_file_t>::p_addr_t p_addr_t;
36 	typedef typename TStaticPoolAccesser<pool_element_t,pool_file_t>::poolId_t poolId_t;
37 
38 	TPoolAccesser(const TStaticPoolAccesser<pool_element_t,pool_file_t> &src);
39 
40 	// space modifier methods
41 	void insert(const l_addr_t where,const l_addr_t count);
42 	void append(const l_addr_t count);
43 	void prepend(const l_addr_t count);
44 
45 	void remove(const l_addr_t where,const l_addr_t count);
46 	void clear();
47 
48 
49 	// bulk transfer methods
50 	void copyData(const l_addr_t destWhere,const TStaticPoolAccesser<pool_element_t,pool_file_t> &src,const l_addr_t srcWhere,const l_addr_t length,const bool appendIfShort=false);
51 	void moveData(const l_addr_t destWhere,TPoolAccesser<pool_element_t,pool_file_t> &srcPool,const l_addr_t srcWhere,const l_addr_t count);
52 
53 
54 	// stream-like access methods
55 	void write(const pool_element_t buffer[],const l_addr_t count,const bool append=true);
56 
57 
58 	// invalid operations
59 	TPoolAccesser<pool_element_t,pool_file_t> &operator=(const TPoolAccesser<pool_element_t,pool_file_t> &rhs);
60 
61 };
62 
63 #include "TPoolAccesser.cpp"
64 
65 #endif
66