libH/DynamicBuffer.hpp

Go to the documentation of this file.
00001 
00012 /*
00013   
00014   Copyright (c) 2007, Tim Burrell
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
00026   
00027 */
00028 
00029 #ifndef __DynamicBuffer_h
00030 #define __DynamicBuffer_h
00031 
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 #include <vector>
00037 
00039 // Namespace
00041 
00042 namespace H {
00043 
00045 // Typedefs, enums, etc
00047         
00049 // DynamicBuffer Class Definition
00051 
00060 template <class DataType>
00061 class DynamicBuffer {
00062 public:
00063         // public functions
00064         void                    addToBuffer(const DataType * AddBuf, size_t BufLen); 
00065         void                    clear();                        
00066         const DataType *        getBuffer() const;              
00067         size_t                  length() const;                 
00068 
00069         // construction / deconstruction
00070         DynamicBuffer();                                        
00071         virtual ~DynamicBuffer();                               
00072         
00073 private:
00074         // private member variables
00075         size_t                  mLength;                        
00076         DataType *              mBuffer;                        
00077 };
00078 
00080 // DynamicBufferConverter Class Definition
00082 
00088 template <class DataType, class ConvertTo>
00089 class DynamicBufferConverter {
00090 public:
00091         // public functions
00092         static void             convert(std::vector<ConvertTo> & ConvertedVector, DynamicBuffer<DataType> const & Buffer); 
00093 
00094         // construction / deconstruction
00095         DynamicBufferConverter();                               
00096         virtual ~DynamicBufferConverter();                      
00097         
00098 private:
00099         // private member variables
00100 };
00101 
00103 
00104 } // end namespace
00105 
00106 #include "DynamicBuffer.cpp"
00107 
00109 
00110 #endif // __DynamicBuffer_h

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3