19 #include <boost/python.hpp>
25 #define DONT_DEFINE_IPPL_GMSG 1
33 "Initialise from opal file\n"
34 "- file_name: string corresponding to the file name of the OPAL\n"
36 "Note that if file_name is not valid, OPAL may terminate the python script\n"
37 "execution abnormally (without the usual python exit semantics).\n"
39 "Returns an integer; 0 for successful execution or non-zero if an error\n"
43 std::string exe(
"parser");
46 argvr[0] = exe.data();
47 argvr[1] = file_name.data();
54 "List the objects that are known by the Opal parser, either through calls to\n"
55 "initialise_from_opal_file or through calls directly to the python API\n"
57 "Returns a list of strings, each one corresponding to the name of a\n"
58 "particular object\n";
62 boost::python::list pynames;
63 for (
size_t i = 0; i < names.size(); ++i) {
64 pynames.append(names[i]);
71 "The parser module is used to load an OPAL input file from within python";
77 boost::python::def(
"initialise_from_opal_file",
79 boost::python::args(
"file_name"),
82 boost::python::def(
"list_objects",
static OpalData * getInstance()
std::string initialise_from_opal_file_docstring
boost::python::list list_objects()
int initialise_from_opal_file(std::string file_name)
std::vector< std::string > getAllNames() const
Get a list of all objects.
void registerExceptions()
BOOST_PYTHON_MODULE(parser)
std::string list_objects_docstring
int opalMain(int argc, char *argv[])
std::string module_docstring