#ifndef P4P_H #define P4P_H #include #include #include #include #include #include #include #include #include #ifdef READONLY // don't want def from shareLib.h # undef READONLY #endif #include #if PY_MAJOR_VERSION < 3 // quiet some warnings about implicit const char* -> char* cast // for API functions. These are corrected in py >= 3.x #ifndef PyObject_CallFunction # define PyObject_CallFunction(O, FMT, ...) PyObject_CallFunction(O, (char*)(FMT), ##__VA_ARGS__) # define PyObject_CallMethod(O, METH, FMT, ...) PyObject_CallMethod(O, (char*)(METH), (char*)(FMT), ##__VA_ARGS__) #endif #endif // handle -fvisibility=default // effects generated _p4p.cpp #if __GNUC__ >= 4 # undef PyMODINIT_FUNC # if PY_MAJOR_VERSION < 3 # define PyMODINIT_FUNC extern "C" __attribute__ ((visibility("default"))) void # else # define PyMODINIT_FUNC extern "C" __attribute__ ((visibility("default"))) PyObject* # endif #endif // avoid numpy deprecation warnings when building with cython >= 3.0 #if CYTHON_HEX_VERSION>=0x03000000 # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #endif namespace p4p { using namespace pvxs; typedef epicsGuard Guard; typedef epicsGuardRelease UnGuard; struct SB { std::ostringstream strm; operator std::string() { return strm.str(); } template SB& operator<<(const T& v) { strm< &op, PyObject *handler); void detachCleanup(const std::shared_ptr &op); std::shared_ptr createDynamic(PyObject* handler); void disconnectDynamic(const std::shared_ptr& src); /******* client *******/ std::function opHandler(PyObject *handler); template void opHandler(Builder& builder, PyObject *handler) { builder.result(opHandler(handler)); } std::function opBuilder(PyObject *handler); template void opBuilder(Builder& builder, PyObject *handler) { builder.build(opBuilder(handler)); } void opEvent(client::MonitorBuilder& builder, PyObject *handler); PyObject* monPop(const std::shared_ptr& mon); /******* odometer (testing tool) *******/ std::shared_ptr makeOdometer(const std::string& name); } // namespace p4p #endif // P4P_H