1 | // -*- C++ -*- |
---|
2 | /*************************************************************************** |
---|
3 | * blitz/prettyprint.h Format object for pretty-printing of |
---|
4 | * array expressions |
---|
5 | * |
---|
6 | * $Id: prettyprint.h,v 1.5 2004/03/09 23:23:43 julianc Exp $ |
---|
7 | * |
---|
8 | * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> |
---|
9 | * |
---|
10 | * This program is free software; you can redistribute it and/or |
---|
11 | * modify it under the terms of the GNU General Public License |
---|
12 | * as published by the Free Software Foundation; either version 2 |
---|
13 | * of the License, or (at your option) any later version. |
---|
14 | * |
---|
15 | * This program is distributed in the hope that it will be useful, |
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | * GNU General Public License for more details. |
---|
19 | * |
---|
20 | * Suggestions: blitz-dev@oonumerics.org |
---|
21 | * Bugs: blitz-bugs@oonumerics.org |
---|
22 | * |
---|
23 | * For more information, please see the Blitz++ Home Page: |
---|
24 | * http://oonumerics.org/blitz/ |
---|
25 | * |
---|
26 | ***************************************************************************/ |
---|
27 | |
---|
28 | #ifndef BZ_PRETTYPRINT_H |
---|
29 | #define BZ_PRETTYPRINT_H |
---|
30 | |
---|
31 | BZ_NAMESPACE(blitz) |
---|
32 | |
---|
33 | class prettyPrintFormat { |
---|
34 | |
---|
35 | public: |
---|
36 | prettyPrintFormat(const bool terse = false) |
---|
37 | : tersePrintingSelected_(terse) |
---|
38 | { |
---|
39 | arrayOperandCounter_ = 0; |
---|
40 | scalarOperandCounter_ = 0; |
---|
41 | dumpArrayShapes_ = false; |
---|
42 | } |
---|
43 | |
---|
44 | void setDumpArrayShapesMode() { dumpArrayShapes_ = true; } |
---|
45 | char nextArrayOperandSymbol() |
---|
46 | { |
---|
47 | return static_cast<char>('A' + ((arrayOperandCounter_++) % 26)); |
---|
48 | } |
---|
49 | char nextScalarOperandSymbol() |
---|
50 | { |
---|
51 | return static_cast<char>('s' + ((scalarOperandCounter_++) % 26)); |
---|
52 | } |
---|
53 | |
---|
54 | bool tersePrintingSelected() const { return tersePrintingSelected_; } |
---|
55 | bool dumpArrayShapesMode() const { return dumpArrayShapes_; } |
---|
56 | |
---|
57 | private: |
---|
58 | bool tersePrintingSelected_; |
---|
59 | bool dumpArrayShapes_; |
---|
60 | int arrayOperandCounter_; |
---|
61 | int scalarOperandCounter_; |
---|
62 | }; |
---|
63 | |
---|
64 | BZ_NAMESPACE_END |
---|
65 | |
---|
66 | #endif // BZ_PRETTYPRINT_H |
---|