Orbiter 2022
Combinatorial Objects
file_output.cpp
Go to the documentation of this file.
1// file_output.cpp
2//
3// Anton Betten
4// January 8, 2016
5//
6
7#include "foundations.h"
8
9using namespace std;
10
11
12namespace orbiter {
13namespace layer1_foundations {
14namespace orbiter_kernel_system {
15
16
18{
19 null();
20}
21
23{
24 freeself();
25}
26
28{
30 fp = NULL;
31}
32
34{
35 if (f_file_is_open) {
36 close();
37 }
38 null();
39}
40
41
42void file_output::open(const char *fname,
43 void *user_data, int verbose_level)
44{
45 int f_v = (verbose_level >= 1);
46
47 if (f_v) {
48 cout << "file_output::open" << endl;
49 }
52
53 fp = new ofstream;
54 fp->open(fname);
56
57
58
59 if (f_v) {
60 cout << "file_output::open done" << endl;
61 }
62}
63
65{
66 //*fp << "-1" << endl;
67 delete fp;
68 fp = NULL;
70}
71
72void file_output::write_line(int nb, int *data,
73 int verbose_level)
74{
75 int i;
76
77 if (!f_file_is_open) {
78 cout << "file_output::write_line file is not open" << endl;
79 exit(1);
80 }
81 *fp << nb;
82 for (i = 0; i < nb; i++) {
83 *fp << " " << data[i];
84 }
85 *fp << endl;
86}
87
88void file_output::write_EOF(int nb_sol, int verbose_level)
89{
90 *fp << "-1 " << nb_sol << endl;
91}
92
93
94}}}
95
void open(const char *fname, void *user_data, int verbose_level)
Definition: file_output.cpp:42
void write_line(int nb, int *data, int verbose_level)
Definition: file_output.cpp:72
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects