blitz Version 0.9
|
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 #include <cstdlib> 00031 00032 BZ_NAMESPACE(blitz) 00033 00034 class prettyPrintFormat { 00035 00036 public: 00037 prettyPrintFormat(const bool terse = false) 00038 : tersePrintingSelected_(terse) 00039 { 00040 arrayOperandCounter_ = 0; 00041 scalarOperandCounter_ = 0; 00042 dumpArrayShapes_ = false; 00043 } 00044 00045 void setDumpArrayShapesMode() { dumpArrayShapes_ = true; } 00046 char nextArrayOperandSymbol() 00047 { 00048 return static_cast<char>('A' + ((arrayOperandCounter_++) % 26)); 00049 } 00050 char nextScalarOperandSymbol() 00051 { 00052 return static_cast<char>('s' + ((scalarOperandCounter_++) % 26)); 00053 } 00054 00055 bool tersePrintingSelected() const { return tersePrintingSelected_; } 00056 bool dumpArrayShapesMode() const { return dumpArrayShapes_; } 00057 00058 private: 00059 bool tersePrintingSelected_; 00060 bool dumpArrayShapes_; 00061 int arrayOperandCounter_; 00062 int scalarOperandCounter_; 00063 }; 00064 00065 BZ_NAMESPACE_END 00066 00067 #endif // BZ_PRETTYPRINT_H