/********************************************************************** * * * Copyright (c) 2003 INFN - Sezione di Napoli * * * * For more information (including a list of authors) see * * the README file * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation; either version 2 * * of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this library (see file COPYING); if not, write to the * * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * * Boston, MA 02111-1307 USA, or contact the authors. * * * **********************************************************************/ #ifndef MAKEHEADER_H #define MAKEHEADER_H #include struct makeHeader { makeHeader( std::ostream& out ) : _out( out ) { } protected: void copyrightNotice() { _out << " /**********************************************************************\n" << " * *\n" << " * Copyright (c) 2003 INFN - Sezione di Napoli *\n" << " * *\n" << " * For more information (including a list of authors) see *\n" << " * the README file *\n" << " * *\n" << " * This library is free software; you can redistribute it and/or *\n" << " * modify it under the terms of the GNU General Public License *\n" << " * as published by the Free Software Foundation; either version 2 *\n" << " * of the License, or (at your option) any later version. *\n" << " * *\n" << " * This library is distributed in the hope that it will be useful, *\n" << " * but WITHOUT ANY WARRANTY; without even the implied warranty of *\n" << " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\n" << " * GNU General Public License for more details. *\n" << " * *\n" << " * You should have received a copy of the GNU General Public License *\n" << " * along with this library (see file COPYING); if not, write to the *\n" << " * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *\n" << " * Boston, MA 02111-1307 USA, or contact the authors. *\n" << " * *\n" << " **********************************************************************/\n"; } void head( const char * def ) { _out << "#ifndef " << def << endl; _out << "#define " << def << endl << endl; } void ns( const char * ns ) { _out << "namespace " << ns << " {" << endl << endl; } void foot() { _out << endl << "}" << endl << endl; _out << "#endif " << endl; } void repeat( const char * s, int n, const char * sep =", " ) { for ( int i = 1; i <= n; i ++ ) { _out << s; if ( i != n ) _out << sep; } } void list( const char * pre, int n0, int n1, const char * post = "", const char * sep =", " ) { for ( int i = n0; i <= n1; i ++ ) { _out << pre << i << post; if ( i != n1 ) _out << sep; } } void list( const char * x, int n, const char * post = "", const char * sep =", " ) { list( x, 0, n - 1, post, sep ); } void list2( const char * pre, int n0, int n1, const char * mid = "", const char * post = "", const char * sep ="," ) { for ( int i = n0; i <= n1; i ++ ) { _out << pre << i << mid << i << post; if ( i != n1 ) _out << sep; } } void list2( const char * x, int n, const char * mid, const char * post = "", const char * sep =", " ) { list2( x, 0, n - 1, mid, post, sep ); } std::ostream & _out; }; #endif