[Mockpp-commits] mockpp/mockpp CountedVisitableMethod.h,NONE,1.1 CountParameters.h,NONE,1.1 gen_coun
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-30 13:53:23
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27397/mockpp Modified Files: Makefile.am Added Files: CountedVisitableMethod.h CountParameters.h gen_countparams_N.pl gen_countvisitable_N.pl Log Message: basic file set working --- NEW FILE: CountedVisitableMethod.h --- /** @file @internal NOT INTENDED FOR PUBLIC INCLUSION @brief Generated with gen_countvisitable.pl. $Id: CountedVisitableMethod.h,v 1.1 2005/10/30 13:53:00 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sun Oct 30 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_COUNTEDVISITABLEMETHOD_H #define MOCKPP_COUNTEDVISITABLEMETHOD_H #include <mockpp/CountParameters.h> #include <mockpp/VisitableMockMethod0.h> #include <mockpp/VisitableMockMethod1.h> #include <mockpp/VisitableMockMethod2.h> #include <mockpp/VisitableMockMethod3.h> #include <mockpp/VisitableMockMethod4.h> #include <mockpp/VisitableMockMethod5.h> #include <mockpp/VisitableMockMethod6.h> namespace mockpp { template<unsigned params> class SwitchVisitable { }; template<> class SwitchVisitable<0> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod0<R> VisitableMockMethodType; }; }; template<> class SwitchVisitable<1> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod1<R, P1> VisitableMockMethodType; }; }; template<> class SwitchVisitable<2> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod2<R, P1, P2> VisitableMockMethodType; }; }; template<> class SwitchVisitable<3> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod3<R, P1, P2, P3> VisitableMockMethodType; }; }; template<> class SwitchVisitable<4> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod4<R, P1, P2, P3, P4> VisitableMockMethodType; }; }; template<> class SwitchVisitable<5> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod5<R, P1, P2, P3, P4, P5> VisitableMockMethodType; }; }; template<> class SwitchVisitable<6> { public: template< typename R , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6> class Method { public: typedef VisitableMockMethod6<R, P1, P2, P3, P4, P5, P6> VisitableMockMethodType; }; }; template< typename R , typename P1 = NoParameter , typename P2 = NoParameter , typename P3 = NoParameter , typename P4 = NoParameter , typename P5 = NoParameter , typename P6 = NoParameter> class VisitableMockMethod : public SwitchVisitable<CountParameters<R, P1, P2, P3, P4, P5, P6>::value> ::template Method<R, P1, P2, P3, P4, P5, P6> ::VisitableMockMethodType { public: VisitableMockMethod(const String &name, VisitableMockObject *parent ) : SwitchVisitable<CountParameters<R, P1, P2, P3, P4, P5, P6>::value > ::template Method<R, P1, P2, P3, P4, P5, P6> ::VisitableMockMethodType(name, parent) { } }; } // ns mockpp #endif // MOCKPP_COUNTEDVISITABLEMETHOD_H --- NEW FILE: CountParameters.h --- /** @file @internal NOT INTENDED FOR PUBLIC INCLUSION @brief Generated with gen_countparameters_N.pl. $Id: CountParameters.h,v 1.1 2005/10/30 13:53:00 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sun Oct 30 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_COUNTPARAMETERS_N_H #define MOCKPP_COUNTPARAMETERS_N_H namespace mockpp { class NoParameter { NoParameter() {} }; template<typename T> class CountIfUsed { public: enum { value = 1 }; }; template<> class CountIfUsed<NoParameter> { public: enum { value = 0 }; }; template< typename T , typename P1 = NoParameter , typename P2 = NoParameter , typename P3 = NoParameter , typename P4 = NoParameter , typename P5 = NoParameter , typename P6 = NoParameter> class CountParameters { public: enum { value = CountIfUsed<P1>::value + CountIfUsed<P2>::value + CountIfUsed<P3>::value + CountIfUsed<P4>::value + CountIfUsed<P5>::value + CountIfUsed<P6>::value }; }; } // ns mockpp #endif // MOCKPP_COUNTPARAMETERS_N_H Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/Makefile.am,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- Makefile.am 29 Oct 2005 18:17:30 -0000 1.93 +++ Makefile.am 30 Oct 2005 13:53:00 -0000 1.94 @@ -38,6 +38,8 @@ VisitableMockMethod4.h \ VisitableMockMethod5.h \ VisitableMockMethod6.h \ + CountParameters.h \ + CountedVisitableMethod.h \ ResponseVector1.h \ ResponseVector2.h \ ResponseVector3.h \ @@ -50,6 +52,8 @@ mockpp_config-msvc_60_70.h \ mockpp_config-msvc_71.h \ gen_visitablemethod_N.pl \ + gen_countparameters_N.pl \ + gen_countvisitbale_N.pl \ gen_responsevector_N.pl CLEANFILES = *.~* *.~~* *~ mockpp_config.h *.old --- NEW FILE: gen_countvisitable_N.pl --- #!/usr/bin/perl -w # # $Id: gen_countvisitable_N.pl,v 1.1 2005/10/30 13:53:00 ewald-arnold Exp $ use English; if ($#ARGV < 0) { print "Usage: perl gen_countvisitable <number of arguments>\n"; exit; } $totalNumArgs = $ARGV[0]; if ($totalNumArgs < 5) { $totalNumArgs = 5; } for ($numArgs = 1; $numArgs <= $totalNumArgs; ++$numArgs) { } open OUT, ">CountedVisitableMethod.h"; print OUT "/** \@file \@internal NOT INTENDED FOR PUBLIC INCLUSION \@brief Generated with gen_countvisitable.pl. \$I" . "d: CountedVisitableMethod.h,v 1.7 2005/10/19 20:53:09 ewald-arnold Exp \$ ***************************************************************************/ /************************************************************************** begin : Sun Oct 30 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_COUNTEDVISITABLEMETHOD_H #define MOCKPP_COUNTEDVISITABLEMETHOD_H #include <mockpp/CountParameters.h>"; for ($p = 0; $p <= $totalNumArgs; ++$p) { print OUT " #include <mockpp/VisitableMockMethod" . $p . ".h>";} print OUT " namespace mockpp { template<unsigned params> class SwitchVisitable { }; "; for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) { $templateParms = ""; $templateParms_colon = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { $templateParms .= ", "; } $templateParms .= "typename P$i"; } if ($numArgs > 0) { $templateParms_colon = ", " . $templateParms; } $templateArgs_colon = ""; $_ = $templateParms; s/typename //g; $templateArgs = $_; if ($numArgs > 0) { $templateArgs_colon = ", ". $templateArgs; } print "Creating CountedVisitableMethod" . $numArgs ."\n"; print OUT " template<> class SwitchVisitable<" . $numArgs ."> { public: "; print OUT " template< typename R"; for($p = 1; $p <= $totalNumArgs; ++$p) { print OUT " , typename P" . $p; } print OUT "> class Method { public: typedef VisitableMockMethod" . $numArgs ."<R" . $templateArgs_colon . "> VisitableMockMethodType; }; }; "; } print OUT " template< typename R , typename P1 = NoParameter"; for($p = 2; $p <= $totalNumArgs; ++$p) { print OUT " , typename P" . $p . " = NoParameter"; }; print OUT "> class VisitableMockMethod : public SwitchVisitable<CountParameters<R, " . $templateArgs . ">::value> ::template Method<R, " . $templateArgs . "> ::VisitableMockMethodType { public: VisitableMockMethod(const String &name, VisitableMockObject *parent ) : SwitchVisitable<CountParameters<R, " . $templateArgs . ">::value > ::template Method<R, " . $templateArgs . "> ::VisitableMockMethodType(name, parent) { } }; "; print OUT " } // ns mockpp #endif // MOCKPP_COUNTEDVISITABLEMETHOD_H "; close OUT; --- NEW FILE: gen_countparams_N.pl --- #!/usr/bin/perl -w # # $Id: gen_countparams_N.pl,v 1.1 2005/10/30 13:53:00 ewald-arnold Exp $ use English; if ($#ARGV < 0) { print "Usage: perl gen_countparams_N <number of arguments>\n"; exit; } $totalNumArgs = $ARGV[0]; if ($totalNumArgs < 5) { $totalNumArgs = 5; } open OUT, ">CountParameters.h"; print OUT "/** \@file \@internal NOT INTENDED FOR PUBLIC INCLUSION \@brief Generated with gen_countparameters_N.pl. \$I" . "d: CountParameters.h,v 1.7 2005/10/19 20:53:09 ewald-arnold Exp \$ ***************************************************************************/ /************************************************************************** begin : Sun Oct 30 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_COUNTPARAMETERS_N_H #define MOCKPP_COUNTPARAMETERS_N_H namespace mockpp { class NoParameter { NoParameter() {} }; template<typename T> class CountIfUsed { public: enum { value = 1 }; }; template<> class CountIfUsed<NoParameter> { public: enum { value = 0 }; }; "; print OUT " template< typename T , typename P1 = NoParameter"; for($p = 2; $p <= $totalNumArgs; ++$p) { print OUT " , typename P" . $p . " = NoParameter"; } print OUT "> class CountParameters { public: enum { value = CountIfUsed<P1>::value"; for($p = 2; $p <= $totalNumArgs; ++$p) { print OUT " + CountIfUsed<P" . $p . ">::value"; }; print OUT " }; }; } // ns mockpp #endif // MOCKPP_COUNTPARAMETERS_N_H "; close OUT; |