1 /*
2 * Copyright (c) 2010, Michael Lehn
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3) Neither the name of the FLENS development group nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #include <fstream>
34 #include <flens/debug/aux/closurelog.h>
35 #include <flens/debug/aux/closurelogstream.h>
36 #include <flens/debug/aux/variablepool.h>
37 #include <flens/typedefs.h>
38
39 namespace flens { namespace verbose {
40
41 ClosureLogStream::ClosureLogStream(VariablePool &variablePool,
42 std::ofstream &out)
43 : _variablePool(variablePool), _out(out)
44 {
45 }
46
47 ClosureLogStream &
48 operator<<(ClosureLogStream &clStream, Side side)
49 {
50 if (side==Left) {
51 clStream._out << "Left";
52 return clStream;
53 }
54 if (side==Right) {
55 clStream._out << "Right";
56 return clStream;
57 }
58 clStream._out << "?";
59 return clStream;
60 }
61
62 ClosureLogStream &
63 operator<<(ClosureLogStream &clStream, Transpose trans)
64 {
65 if (trans==NoTrans) {
66 clStream._out << "NoTrans";
67 return clStream;
68 }
69 if (trans==Conj) {
70 clStream._out << "Conj";
71 return clStream;
72 }
73 if (trans==Trans) {
74 clStream._out << "Trans";
75 return clStream;
76 }
77 clStream._out << "ConjTrans";
78 return clStream;
79 }
80
81 ClosureLogStream &
82 operator<<(ClosureLogStream &clStream, const char *msg)
83 {
84 clStream._out << msg;
85 return clStream;
86 }
87
88 } } // namespace verbose, namespace flens
2 * Copyright (c) 2010, Michael Lehn
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3) Neither the name of the FLENS development group nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #include <fstream>
34 #include <flens/debug/aux/closurelog.h>
35 #include <flens/debug/aux/closurelogstream.h>
36 #include <flens/debug/aux/variablepool.h>
37 #include <flens/typedefs.h>
38
39 namespace flens { namespace verbose {
40
41 ClosureLogStream::ClosureLogStream(VariablePool &variablePool,
42 std::ofstream &out)
43 : _variablePool(variablePool), _out(out)
44 {
45 }
46
47 ClosureLogStream &
48 operator<<(ClosureLogStream &clStream, Side side)
49 {
50 if (side==Left) {
51 clStream._out << "Left";
52 return clStream;
53 }
54 if (side==Right) {
55 clStream._out << "Right";
56 return clStream;
57 }
58 clStream._out << "?";
59 return clStream;
60 }
61
62 ClosureLogStream &
63 operator<<(ClosureLogStream &clStream, Transpose trans)
64 {
65 if (trans==NoTrans) {
66 clStream._out << "NoTrans";
67 return clStream;
68 }
69 if (trans==Conj) {
70 clStream._out << "Conj";
71 return clStream;
72 }
73 if (trans==Trans) {
74 clStream._out << "Trans";
75 return clStream;
76 }
77 clStream._out << "ConjTrans";
78 return clStream;
79 }
80
81 ClosureLogStream &
82 operator<<(ClosureLogStream &clStream, const char *msg)
83 {
84 clStream._out << msg;
85 return clStream;
86 }
87
88 } } // namespace verbose, namespace flens