rasdaman complete source
akgnet_commbuffer.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
34 #ifndef AKGNET_BUFFER_HH
35 #define AKGNET_BUFFER_HH
36 
37 #include "akgnet_fdescr.hh"
38 
39 namespace akg
40 {
41 
57 class CommBuffer
58 {
59 public:
61  CommBuffer() throw();
62 
66  CommBuffer(int size) throw();
67 
72  CommBuffer(void*,int totalSize,int dataSize=0) throw();
73 
75  ~CommBuffer() throw();
76 
80  bool allocate(int size) throw();
81 
83  void freeBuffer() throw();
84 
90  void takeOver(void *externalBuffer,int totalSize,int dataSize=0) throw();
91 
95  bool resize(int newSize) throw();
96 
98  void* getData() throw();
99 
101  int getDataSize() throw();
102 
104  int getBufferSize() throw();
105 
107  int getSendedSize() throw();
108 
110  int getNotFilledSize() throw();
111 
113  int getNotSendedSize() throw();
114 
116  bool isAllocated() throw();
117 
122  int read(FileDescriptor&) throw();
123 
129  int read(const void *externalBuffer,int size) throw();
130 
136  int reserve(int size) throw();
137 
138 
144  int write(FileDescriptor&) throw();
145 
151  int write(void *externalBuffer,int size) throw();
152 
154  void clearToRead() throw();
155 
159  void clearToWrite() throw();
160 
161 private:
163  char *data;
165  int buffSize;
167  int fillSize;
169  int sendSize;
171  bool allocated;
172 };
173 
174 } //namespace
175 #endif
176