/********************************************************************** * * * 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. * * * **********************************************************************/ #include #include #include using namespace std; #include "makeHeader.h" struct makeHeader_Arguments : makeHeader { makeHeader_Arguments( ostream& out, int n ) : makeHeader ( out ) { copyrightNotice(); head( "ARGUMENTS_H" ); _out << "#include \"boost/mpl/size.hpp\"\n" << "#include \"boost/mpl/list.hpp\"\n" << "// boost bug? remove doesn't compile:\n" << "// for_each not included (apply1<...> undefined)\n" << "#include \"boost/mpl/for_each.hpp\"\n" << "#include \"boost/mpl/remove.hpp\"\n\n"; ns( "Pdf" ); _out << "struct null_arg { };\n\n" << "template<\n"; list ( " typename T", n, " = null_arg", ",\n" ); _out << "\n" << " >\n" << "struct Arguments\n" << "{\n" << " typedef typename boost::mpl::remove<\n" << " typename boost::mpl::list< "; list( "T", n ); _out << " >::type,\n"; _out << " null_arg>::type types;\n"; _out << " enum { vars = boost::mpl::size< types >::type::value };\n"; list2( " typedef T", n, " arg", ";", "\n" ); _out << "\n" << "};\n\n"; _out << "template\n" << "struct InheritArguments :\n" << " public Arguments<\n"; list ( " typename T::arg", n, "", ",\n" ); _out << "\n" << " >\n" << "{\n" << " typedef T Pdf;\n" << "};\n"; foot(); } }; int main( int argc, char ** argv ) { const char * header ="Arguments.h"; if ( argc == 2 ) { cout << " generating header file " << header << endl; istringstream str( argv[ 1 ] ); int n; str >> n; cout << " maximum numger of arguments for Pdf's is " << n << endl; ofstream file( header ); makeHeader_Arguments mk( file, n ); return 0; } cout << "usage: " << argv[ 0 ] << " \n" << " : maximum number of pdf arguments" << endl; return 0; }