17 #ifndef PyOpal_PyLine_h
70 void setElement(
int i, boost::python::object element);
77 void append(boost::python::object element);
102 boost::python::class_<PyLine>
make_class(
const char* className);
108 std::vector<boost::python::object>
line;
115 std::shared_ptr<TBeamline<FlaggedElmPtr>> objectPtr = getOpalShared();
116 return objectPtr->getName();
121 std::shared_ptr<TBeamline<FlaggedElmPtr>> objectPtr = getOpalShared();
122 objectPtr->setName(name);
130 index = line.size()+index;
144 if (objectPtr ==
nullptr) {
145 throw OpalException(
"PyLine_<TBeamline<FlaggedElmPtr> >::register",
146 "Trying to register something that was not a Opal Object");
153 boost::python::docstring_options docop(
true,
true,
false);
154 auto pyclass = boost::python::class_<PyLine>(className);
174 line.at(i) = pyelement;
176 throw OpalException(
"PyLine::setElement",
"Failed to set element");
178 boost::python::object pyopalelement = pyelement.attr(
"get_opal_element")();
180 boost::python::extract<PyOpal::PyOpalObjectNS::PyOpalObject<OpalElement>& >(pyopalelement);
185 std::shared_ptr<OpalElement> opalElementShared = cpyelement.
getOpalShared();
186 OpalElement* opalElement = opalElementShared.get();
188 throw OpalException(
"PyLine::setElement",
"Failed to extract element");
193 throw OpalException(
"PyLine::setElement",
"Failed to cast element");
198 object_m->insert(new_it, felmptr);
210 line.push_back(boost::python::object());
212 object_m->push_back(felmptr);
214 setElement(i, pyelement);
219 #endif // PyOpal_PyLine_h
std::vector< boost::python::object > line
static OpalData * getInstance()
boost::python::class_< PyLine > make_class(const char *className)
The base class for all OPAL objects.
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
int wrangleIndex(int index)
PyLine_< TBeamline< FlaggedElmPtr > > PyLine
void define(Object *newObject)
Define a new object.
void append(boost::python::object element)
std::shared_ptr< C > getOpalShared()
virtual const std::string & getName() const
Get element name.
void setElement(ElementBase *)
Assign new CLASSIC element.
std::string::iterator iterator
The base class for all OPAL exceptions.
A section of a beam line.
boost::python::object getElement(int i)
void setName(std::string name)
ElementBase * getElement() const
Return the embedded CLASSIC element.
virtual Line * clone(const std::string &name)
Make clone.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special exception
A section of a beam line.
void setElement(int i, boost::python::object element)
virtual void update()
Update the embedded CLASSIC element.
std::string getName() const