2 # Copyright (C) 2010-2012 CEA/DEN, EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 ffile = "PARAVIS_CreateClass.cxx"
25 wfile = os.path.join(sys.argv[1], "wrapfiles.txt")
27 ffile_stream = open(ffile, "w")
29 ffile_stream.write('#include <iostream>' + '\n')
30 ffile_stream.write('#include <QString>' + '\n')
31 ffile_stream.write('#include "PARAVIS_Gen_i.hh"' + '\n')
32 wfile_stream = open(wfile)
33 for line in wfile_stream:
34 ffile_stream.write('#include "PARAVIS_Gen_%s_i.hh"'%(line.split()[0]) + '\n')
37 ffile_stream.write('' + '\n')
38 ffile_stream.write('PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' + '\n')
39 ffile_stream.write('{' + '\n')
40 wfile_stream = open(wfile)
42 for line in wfile_stream:
43 lst.append(line.split()[0])
48 ffile_stream.write(' if(theClassName == "%s" || (Inst != NULL && Inst->IsA("%s")))'%(item, item) + '\n')
49 ffile_stream.write(' return new PARAVIS::%s_i();'%(item) + '\n')
51 ffile_stream.write('' + '\n')
52 ffile_stream.write(' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' + '\n')
53 ffile_stream.write(' return new PARAVIS::PARAVIS_Base_i();' + '\n')
54 ffile_stream.write('}' + '\n')