source: XIOS/dev/dev_olga/src/extern/blitz/include/blitz/prettyprint.h @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 2.2 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/prettyprint.h      Format object for pretty-printing of
4 *                          array expressions
5 *
6 * $Id$
7 *
8 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
9 *
10 * This file is a part of Blitz.
11 *
12 * Blitz is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation, either version 3
15 * of the License, or (at your option) any later version.
16 *
17 * Blitz is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with Blitz.  If not, see <http://www.gnu.org/licenses/>.
24 *
25 * Suggestions:          blitz-devel@lists.sourceforge.net
26 * Bugs:                 blitz-support@lists.sourceforge.net   
27 *
28 * For more information, please see the Blitz++ Home Page:
29 *    https://sourceforge.net/projects/blitz/
30 *
31 ***************************************************************************/
32
33#ifndef BZ_PRETTYPRINT_H
34#define BZ_PRETTYPRINT_H
35
36#include <blitz/blitz.h>
37
38BZ_NAMESPACE(blitz)
39
40class prettyPrintFormat {
41
42public:
43    prettyPrintFormat(const bool terse = false)
44        : tersePrintingSelected_(terse) 
45    {
46        arrayOperandCounter_ = 0;
47        scalarOperandCounter_ = 0;
48        dumpArrayShapes_ = false;
49    }
50
51    void setDumpArrayShapesMode()  { dumpArrayShapes_ = true; }
52    char nextArrayOperandSymbol() 
53    { 
54        return static_cast<char>('A' + ((arrayOperandCounter_++) % 26)); 
55    }
56    char nextScalarOperandSymbol() 
57    { 
58        return static_cast<char>('s' + ((scalarOperandCounter_++) % 26)); 
59    }
60
61    bool tersePrintingSelected() const { return tersePrintingSelected_; }
62    bool dumpArrayShapesMode()   const { return dumpArrayShapes_; }
63
64private:
65    bool tersePrintingSelected_;
66    bool dumpArrayShapes_;
67    int arrayOperandCounter_;
68    int scalarOperandCounter_;
69};
70
71BZ_NAMESPACE_END
72
73#endif // BZ_PRETTYPRINT_H
Note: See TracBrowser for help on using the repository browser.