SmagJournal.hpp

Go to the documentation of this file.
00001 // Copyright (C) GAMS Development 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: SmagJournal.hpp 298 2008-01-04 14:03:20Z stefan $
00006 //
00007 // Author: Stefan Vigerske
00008 // from the IpFileJournal class in IPOPT
00009 
00010 #ifndef __SMAGJOURNAL_HPP__
00011 #define __SMAGJOURNAL_HPP__
00012 
00013 #include "GAMSlinksConfig.h"
00014 
00015 // smag.h will try to include stdio.h and stdarg.h
00016 // so we include cstdio and cstdarg before if we know that we have them
00017 #ifdef HAVE_CSTDIO
00018 #include <cstdio>
00019 #endif
00020 #ifdef HAVE_CSTDARG
00021 #include <cstdarg>
00022 #endif
00023 #include "smag.h"
00024 
00025 #include "IpJournalist.hpp"
00026 
00027 using namespace Ipopt;
00028 
00031 class SmagJournal : public Journal {
00032 public:
00039   SmagJournal(smagHandle_t smag_, const char* name, EJournalLevel default_level, EJournalLevel status_level_=J_SUMMARY)
00040   : Journal(name, default_level), smag(smag_), status_level(status_level_)
00041   { }
00042 
00045   ~SmagJournal() { }
00046 
00047 protected:
00048   virtual void PrintImpl(EJournalCategory category, EJournalLevel level, const char* str) {
00049         smagStdOutputPrintX(smag, level<=status_level ? SMAG_ALLMASK : SMAG_LOGMASK, str, 0);
00050   }
00051 
00052   virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, const char* pformat, va_list ap);
00053 
00054   virtual void FlushBufferImpl() {
00055         smagStdOutputFlush(smag, SMAG_ALLMASK);
00056         }
00057 
00058 private:
00059         smagHandle_t smag;
00060         EJournalLevel status_level;
00061         
00069   SmagJournal();
00070   SmagJournal(const SmagJournal&);
00071   void operator=(const SmagJournal&);
00072 };
00073 
00074 #endif // __SMAGJOURNAL_HPP__

Generated on Tue Dec 30 03:01:24 2008 for GAMSlinks by  doxygen 1.4.7