GAMSlinks  0.4
SmagJournal.hpp
Go to the documentation of this file.
1 // Copyright (C) GAMS Development 2007
2 // All Rights Reserved.
3 // This code is published under the Common Public License.
4 //
5 // $Id: SmagJournal.hpp 298 2008-01-04 14:03:20Z stefan $
6 //
7 // Author: Stefan Vigerske
8 // from the IpFileJournal class in IPOPT
9 
10 #ifndef __SMAGJOURNAL_HPP__
11 #define __SMAGJOURNAL_HPP__
12 
13 #include "GAMSlinksConfig.h"
14 
15 // smag.h will try to include stdio.h and stdarg.h
16 // so we include cstdio and cstdarg before if we know that we have them
17 #ifdef HAVE_CSTDIO
18 #include <cstdio>
19 #endif
20 #ifdef HAVE_CSTDARG
21 #include <cstdarg>
22 #endif
23 #include "smag.h"
24 
25 #include "IpJournalist.hpp"
26 
27 using namespace Ipopt;
28 
31 class SmagJournal : public Journal {
32 public:
39  SmagJournal(smagHandle_t smag_, const char* name, EJournalLevel default_level, EJournalLevel status_level_=J_SUMMARY)
40  : Journal(name, default_level), smag(smag_), status_level(status_level_)
41  { }
42 
46 
47 protected:
48  virtual void PrintImpl(EJournalCategory category, EJournalLevel level, const char* str) {
49  smagStdOutputPrintX(smag, level<=status_level ? SMAG_ALLMASK : SMAG_LOGMASK, str, 0);
50  }
51 
52  virtual void PrintfImpl(EJournalCategory category, EJournalLevel level, const char* pformat, va_list ap);
53 
54  virtual void FlushBufferImpl() {
55  smagStdOutputFlush(smag, SMAG_ALLMASK);
56  }
57 
58 private:
59  smagHandle_t smag;
60  EJournalLevel status_level;
61 
69  SmagJournal();
70  SmagJournal(const SmagJournal&);
71  void operator=(const SmagJournal&);
72 };
73 
74 #endif // __SMAGJOURNAL_HPP__
EJournalLevel status_level
Definition: SmagJournal.hpp:60
virtual void FlushBufferImpl()
Definition: SmagJournal.hpp:54
smagHandle_t smag
Definition: SmagJournal.hpp:59
SmagJournal(smagHandle_t smag_, const char *name, EJournalLevel default_level, EJournalLevel status_level_=J_SUMMARY)
Constructor.
Definition: SmagJournal.hpp:39
A particular Journal implementation that uses the SMAG routines for output.
Definition: SmagJournal.hpp:31
~SmagJournal()
Destructor.
Definition: SmagJournal.hpp:45
virtual void PrintImpl(EJournalCategory category, EJournalLevel level, const char *str)
Definition: SmagJournal.hpp:48