61 void append(boost::python::object element);
70 boost::python::class_<PyLine>
make_class(
const char* className);
76 std::vector<boost::python::object>
line;
82 std::cerr <<
"RegisterObject Line 1 " << wrapped <<
std::endl;
86 std::cerr <<
"RegisterObject Line 2 " << objectPtr <<
std::endl;
87 if (objectPtr == NULL) {
88 throw OpalException(
"PyLine_<TBeamline<FlaggedElmPtr> >::register",
89 "Trying to register something that was not a Opal Object");
96 boost::python::docstring_options docop(
true,
true,
false);
97 auto pyclass = boost::python::class_<PyLine>(className);
105 }
catch (std::exception& exc) {
113 std::cerr <<
"PYLINE setElement " << i <<
std::endl;
116 line.at(i) = pyelement;
117 }
catch (std::exception& exc) {
118 throw OpalException(
"PyLine::setElement",
"Failed to set element");
120 boost::python::object pyopalelement = pyelement.attr(
"get_opal_element")();
122 boost::python::extract<PyOpal::PyOpalObjectNS::PyOpalObject<OpalElement>& >(pyopalelement);
124 for (
BL::iterator it = object_m->begin(); it != object_m->end(); ++it) {
127 std::shared_ptr<OpalElement> opalElementShared = cpyelement.
getOpalShared();
128 OpalElement* opalElement = opalElementShared.get();
130 throw OpalException(
"PyLine::setElement",
"Failed to extract element");
134 std::cerr <<
" PYLINE setElement loop " << elmbase <<
std::endl;
136 throw OpalException(
"PyLine::setElement",
"Failed to cast element");
140 object_m->insert(it, felmptr);
152 line.push_back(boost::python::object());
154 object_m->push_back(felmptr);
156 setElement(i, pyelement);
Inform & endl(Inform &inf)
PyLine_< TBeamline< FlaggedElmPtr > > PyLine
std::string::iterator iterator
void append(boost::python::object element)
void setElement(int i, boost::python::object element)
std::vector< boost::python::object > line
boost::python::class_< PyLine > make_class(const char *className)
boost::python::object getElement(int i)
std::shared_ptr< C > getOpalShared()
ElementBase * getElement() const
Return the embedded CLASSIC element.
void setElement(ElementBase *)
Assign new CLASSIC element.
The base class for all OPAL objects.
static OpalData * getInstance()
void define(Object *newObject)
Define a new object.
A section of a beam line.
A section of a beam line.
virtual void update()
Update the embedded CLASSIC element.
The base class for all OPAL exceptions.