OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
Classes | Enumerations | Functions | Variables
PyOpal::PyOpalObjectNS Namespace Reference

Classes

class  PyOpalObject
 
struct  PyOpalObjectGetProperty
 
struct  PyOpalObjectSetProperty
 
struct  AttributeDef
 

Enumerations

enum  AttributeType {
  STRING, PREDEFINED_STRING, UPPER_CASE_STRING, STRING_LIST,
  DOUBLE, BOOL, INT, FLOAT_LIST
}
 

Functions

template<class C >
void update (PyOpalObjectNS::PyOpalObject< C > pyelement)
 

Variables

std::map< AttributeType,
std::string > 
attributeName
 

Detailed Description

PyOpalObjectNS namespace contains PyOpalObject, a wrapper for Object objects, and various supporting objects.

PyOpalObject<C>: basic element wrapper for C, which should be a subclass of OpalElement. AttributeType: enumeration of Opal Attribute Types (real, string, etc) AttributeDef: struct containing all of the things PyOpalObject needs to know about each attribute that should be exposed to the python api. PyElementGetProperty: call policy to handle access of an Attribute for a python property PyElementSetProperty: call policy to handle setting of an Attribute for a python property

To wrap an OpalElement, say MyOpalObjectClass, you need to:

  1. Define static member data for the PyOpalObject<MyOpalObjectClass>. This includes defining the attributes and setting a few options for different methods to expose.
  2. In BOOST_PYTHON_MODULE(my_opal_element_module), call
     PyOpalObject<MyOpalObjectType>.make_class()
    

Nb: apologies, this is heavy template stuff so almost everything has to go in the header file.

Enumeration Type Documentation

AttributeType is used to control conversion from python to OpalAttribute

  • Float will convert to RealAttribute
  • String will convert to StringAttribute
  • Bool will convert to BoolAttribute (tho in python Bool is alias to long)
  • Long will convert to RealAttribute
  • VectorDouble will convert list to RealArray
Enumerator
STRING 
PREDEFINED_STRING 
UPPER_CASE_STRING 
STRING_LIST 
DOUBLE 
BOOL 
INT 
FLOAT_LIST 

Definition at line 80 of file PyOpalObject.h.

Function Documentation

template<class C >
void PyOpal::PyOpalObjectNS::update ( PyOpalObjectNS::PyOpalObject< C >  pyelement)

Variable Documentation

std::map< AttributeType, std::string > PyOpal::PyOpalObjectNS::attributeName