|
RInside Version 0.2.6
|
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 00002 // 00003 // MemBuf.h: R/C++ interface class library -- Easier R embedding into C++ 00004 // 00005 // Copyright (C) 2009 Dirk Eddelbuettel 00006 // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois 00007 // 00008 // This file is part of RInside. 00009 // 00010 // RInside is free software: you can redistribute it and/or modify it 00011 // under the terms of the GNU General Public License as published by 00012 // the Free Software Foundation, either version 2 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // RInside is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU General Public License 00021 // along with RInside. If not, see <http://www.gnu.org/licenses/>. 00022 00023 class MemBuf { // simple C++-ification of littler's membuf 00024 private: 00025 std::string buffer ; 00026 00027 public: 00028 MemBuf(int sizebytes=1024); 00029 ~MemBuf(); 00030 void resize(); 00031 void rewind(); 00032 void add(const std::string& ); 00033 inline const char* getBufPtr() { return buffer.c_str() ; }; 00034 };