Ipopt
trunk
|
00001 /* 00002 * Copyright (C) 2010 Jelmer Ypma. All Rights Reserved. 00003 * This code is published under the Eclipse Public License. 00004 * 00005 * file: IpoptRJournal.hpp 00006 * author: Jelmer Ypma 00007 * date: 30 January 2011 00008 * 00009 * This file defines a C++ class that takes care of re-directing 00010 * output to the R terminal. Needed for Windows. 00011 * 00012 * Financial support of the UK Economic and Social Research Council 00013 * through a grant (RES-589-28-0001) to the ESRC Centre for Microdata 00014 * Methods and Practice (CeMMAP) is gratefully acknowledged. 00015 */ 00016 00017 #ifndef __IpoptRJournal_HPP__ 00018 #define __IpoptRJournal_HPP__ 00019 00020 #include "IpJournalist.hpp" // ISA Journal 00021 #include <R.h> // USES Rprintf 00022 00023 class IpoptRJournal : public Ipopt::Journal { 00024 public: 00025 00026 // The constructor. 00027 IpoptRJournal( Ipopt::EJournalLevel default_level ); 00028 00029 // The destructor. 00030 virtual ~IpoptRJournal() { }; 00031 00032 protected: 00033 00034 // These functions override the functions in the Journal class. 00035 virtual void PrintImpl( 00036 Ipopt::EJournalCategory category, 00037 Ipopt::EJournalLevel level, 00038 const char* str); 00039 00040 virtual void PrintfImpl( 00041 Ipopt::EJournalCategory category, 00042 Ipopt::EJournalLevel level, 00043 const char* pformat, 00044 va_list ap); 00045 00046 virtual void FlushBufferImpl(); 00047 }; 00048 00049 #endif