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.5 2004/03/09 23:23:43 julianc Exp $
00007  *
00008  * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License
00012  * as published by the Free Software Foundation; either version 2
00013  * of the License, or (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * Suggestions:          blitz-dev@oonumerics.org
00021  * Bugs:                 blitz-bugs@oonumerics.org
00022  *
00023  * For more information, please see the Blitz++ Home Page:
00024  *    http://oonumerics.org/blitz/
00025  *
00026  ***************************************************************************/
00027 
00028 #ifndef BZ_PRETTYPRINT_H
00029 #define BZ_PRETTYPRINT_H
00030 
00031 BZ_NAMESPACE(blitz)
00032 
00033 class prettyPrintFormat {
00034 
00035 public:
00036     prettyPrintFormat(const bool terse = false)
00037         : tersePrintingSelected_(terse) 
00038     {
00039         arrayOperandCounter_ = 0;
00040         scalarOperandCounter_ = 0;
00041         dumpArrayShapes_ = false;
00042     }
00043 
00044     void setDumpArrayShapesMode()  { dumpArrayShapes_ = true; }
00045     char nextArrayOperandSymbol()  
00046     { 
00047         return static_cast<char>('A' + ((arrayOperandCounter_++) % 26)); 
00048     }
00049     char nextScalarOperandSymbol() 
00050     { 
00051         return static_cast<char>('s' + ((scalarOperandCounter_++) % 26)); 
00052     }
00053 
00054     bool tersePrintingSelected() const { return tersePrintingSelected_; }
00055     bool dumpArrayShapesMode()   const { return dumpArrayShapes_; }
00056 
00057 private:
00058     bool tersePrintingSelected_;
00059     bool dumpArrayShapes_;
00060     int arrayOperandCounter_;
00061     int scalarOperandCounter_;
00062 };
00063 
00064 BZ_NAMESPACE_END
00065 
00066 #endif // BZ_PRETTYPRINT_H

Generated on Wed Oct 17 15:37:28 2007 for blitz by  doxygen 1.5.2