Gaudi Framework, version v23r9

Home   Generated: Thu Jul 18 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
main.cpp
Go to the documentation of this file.
1 #include "Python.h"
2 #include <iostream>
3 #include <string>
4 #include <fstream>
5 #include <sstream>
6 
7 
8 int main ( int argc, char** argv ) {
9  if (argc < 2 ) {
10  std::cout << "ERROR: insufficient command arguments" << std::endl;
11  return 0;
12  }
13  Py_Initialize();
14  // Get the Python version
15  std::string fullversion = Py_GetVersion();
16  std::string version( fullversion, 0, fullversion.find_first_of(' '));
17  std::string vers(version, 0, version.find_first_of('.',version.find_first_of('.')+1));
18  std::cout << "Python version: [" << vers << "]" << std::endl;
19 
20  // Startup commands
21  PyRun_SimpleString( "print dir()" );
22 
23  std::cout << "Running now: " << argv[1] << std::endl;
24  std::ifstream file(argv[1]);
26  if( file ) {
27  char ch;
28  while( file.get(ch) ) str.put(ch);
29  PyRun_SimpleString( const_cast<char*>(str.str().c_str()) );
30  file.close();
31  }
32  else {
33  std::cout << "ERROR: could not open file " << argv[1] << std::endl;
34  }
35  std::cout << "Exiting now " << std::endl;
36 
37  return 0 ;
38 }
39 

Generated at Thu Jul 18 2013 12:18:00 for Gaudi Framework, version v23r9 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004