11#include <boost/python/bases.hpp>
12#include <boost/python/class.hpp>
13#include <boost/python/copy_const_reference.hpp>
14#include <boost/python/register_ptr_to_python.hpp>
15#include <boost/python/return_value_policy.hpp>
35 register_ptr_to_python<std::shared_ptr<DataItem>>();
37 class_<DataItem, boost::noncopyable>(
"DataItem", no_init)
38 .def(
"id", &
DataItem::id, arg(
"self"),
"The string ID of the class")
40 return_value_policy<copy_const_reference>())
42 "Returns true if the object "
43 "can be accessed safely from "
45 .def(
"readLock", &readLock, arg(
"self"),
"Acquires a read lock on the data item.")
46 .def(
"unlock", &unlock, arg(
"self"),
"Unlocks a read or write lock on the data item.")
47 .def(
"__str__", &
DataItem::getName, arg(
"self"),
"Returns the string name of the object if it has been stored",
48 return_value_policy<copy_const_reference>())
49 .def(
"__repr__", &
DataItem::toString, arg(
"self"),
"Returns a description of the object");
#define GET_POINTER_SPECIALIZATION(TYPE)
This class forms the base class of any item that wishes to be stored in the analysis data service.
virtual const std::string & getName() const =0
The name of the object.
void readLock()
Acquires a read lock.
virtual const std::string toString() const =0
Serializes the object to a string.
virtual const std::string id() const =0
A string ID for the class.
virtual bool threadSafe() const =0
Can this object be accessed from multiple threads safely.
Defines a structure for releasing the Python GIL using the RAII pattern.