RInside Version 0.2.10
inst/include/Callbacks.h
Go to the documentation of this file.
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
00002 //
00003 // Callbacks.h: R/C++ interface class library -- Easier R embedding into C++
00004 //
00005 // Copyright (C) 2010        Dirk Eddelbuettel and Romain Francois
00006 //
00007 // This file is part of RInside.
00008 //
00009 // RInside is free software: you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 2 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // RInside is distributed in the hope that it will be useful, but
00015 // WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with RInside.  If not, see <http://www.gnu.org/licenses/>.
00021 
00022 #ifndef RINSIDE_CALLBACKS_H
00023 #define RINSIDE_CALLBACKS_H
00024 
00025 #include <RInsideCommon.h>
00026 
00027 #ifdef RINSIDE_CALLBACKS
00028 
00029 class Callbacks {
00030 public:
00031         
00032         Callbacks() : R_is_busy(false), buffer() {} ;
00033         virtual ~Callbacks(){} ;
00034         
00035         virtual void ShowMessage(const char* message) {} ;
00036         virtual void Suicide(const char* message) {};
00037         virtual std::string ReadConsole( const char* prompt, bool addtohistory ) { return ""; };
00038         virtual void WriteConsole( const std::string& line, int type ) {};
00039         virtual void FlushConsole() {};
00040         virtual void ResetConsole() {};
00041         virtual void CleanerrConsole(){} ;
00042         virtual void Busy( bool is_busy ) {} ;
00043         
00044         void Busy_( int which ) ;
00045         int ReadConsole_( const char* prompt, unsigned char* buf, int len, int addtohistory ) ;
00046         void WriteConsole_( const char* buf, int len, int oType ) ;
00047         
00048         // TODO: ShowFiles
00049         // TODO: ChooseFile
00050         // TODO: loadHistory
00051         // TODO: SaveHistory                                                                                      
00052         
00053         virtual bool has_ShowMessage() { return false ; } ;
00054         virtual bool has_Suicide() { return false ; } ;
00055         virtual bool has_ReadConsole() { return false ; } ;
00056         virtual bool has_WriteConsole() { return false ; } ;
00057         virtual bool has_ResetConsole() { return false ; } ;
00058         virtual bool has_CleanerrConsole() { return false ; } ;
00059         virtual bool has_Busy() { return false ; } ;
00060         virtual bool has_FlushConsole(){ return false; } ;
00061         
00062 private:
00063         bool R_is_busy ;
00064         std::string buffer ;
00065         
00066 } ;                                       
00067 
00068 #endif
00069 
00070 #endif
 All Classes Files Functions Variables Enumerations Enumerator Defines