Salome HOME
Merge from V6_main 01/04/2013
[modules/paravis.git] / src / PVGUI / create_class.sh
1 #!/bin/bash
2 # Copyright (C) 2010-2013  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 file=PARAVIS_CreateClass.cxx
22 wfile=$1/wrapfiles.txt
23
24 echo '#include <iostream>' > $file
25 echo '#include <QString>' >> $file
26 echo '#include "PARAVIS_Gen_i.hh"' >> $file
27 awk '{print "#include \"PARAVIS_Gen_"$1"_i.hh\"";}' $wfile >> $file
28 echo '' >> $file
29 echo 'PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' >> $file
30 echo '{' >> $file
31 awk 'BEGIN {lst="";} {lst=lst" "$1;} END{i=split(lst,arr);for(j=i;j>0;j--) {print "    if(theClassName == \""arr[j]"\" || (Inst != NULL && Inst->IsA(\""arr[j]"\")))";print "      return new PARAVIS::"arr[j]"_i();"}}' $wfile >> $file
32 echo '' >> $file
33 echo '    cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' >> $file
34 echo '    return new PARAVIS::PARAVIS_Base_i();' >> $file
35 echo '}' >> $file