00001 /* 00002 * Copyright: (C) 1999-2001 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@tns.net 00019 * 00020 */ 00021 00022 00023 #ifndef _AFLIBDATA_H_ 00024 #define _AFLIBDATA_H_ 00025 00026 00027 #ifdef HAVE_CONFIG_H 00028 #include <config.h> 00029 #endif 00030 00031 #include "aflibConfig.h" 00032 00033 00056 class aflibData { 00057 00058 public: 00059 00060 aflibData(long length); 00061 00062 aflibData( 00063 const aflibConfig& config, 00064 long length); 00065 00066 aflibData(const aflibData& data); 00067 00068 ~aflibData(); 00069 00070 aflibData& 00071 operator=(const aflibData& data); 00072 00073 void 00074 setConfig(const aflibConfig& config); 00075 00076 const aflibConfig& 00077 getConfig() const; 00078 00079 void 00080 getLength(long& length) const; 00081 00082 long 00083 getLength() const; 00084 00085 void 00086 getOrigLength(long& length) const; 00087 00088 long 00089 getOrigLength() const; 00090 00091 void 00092 adjustLength(long length); 00093 00094 void 00095 adjustTotalLength(long length); 00096 00097 long 00098 getTotalLength(); 00099 00100 long 00101 getTotalAdjustLength(); 00102 00103 void * 00104 getDataPointer() const; 00105 00106 void 00107 setSample( 00108 int sample, 00109 long position, 00110 int channel); 00111 00112 int 00113 getSample( 00114 long position, 00115 int channel); 00116 00117 void 00118 getMinMax( 00119 int& min_value, 00120 int& max_value) const; 00121 00122 void 00123 convertToSize(aflib_data_size data_size); 00124 00125 void 00126 convertToEndian(aflib_data_endian endian); 00127 00128 aflib_data_endian 00129 getHostEndian() const; 00130 00131 void 00132 zeroData(); 00133 00134 private: 00135 00136 void 00137 init(); 00138 00139 void 00140 setHostEndian(); 00141 00142 void 00143 allocate(); 00144 00145 00146 void * _data; // holds pointer to data 00147 int _initialized; // indicates if data has been initialized 00148 aflibConfig _config; // data organization 00149 int _byte_inc; // number of bytes for each sample 00150 long _length; 00151 long _adj_length; 00152 long _total_length; 00153 aflib_data_endian _endian; 00154 00155 }; 00156 00157 00158 #endif