MADNESS 0.10.1
outputwriter.h
Go to the documentation of this file.
1/*
2 This file is part of MADNESS.
3
4 Copyright (C) 2007,2010 Oak Ridge National Laboratory
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 For more information please contact:
21
22 Robert J. Harrison
23 Oak Ridge National Laboratory
24 One Bethel Valley Road
25 P.O. Box 2008, MS-6367
26
27 email: harrisonrj@ornl.gov
28 tel: 865-241-3937
29 fax: 865-572-0680
30
31 $Id$
32*/
33#ifndef OUTPUTWRITER_H_
34#define OUTPUTWRITER_H_
35
36#include <fstream>
37
39{
40public:
41 //***************************************************************************
43 {
44 if (!_instance)
45 _instance = new OutputWriter();
46 return _instance;
47 }
48 //***************************************************************************
49
50 //***************************************************************************
51 void init_debug(char* filename)
52 {
53 dostr = new std::ofstream(filename);
54 }
55 //***************************************************************************
56
57 //***************************************************************************
58 void init_log(char* filename)
59 {
60 lostr = new std::ofstream(filename);
61 }
62 //***************************************************************************
63
64 //***************************************************************************
65 void init_eigv(char* filename)
66 {
67 evostr = new std::ofstream(filename);
68 }
69 //***************************************************************************
70
71 //***************************************************************************
72 virtual ~OutputWriter()
73 {
74 if (dostr) delete dostr;
75 if (lostr) delete lostr;
76 if (evostr) delete evostr;
77 }
78 //***************************************************************************
79
80 //***************************************************************************
81 std::ofstream* debug_stream()
82 {
83 return dostr;
84 }
85 //***************************************************************************
86
87 //***************************************************************************
88 std::ofstream* log_stream()
89 {
90 return lostr;
91 }
92 //***************************************************************************
93
94 //***************************************************************************
95 std::ofstream* eigv_stream()
96 {
97 return evostr;
98 }
99 //***************************************************************************
100
101private:
102 //***************************************************************************
104 {
105 dostr = 0;
106 lostr = 0;
107 evostr = 0;
108 }
109 //***************************************************************************
110
111 //***************************************************************************
113 //***************************************************************************
114
115 //***************************************************************************
116 std::ofstream* dostr;
117 //***************************************************************************
118
119 //***************************************************************************
120 std::ofstream* lostr;
121 //***************************************************************************
122
123 //***************************************************************************
124 std::ofstream* evostr;
125 //***************************************************************************
126};
127
129
130#endif /* OUTPUTWRITER_H_ */
Definition outputwriter.h:39
std::ofstream * lostr
Definition outputwriter.h:120
std::ofstream * dostr
Definition outputwriter.h:116
std::ofstream * log_stream()
Definition outputwriter.h:88
void init_debug(char *filename)
Definition outputwriter.h:51
std::ofstream * debug_stream()
Definition outputwriter.h:81
virtual ~OutputWriter()
Definition outputwriter.h:72
static OutputWriter * _instance
Definition outputwriter.h:112
void init_eigv(char *filename)
Definition outputwriter.h:65
std::ofstream * evostr
Definition outputwriter.h:124
void init_log(char *filename)
Definition outputwriter.h:58
static OutputWriter * instance()
Definition outputwriter.h:42
OutputWriter()
Definition outputwriter.h:103
std::ofstream * eigv_stream()
Definition outputwriter.h:95