parallel/pico/CBuffer.hpp

00001 // -*- C++ -*-
00002 //
00003 //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 //                                   Fehmi Cirak
00006 //                        California Institute of Technology
00007 //                           (C) 2004 All Rights Reserved
00008 //
00009 //  <LicenseText>
00010 //
00011 //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00012 //
00013 // EDITED BY MATT GALLOWAY FOR USE WITH DAPTA
00014 
00015 #ifndef __CBUFFER_HPP__
00016 #define __CBUFFER_HPP__
00017 
00018 #include <vector>
00019 #include <iterator>
00020 #include <cassert>
00021 
00022 namespace DAPTA { // Define namespace DAPTA
00023 
00024 namespace pico { // Define namespace pico
00025 
00026 class CBuffer {
00027    public:
00028       CBuffer() {;}
00029       ~CBuffer();
00030       
00031       // methods
00032       void copyToBuffer(const char * const start, const size_t& size);    
00033       void allocateBuffer(const size_t& size);
00034       
00035       // accessors
00036       char * start() {
00037          if (_buf.empty()) return NULL;
00038          return &(_buf[0]);
00039       }
00040       
00041       int size() const {
00042          assert(_buf.size()>0);
00043          return _buf.size();
00044       }
00045    
00046    private:
00047       // copy and equality constructor
00048       CBuffer(const CBuffer &);
00049       const CBuffer & operator=(const CBuffer &);
00050    
00051    private:
00052       std::vector<char> _buf;
00053 };
00054 
00055 } // namespace pico
00056 
00057 } // namespace DAPTA
00058 
00059 #include "CBuffer.cpp"
00060 
00061 #endif

Generated on Tue May 29 17:13:48 2007 for DAPTA by  doxygen 1.5.1