|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
#include <PyOpalObject.h>
Public Types | |
| typedef PyOpalObject< C > | PyC |
Public Member Functions | |
| PyOpalObject () | |
| PyOpalObject (std::shared_ptr< C > object) | |
| PyOpalObject (const PyOpalObject< C > &rhs) | |
| virtual | ~PyOpalObject ()=default |
| boost::python::class_< PyC > | make_class (const char *className) |
| boost::python::class_< PyC > | make_element_class (const char *className) |
| boost::python::class_< PyC > | make_generic_class (const char *className) |
| template<class PYCLASS> | |
| void | addAttributes (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addExecute (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addRegister (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addGetOpalName (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addSetAttributes (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addSetOpalName (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addSetOpalElementName (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addGetOpalElement (PYCLASS &pyclass) |
| template<class PYCLASS> | |
| void | addGetFieldValue (PYCLASS &pyclass, double distanceUnits, double timeUnits, double bfieldUnits, double efieldUnits) |
| template<class ValueType> | |
| ValueType | dummyGet () const |
| virtual void | doSetup () |
| template<class ValueType> | |
| void | dummySet (ValueType test) |
| PyObject * | getAttribute (AttributeType type, std::string opalName) const |
| void | setAttribute (AttributeType type, std::string opalName, PyObject *value) |
| std::shared_ptr< C > | getOpalShared () |
| std::shared_ptr< C > | getOpalShared () const |
| PyOpalObject () | |
| void | doSetup () |
| PyOpalObject () | |
| void | doSetup () |
| void | doSetup () |
| void | doSetup () |
Static Protected Member Functions | |
| static boost::python::object | getFieldValue (PyOpalObjectNS::PyOpalObject< C > &pyobject, double x, double y, double z, double t) |
| static std::string | getOpalName (const PyOpalObject< C > &pyobject) |
| static void | setOpalName (PyOpalObject< C > &pyobject, std::string name) |
| static void | setOpalElementName (PyOpalObject< C > &pyobject, std::string name) |
| static void | execute (PyOpalObject< C > &pyobject) |
| static void | registerObject (PyOpalObject< C > &pyobject) |
| static boost::python::object | getPyOpalElement (PyOpalObject< C > &pyobject) |
| static boost::python::object | setAttributes (boost::python::tuple args, boost::python::dict kwargs) |
Protected Attributes | |
| std::shared_ptr< C > | object_m |
Static Protected Attributes | |
| static std::vector< AttributeDef > | attributes |
| static std::map< std::string, AttributeDef > | pyNameToAttribute |
| static std::string | classDocstring |
| static bool | converterRegistered |
| static double | distanceUnits_m |
| static double | timeUnits_m |
| static double | bfieldUnits_m |
| static double | efieldUnits_m |
| static const std::string | getFieldValueDocString |
PyOpalObject<C> is the basic wrapper class for Opal Objects
PyOpalObject<C> is a wrapper for an Opal Object C. Opal Attributes are implemented in python as properties (public member data). Some default method calls can be enabled in the concrete implementation by setting flags. Docstring can be enabled by setting classDocString.
element_m: pointer to the base element attributes: vector of attributes. The order of the vector is the order that attributes will appear in the docstring classDocString: overall docstring. docstrings on each property and method are added automatically by the framework.
property access is set up in make_class using add_property from boost::python. Normally, the "get" method can't take any data; this would mean that we can't pass an Attribute name for the OpalElement lookup. In order to get around this limitation, we have a "dummy" getter dummyGet. Then there is a "real" getter, which is hidden in the call policy for the property (a sort of pre- and post- decorator). We use PyOpalObjectGetProperty to hold the Attribute name and then dummyGet just tells PyElementGetProperty the address of the PyOpalObject. PyElementGetProperty does a postcall action to overwrite the return value with the "real" return value, based on the stored Attribute name.
Setters work in exactly the same way, except now we have dummySet and PyElementSetProperty to handle the interface.
The routine then looks like: python::boost calls dummyGet; dummyGet tells PyElementGetProperty pointer to PyOpalObject python::boost calls PyElementGetProperty.postcall PyElementGetProperty.postcall calls PyOpalObject->getAttribute; where getAttribute takes the name of the Attribute as a string. It's a bit of a faff.
Definition at line 138 of file PyOpalObject.h.
| typedef PyOpalObject<C> PyOpal::PyOpalObjectNS::PyOpalObject< C >::PyC |
Definition at line 140 of file PyOpalObject.h.
|
inline |
Default constructor
Definition at line 530 of file PyOpalObject.h.
References object_m.
Referenced by PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::execute(), execute(), PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getOpalName(), getOpalName(), PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::getPyOpalElement(), getPyOpalElement(), PyOpalObject(), PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::registerObject(), setAttributes(), PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setOpalElementName(), setOpalElementName(), PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setOpalName(), and setOpalName().
|
inline |
Constructor taking the element as argument
Definition at line 144 of file PyOpalObject.h.
References object_m.
| PyOpal::PyOpalObjectNS::PyOpalObject< C >::PyOpalObject | ( | const PyOpalObject< C > & | rhs | ) |
Copying is disabled
Definition at line 693 of file PyOpalObject.h.
References object_m, and PyOpalObject().
|
virtualdefault |
Default destructor
| PyOpal::PyOpalObjectNS::PyOpalObject< OpalElement >::PyOpalObject | ( | ) |
| PyOpal::PyOpalObjectNS::PyOpalObject< OpalElement >::PyOpalObject | ( | ) |
Definition at line 19 of file PyOpalElement.cpp.
References object_m.
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addAttributes | ( | PYCLASS & | pyclass | ) |
Add attributes to the python class.
Definition at line 820 of file PyOpalObject.h.
References attributes, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, dummyGet(), dummySet(), PyOpal::PyOpalObjectNS::FLOAT_LIST, getDocString(), PyOpal::PyOpalObjectNS::INT, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, pyNameToAttribute, PyOpal::PyOpalObjectNS::STRING, PyOpal::PyOpalObjectNS::STRING_LIST, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.
Referenced by make_generic_class().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addExecute | ( | PYCLASS & | pyclass | ) |
Add an "execute" method to the python class (e.g. if it is an ACTION)
Definition at line 761 of file PyOpalObject.h.
References execute().
Referenced by PyOpal::PyDistributionNS::BOOST_PYTHON_MODULE(), PyOpal::PyOptionNS::BOOST_PYTHON_MODULE(), and PyOpal::PyTrackRunNS::BOOST_PYTHON_MODULE().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addGetFieldValue | ( | PYCLASS & | pyclass, |
| double | distanceUnits, | ||
| double | timeUnits, | ||
| double | bfieldUnits, | ||
| double | efieldUnits ) |
Add a "get_field_value" method to the python class (for elements that expose a field)
PYCLASS: instance of the class to which the field is added
distanceUnits: set the distance units so that UI is in OPAL units
timeUnits: set the time units so that UI is in OPAL units
bfieldUnits: set the bfield units so that UI is in OPAL units
efieldUnits: set the efield units so that UI is in OPAL units
It is encouraged to expose the field map for field-type objects, for user to check that the field is as expected.
Note that conversion factors for units in distance, time, bfield and efield should be provided - the OPAL unit system should be exposed to user (see OPAL docs for current recommendation). Opal will call element->apply(R*distanceUnits, P, t*timeUnits, Efield, Bfield) and return Efield*efieldUnits, BField*bfield units.
Definition at line 805 of file PyOpalObject.h.
References bfieldUnits_m, distanceUnits_m, efieldUnits_m, getFieldValue(), getFieldValueDocString, and timeUnits_m.
Referenced by PyOpal::PyMultipoleT::BOOST_PYTHON_MODULE(), PyOpal::PyRingDefinition::BOOST_PYTHON_MODULE(), PyOpal::PyScalingFFAMagnet::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavity::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavityFringeField::BOOST_PYTHON_MODULE(), and PyOpal::PyVerticalFFAMagnet::BOOST_PYTHON_MODULE().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addGetOpalElement | ( | PYCLASS & | pyclass | ) |
Add a "get_opal_element" method to the python class (to overload as a PyOpalElement)
This is required for OpalElement objects, in order that they can be used in a OPAL line object (for setting up beamlines having multiple elements). In general, if C is an OpalElement, developer should call addGetOpalElement in the module setup function.
Definition at line 799 of file PyOpalObject.h.
References getPyOpalElement().
Referenced by PyOpal::PyLineNS::BOOST_PYTHON_MODULE(), and make_element_class().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addGetOpalName | ( | PYCLASS & | pyclass | ) |
Add a get_opal_name method to the python class (to get the opal internal string that uniquely identifies the object)
Definition at line 773 of file PyOpalObject.h.
References getOpalName().
Referenced by make_generic_class().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addRegister | ( | PYCLASS & | pyclass | ) |
Add a "register" method to the python class (to register against opal global data object)
Definition at line 767 of file PyOpalObject.h.
References registerObject().
Referenced by PyOpal::PyBeamNS::BOOST_PYTHON_MODULE().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addSetAttributes | ( | PYCLASS & | pyclass | ) |
Add a set_attributes method to the python class (to setup opalobject from a dictionary of kwargs)
Definition at line 779 of file PyOpalObject.h.
References setAttributes().
Referenced by make_generic_class().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addSetOpalElementName | ( | PYCLASS & | pyclass | ) |
Add a set_opal_name method to the python class (to set the opal internal string that uniquely identifies the object). This version has bindings specifically for OpalElements
Definition at line 793 of file PyOpalObject.h.
References setOpalElementName().
Referenced by make_element_class().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::addSetOpalName | ( | PYCLASS & | pyclass | ) |
Add a set_opal_name method to the python class (to set the opal internal string that uniquely identifies the object)
Definition at line 787 of file PyOpalObject.h.
References setOpalName().
Referenced by make_class().
|
protected |
Definition at line 12 of file PyAsymmetricEnge.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::FLOAT_LIST.
|
protected |
Definition at line 11 of file PyEnge.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::FLOAT_LIST.
|
protected |
Definition at line 11 of file PyGlobalCartesianOffset.cpp.
References attributes, and PyOpal::PyOpalObjectNS::DOUBLE.
|
protected |
Definition at line 11 of file PyLocalCartesianOffset.cpp.
References attributes, and PyOpal::PyOpalObjectNS::DOUBLE.
|
protected |
Definition at line 41 of file PyMultipoleT.cpp.
References attributes, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 11 of file PyOpalElement.cpp.
References attributes.
|
protected |
Definition at line 24 of file PyOutputPlane.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, PyOpal::PyOpalObjectNS::INT, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 11 of file PyPolynomialTimeDependence.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::FLOAT_LIST.
|
protected |
Definition at line 10 of file PyProbe.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 44 of file PyRingDefinition.cpp.
References attributes, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::INT.
|
protected |
Definition at line 39 of file PyScalingFFAMagnet.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::INT, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 28 of file PySinusoidalTimeDependence.cpp.
References attributes, and PyOpal::PyOpalObjectNS::FLOAT_LIST.
|
protected |
Definition at line 37 of file PySplineTimeDependence.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::FLOAT_LIST.
|
protected |
Definition at line 42 of file PyVariableRFCavity.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 43 of file PyVariableRFCavityFringeField.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 25 of file PyVerticalFFAMagnet.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::INT.
|
protected |
Definition at line 26 of file PyBeam.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::PREDEFINED_STRING.
|
protected |
Definition at line 25 of file PyDistribution.cpp.
References attributes, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 27 of file PyFieldSolver.cpp.
References attributes, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.
|
protected |
Definition at line 26 of file PyOption.cpp.
References attributes, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, and PyOpal::PyOpalObjectNS::PREDEFINED_STRING.
|
protected |
Definition at line 25 of file PyTrackCmd.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, and PyOpal::PyOpalObjectNS::STRING.
|
protected |
Definition at line 28 of file PyTrackRun.cpp.
References attributes, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, PyOpal::PyOpalObjectNS::STRING, and PyOpal::PyOpalObjectNS::STRING_LIST.
|
protected |
Definition at line 22 of file PyAsymmetricEnge.cpp.
References classDocstring.
|
protected |
Definition at line 18 of file PyEnge.cpp.
References classDocstring.
|
protected |
Definition at line 61 of file PyMultipoleT.cpp.
References classDocstring.
|
protected |
Definition at line 14 of file PyOpalElement.cpp.
References classDocstring.
|
protected |
Definition at line 45 of file PyOutputPlane.cpp.
References classDocstring.
|
protected |
Definition at line 20 of file PyPolynomialTimeDependence.cpp.
References classDocstring.
|
protected |
Definition at line 24 of file PyProbe.cpp.
References classDocstring.
|
protected |
Definition at line 29 of file PyRingDefinition.cpp.
References classDocstring.
|
protected |
Definition at line 57 of file PyScalingFFAMagnet.cpp.
References classDocstring.
|
protected |
Definition at line 36 of file PySinusoidalTimeDependence.cpp.
References classDocstring.
|
protected |
Definition at line 44 of file PySplineTimeDependence.cpp.
References classDocstring.
|
protected |
Definition at line 52 of file PyVariableRFCavity.cpp.
References classDocstring.
|
protected |
Definition at line 57 of file PyVariableRFCavityFringeField.cpp.
References classDocstring.
|
protected |
Definition at line 38 of file PyVerticalFFAMagnet.cpp.
References classDocstring.
|
protected |
Definition at line 42 of file PyTrackRun.cpp.
References classDocstring.
|
inlinevirtual |
Overload the method to perform any additional setup that can be made before the OpalObject is accessed, after OpalObject->update() is called.
Definition at line 258 of file PyOpalObject.h.
Referenced by PyOpal::PyMultipoleT::BOOST_PYTHON_MODULE(), PyOpal::PyScalingFFAMagnet::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavity::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavityFringeField::BOOST_PYTHON_MODULE(), and getFieldValue().
| void PyOpal::PyOpalObjectNS::PyOpalObject< OpalMultipoleT >::doSetup | ( | ) |
Overload this method on the PyOpalObject - it is supposed to be called every time the cavity is updated (i.e. every time get_field_value is called from python).
The point is the TimeDependence could have changed and we redo setup just in case (terribly inefficient, but only effects python side)
Definition at line 33 of file PyMultipoleT.cpp.
References MultipoleT::initialiseTimeDepencencies(), and object_m.
| void PyOpal::PyOpalObjectNS::PyOpalObject< OpalScalingFFAMagnet >::doSetup | ( | ) |
Overload this method on the PyOpalObject - it is supposed to be called every time the magnet is updated (i.e. every time get_field_value is called from python).
The point is the EndFieldModel could have changed and we redo setup just in case (terribly inefficient)
Definition at line 32 of file PyScalingFFAMagnet.cpp.
References object_m, and ScalingFFAMagnet::setupEndField().
| void PyOpal::PyOpalObjectNS::PyOpalObject< OpalVariableRFCavity >::doSetup | ( | ) |
Overload this method on the PyOpalObject - it is supposed to be called every time the cavity is updated (i.e. every time get_field_value is called from python).
The point is the TimeDependence could have changed and we redo setup just in case (terribly inefficient, but only effects python side)
Definition at line 34 of file PyVariableRFCavity.cpp.
References VariableRFCavity::initialise(), and object_m.
| void PyOpal::PyOpalObjectNS::PyOpalObject< OpalVariableRFCavityFringeField >::doSetup | ( | ) |
Overload this method on the PyOpalObject - it is supposed to be called every time the cavity is updated (i.e. every time get_field_value is called from python).
The point is the TimeDependence could have changed and we redo setup just in case (terribly inefficient, but only effects python side)
Definition at line 34 of file PyVariableRFCavityFringeField.cpp.
References VariableRFCavityFringeField::initialise(), and object_m.
|
inline |
dummyGet sets the object ptr for PyOpalObjectGetProperty but doesn't actually do the get(...)
Definition at line 253 of file PyOpalObject.h.
References PyOpal::PyOpalObjectNS::PyOpalObjectGetProperty< C >::setObject().
Referenced by addAttributes().
|
inline |
dummySet sets the element ptr for PyOpalObjectSetProperty but doesn't actually do the set(...)
Definition at line 347 of file PyOpalObject.h.
References PyOpal::PyOpalObjectNS::PyOpalObjectSetProperty< C >::setObject().
Referenced by addAttributes().
|
staticprotected |
method to call "execute" on an object
Definition at line 473 of file PyOpalObject.h.
References getOpalShared(), and PyOpalObject().
Referenced by addExecute().
| PyObject * PyOpal::PyOpalObjectNS::PyOpalObject< C >::getAttribute | ( | AttributeType | type, |
| std::string | opalName ) const |
Get the value of an attribute
type: the type expected for python
opalName: the name of the Opal Attribute Returns a PyObject holding data; INCREF is called on the object i.e. it is a new object, not borrowed.
It is an error if the Attribute does not exist (throws OpalException)
Definition at line 533 of file PyOpalObject.h.
References PyOpal::PyOpalObjectNS::attributeName, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, Attributes::getBool(), Attributes::getReal(), Attributes::getRealArray(), Attributes::getString(), Attributes::getStringArray(), PyOpal::PyOpalObjectNS::INT, object_m, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, PyOpal::PyOpalObjectNS::STRING, PyOpal::PyOpalObjectNS::STRING_LIST, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.
|
protected |
pointer to the element Generates a docstring from the attribute
Definition at line 697 of file PyOpalObject.h.
References PyOpal::PyOpalObjectNS::attributeName, PyOpal::PyOpalObjectNS::AttributeDef::docString_m, Attribute::getHelp(), object_m, PyOpal::PyOpalObjectNS::AttributeDef::opalName_m, PyOpal::PyOpalObjectNS::AttributeDef::pyName_m, and PyOpal::PyOpalObjectNS::AttributeDef::type_m.
Referenced by addAttributes().
|
staticprotected |
method to get field at a point in space-time
Definition at line 353 of file PyOpalObject.h.
References Component::apply(), bfieldUnits_m, distanceUnits_m, doSetup(), efieldUnits_m, getOpalShared(), and timeUnits_m.
Referenced by addGetFieldValue().
|
staticprotected |
method to get the opal name of an object
Definition at line 491 of file PyOpalObject.h.
References getOpalShared(), and PyOpalObject().
Referenced by addGetOpalName().
|
inline |
Returns the Opal Object from the PyOpalObject
Definition at line 286 of file PyOpalObject.h.
References object_m.
Referenced by execute(), PyOpal::PyTrackCmdNS::executeWrapper(), PyOpal::PyAbstractTimeDependence::function(), PyOpal::PyEndFieldModel::function(), getFieldValue(), getOpalName(), getPyOpalElement(), PyOpal::PyDistributionNS::registerDistribution(), PyOpal::PyFieldSolverNS::registerFieldSolver(), registerObject(), PyOpal::PyLine_< TBeamline< FlaggedElmPtr > >::setElement(), setOpalElementName(), setOpalName(), and PyOpal::PyOpalObjectNS::update().
|
inline |
Returns the Opal Object from the PyOpalObject (const version)
Definition at line 289 of file PyOpalObject.h.
References object_m.
|
staticprotected |
return the underlying element (used e.g. by PyLine)
Definition at line 512 of file PyOpalObject.h.
References getOpalShared(), and PyOpalObject().
Referenced by addGetOpalElement().
|
inline |
This is the basic method to make a class for OpalObjects. It should normally be called when the module is declared, BOOST_PYTHON_MODULE.
Note that while in principle this could be static, in the end we need an instance of C so that we can access the docString from the attribute.
Definition at line 745 of file PyOpalObject.h.
References addSetOpalName(), and make_generic_class().
Referenced by PyOpal::PyBeamNS::BOOST_PYTHON_MODULE(), PyOpal::PyDistributionNS::BOOST_PYTHON_MODULE(), PyOpal::PyEnge::BOOST_PYTHON_MODULE(), PyOpal::PyOpalPolynomialTimeDependence::BOOST_PYTHON_MODULE(), PyOpal::PyOpalSinusoidalTimeDependence::BOOST_PYTHON_MODULE(), PyOpal::PyOpalSplineTimeDependence::BOOST_PYTHON_MODULE(), PyOpal::PyOptionNS::BOOST_PYTHON_MODULE(), PyOpal::PyTrackCmdNS::BOOST_PYTHON_MODULE(), and PyOpal::PyTrackRunNS::BOOST_PYTHON_MODULE().
|
inline |
This is the basic method to make a class for elements.
This differs from make_class(...) because the setOpalName method sets the underlying element name at the same time.
Definition at line 752 of file PyOpalObject.h.
References addGetOpalElement(), addSetOpalElementName(), and make_generic_class().
Referenced by PyOpal::PyAsymmetricEnge::BOOST_PYTHON_MODULE(), PyOpal::PyMultipoleT::BOOST_PYTHON_MODULE(), PyOpal::PyOpalElement::BOOST_PYTHON_MODULE(), PyOpal::PyOpalGlobalCartesianOffset::BOOST_PYTHON_MODULE(), PyOpal::PyOpalLocalCartesianOffset::BOOST_PYTHON_MODULE(), PyOpal::PyOutputPlane::BOOST_PYTHON_MODULE(), PyOpal::PyProbe::BOOST_PYTHON_MODULE(), PyOpal::PyRingDefinition::BOOST_PYTHON_MODULE(), PyOpal::PyScalingFFAMagnet::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavity::BOOST_PYTHON_MODULE(), PyOpal::PyVariableRFCavityFringeField::BOOST_PYTHON_MODULE(), and PyOpal::PyVerticalFFAMagnet::BOOST_PYTHON_MODULE().
|
inline |
This is the basic method to make a class for generic Opal object type.
In this one, the setOpalName method is not assigned, and user has to assign it (if they want it)
Definition at line 711 of file PyOpalObject.h.
References addAttributes(), addGetOpalName(), addSetAttributes(), gmsg, and OpalException::what().
Referenced by make_class(), and make_element_class().
|
staticprotected |
method to call "register" on an object
Definition at line 479 of file PyOpalObject.h.
References OpalData::define(), OpalData::getInstance(), and getOpalShared().
Referenced by addRegister().
| void PyOpal::PyOpalObjectNS::PyOpalObject< C >::setAttribute | ( | AttributeType | type, |
| std::string | opalName, | ||
| PyObject * | value ) |
Set the value of an attribute
type: the type expected for python
opalName: the name of the Opal Attribute
value: Python object holding the value to be stored. value refcnt is not changed - caller is responsible for managing the refcnt. It is an error if the Attribute does not exist (throws OpalException)
Definition at line 610 of file PyOpalObject.h.
References PyOpal::PyOpalObjectNS::attributeName, PyOpal::PyOpalObjectNS::BOOL, PyOpal::PyOpalObjectNS::DOUBLE, PyOpal::PyOpalObjectNS::FLOAT_LIST, PyOpal::PyOpalObjectNS::INT, object_m, PyOpal::PyOpalObjectNS::PREDEFINED_STRING, Attributes::setBool(), Attributes::setPredefinedString(), Attributes::setReal(), Attributes::setRealArray(), Attributes::setString(), Attributes::setStringArray(), Attributes::setUpperCaseString(), PyOpal::PyOpalObjectNS::STRING, PyOpal::PyOpalObjectNS::STRING_LIST, and PyOpal::PyOpalObjectNS::UPPER_CASE_STRING.
Referenced by setAttributes().
|
staticprotected |
set many attributes at once as a dict, stored in kwarg. args should be exactly equal to (self,)
Pass a dictionary of attributes to the pyobject using the python *args **kwargs semantics
Definition at line 378 of file PyOpalObject.h.
References end(), PyOpal::PyOpalObjectNS::AttributeDef::opalName_m, pyNameToAttribute, PyOpalObject(), setAttribute(), and PyOpal::PyOpalObjectNS::AttributeDef::type_m.
Referenced by addSetAttributes().
|
staticprotected |
method to set the opal name of an element - elements have two "names", one belonging to the OpalObject and one belonging to the Component
Definition at line 503 of file PyOpalObject.h.
References getOpalShared(), name, and PyOpalObject().
Referenced by addSetOpalElementName().
|
staticprotected |
method to set the opal name of an object
Definition at line 497 of file PyOpalObject.h.
References getOpalShared(), name, and PyOpalObject().
Referenced by addSetOpalName().
|
staticprotected |
Definition at line 293 of file PyOpalObject.h.
Referenced by addAttributes(), and attributes().
|
staticprotected |
Definition at line 325 of file PyOpalObject.h.
Referenced by addGetFieldValue(), and getFieldValue().
|
staticprotected |
maps python name to AttributeDef for fast lookup
Definition at line 295 of file PyOpalObject.h.
Referenced by classDocstring().
|
staticprotected |
class docstring
Definition at line 296 of file PyOpalObject.h.
|
staticprotected |
Definition at line 323 of file PyOpalObject.h.
Referenced by addGetFieldValue(), and getFieldValue().
|
staticprotected |
Definition at line 326 of file PyOpalObject.h.
Referenced by addGetFieldValue(), and getFieldValue().
|
staticprotected |
Definition at line 327 of file PyOpalObject.h.
Referenced by addGetFieldValue().
|
protected |
set to true if the converter has been registered
Definition at line 297 of file PyOpalObject.h.
Referenced by doSetup(), getAttribute(), getDocString(), getOpalShared(), getOpalShared(), PyOpalObject(), PyOpalObject(), PyOpalObject(), and setAttribute().
|
staticprotected |
class data (attributes)
Definition at line 294 of file PyOpalObject.h.
Referenced by addAttributes(), and setAttributes().
|
staticprotected |
Definition at line 324 of file PyOpalObject.h.
Referenced by addGetFieldValue(), and getFieldValue().