blitz Version 0.10
blitz/prettyprint.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  * blitz/prettyprint.h      Format object for pretty-printing of
00004  *                          array expressions
00005  *
00006  * $Id: prettyprint.h,v 1.6 2011/03/25 22:41:16 julianc Exp $
00007  *
00008  * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
00009  *
00010  * This file is a part of Blitz.
00011  *
00012  * Blitz is free software: you can redistribute it and/or modify 
00013  * it under the terms of the GNU Lesser General Public License
00014  * as published by the Free Software Foundation, either version 3
00015  * of the License, or (at your option) any later version.
00016  *
00017  * Blitz is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU Lesser General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Lesser General Public 
00023  * License along with Blitz.  If not, see <http://www.gnu.org/licenses/>.
00024  * 
00025  * Suggestions:          blitz-devel@lists.sourceforge.net
00026  * Bugs:                 blitz-support@lists.sourceforge.net    
00027  *
00028  * For more information, please see the Blitz++ Home Page:
00029  *    https://sourceforge.net/projects/blitz/
00030  *
00031  ***************************************************************************/
00032 
00033 #ifndef BZ_PRETTYPRINT_H
00034 #define BZ_PRETTYPRINT_H
00035 
00036 BZ_NAMESPACE(blitz)
00037 
00038 class prettyPrintFormat {
00039 
00040 public:
00041     prettyPrintFormat(const bool terse = false)
00042         : tersePrintingSelected_(terse) 
00043     {
00044         arrayOperandCounter_ = 0;
00045         scalarOperandCounter_ = 0;
00046         dumpArrayShapes_ = false;
00047     }
00048 
00049     void setDumpArrayShapesMode()  { dumpArrayShapes_ = true; }
00050     char nextArrayOperandSymbol()  
00051     { 
00052         return static_cast<char>('A' + ((arrayOperandCounter_++) % 26)); 
00053     }
00054     char nextScalarOperandSymbol() 
00055     { 
00056         return static_cast<char>('s' + ((scalarOperandCounter_++) % 26)); 
00057     }
00058 
00059     bool tersePrintingSelected() const { return tersePrintingSelected_; }
00060     bool dumpArrayShapesMode()   const { return dumpArrayShapes_; }
00061 
00062 private:
00063     bool tersePrintingSelected_;
00064     bool dumpArrayShapes_;
00065     int arrayOperandCounter_;
00066     int scalarOperandCounter_;
00067 };
00068 
00069 BZ_NAMESPACE_END
00070 
00071 #endif // BZ_PRETTYPRINT_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines