Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions python/PyCGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ PYBIND11_MODULE(pycgraph, cg) {

py::class_<GAspect, PywGAspect, std::unique_ptr<GAspect, py::nodelete> >(cg, "GAspect")
.def(py::init<>())
.def("getName", &GAspect::__getName_4py)
.def("getName", &GAspect::__getName_4expose)
.PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(GAspect)
.PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(GAspect);

py::class_<GDaemon, PywGDaemon, std::unique_ptr<GDaemon, py::nodelete> >(cg, "GDaemon")
.def(py::init<>())
.def("getInterval", &GDaemon::__getInterval_4py)
.def("getInterval", &GDaemon::__getInterval_4expose)
.PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(GDaemon)
.PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(GDaemon);

Expand Down Expand Up @@ -212,15 +212,15 @@ PYBIND11_MODULE(pycgraph, cg) {
py::arg("runTimes") = 1,
py::call_guard<py::gil_scoped_release>())
.def("destroy", &GPipeline::destroy)
.def("addGEvent", &GPipeline::__addGEvent_4py,
.def("addGEvent", &GPipeline::__addGEvent_4expose,
py::arg("event"),
py::arg("key"),
py::keep_alive<1, 2>())
.def("addGDaemon", &GPipeline::__addGDaemon_4py,
.def("addGDaemon", &GPipeline::__addGDaemon_4expose,
py::arg("daemon"),
py::arg("ms"),
py::keep_alive<1, 2>())
.def("addGStage", &GPipeline::__addGStage_4py,
.def("addGStage", &GPipeline::__addGStage_4expose,
py::arg("stage"),
py::arg("key"),
py::arg("threshold"),
Expand All @@ -238,17 +238,17 @@ PYBIND11_MODULE(pycgraph, cg) {
py::call_guard<py::gil_scoped_release>())
.def("resume", &GPipeline::resume,
py::call_guard<py::gil_scoped_release>())
.def("perf", &GPipeline::__perf_4py,
.def("perf", &GPipeline::__perf_4expose,
py::call_guard<py::gil_scoped_release>())
.def("dump", &GPipeline::__dump_4py)
.def("dump", &GPipeline::__dump_4expose)
.def("trim", &GPipeline::trim)
.def("makeSerial", &GPipeline::makeSerial)
.def("getMaxPara", &GPipeline::getMaxPara)
.def("getCurState", &GPipeline::getCurState)
.def("checkSeparate", &GPipeline::checkSeparate,
py::arg("fst"),
py::arg("snd"))
.def("registerGElement", &GPipeline::__registerGElement_4py,
.def("registerGElement", &GPipeline::__registerGElement_4expose,
py::arg("element"),
py::arg("depends") = GElementPtrSet{},
py::arg("name") = CGRAPH_EMPTY,
Expand Down Expand Up @@ -278,10 +278,10 @@ PYBIND11_MODULE(pycgraph, cg) {

py::class_<GElement, PywGElement, std::unique_ptr<GElement, py::nodelete> >(cg, "GElement")
.def(py::init<>())
.def("__str__", &GElement::__str_4py)
.def("__str__", &GElement::__str_4expose)
.PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(GElement)
.PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(GElement)
.def("enterStage", &GElement::__enterStage_4py,
.def("enterStage", &GElement::__enterStage_4expose,
py::arg("key"),
py::call_guard<py::gil_scoped_release>())
.def("getName", &GElement::getName)
Expand All @@ -302,11 +302,11 @@ PYBIND11_MODULE(pycgraph, cg) {
.def("setTimeout", &GElement::setTimeout,
py::arg("timeout"),
py::arg("strategy") = GElementTimeoutStrategy::AS_ERROR)
.def("isTimeout", &GElement::__isTimeout_4py)
.def("isTimeout", &GElement::__isTimeout_4expose)
.def("isGGroup", &GElement::isGGroup)
.def("isGAdaptor", &GElement::isGAdaptor)
.def("isGNode", &GElement::isGNode)
.def("addGAspect", &GElement::__addGAspect_4py,
.def("addGAspect", &GElement::__addGAspect_4expose,
py::arg("aspect"),
py::keep_alive<1, 2>())
.def("addDependGElements", &GElement::addDependGElements,
Expand Down
1 change: 1 addition & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
Extension(
name=__PYCGRAPH_NAME__,
sources=_sources,
define_macros=[("CGRAPH_EXPOSE_INTERNALS", None)],
extra_compile_args=_extra_compile_args,
include_dirs=_include_dirs,
extra_link_args=_extra_link_args,
Expand Down
16 changes: 8 additions & 8 deletions python/wrapper/PyWrapperMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,38 +49,38 @@ protected:
.def(py::init<const GElementPtrArr&>(), \
py::arg("elements") = GElementPtrArr{}, \
py::keep_alive<1, 2>()) \
.def("addGElements", &Pyw##PCGG::__addGElements_4py, \
.def("addGElements", &Pyw##PCGG::__addGElements_4expose, \
py::arg("elements"), \
py::keep_alive<1, 2>()) \
\


#define PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(PCGO) \
def("createGParam", &PCGO::__createGParam_4py, \
def("createGParam", &PCGO::__createGParam_4expose, \
py::arg("param"), \
py::arg("key"), \
py::keep_alive<1, 2>(), \
py::call_guard<py::gil_scoped_release>()) \
.def("getGParam", &PCGO::__getGParam_4py, \
.def("getGParam", &PCGO::__getGParam_4expose, \
py::arg("key")) \
.def("getGParamWithNoEmpty", &PCGO::__getGParamWithNoEmpty_4py, \
.def("getGParamWithNoEmpty", &PCGO::__getGParamWithNoEmpty_4expose, \
py::arg("key")) \
.def("removeGParam", &PCGO::__removeGParam_4py, \
.def("removeGParam", &PCGO::__removeGParam_4expose, \
py::arg("key"), \
py::call_guard<py::gil_scoped_release>()) \
.def("hasGParam", &PCGO::__hasGParam_4py, \
.def("hasGParam", &PCGO::__hasGParam_4expose, \
py::arg("key"), \
py::call_guard<py::gil_scoped_release>()) \
\


#define PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(PCGO) \
def("notify", &PCGO::__notify_4py, \
def("notify", &PCGO::__notify_4expose, \
py::arg("key"), \
py::arg("type"), \
py::arg("strategy") = GEventAsyncStrategy::PIPELINE_RUN_FINISH, \
py::call_guard<py::gil_scoped_release>()) \
.def("asyncNotify", &PCGO::__asyncNotify_4py, \
.def("asyncNotify", &PCGO::__asyncNotify_4expose, \
py::arg("key"), \
py::arg("strategy") = GEventAsyncStrategy::PIPELINE_RUN_FINISH, \
py::call_guard<py::gil_scoped_release>()) \
Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class PywGCluster : public CGraph::GCluster {
public:
explicit PywGCluster(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
__addGElements_4py(elements);
__addGElements_4expose(elements);
}

~PywGCluster() override = default;
Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class PywGCondition : public CGraph::GCondition {
public:
explicit PywGCondition(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
__addGElements_4py(elements);
__addGElements_4expose(elements);
}
~PywGCondition() override = default;

Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGMutable.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class PywGMutable : public CGraph::GMutable {
public:
explicit PywGMutable(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
__addGElements_4py(elements);
__addGElements_4expose(elements);
}
~PywGMutable() override = default;

Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGParallelMultiCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class PywGParallelMultiCondition : public CGraph::GMultiCondition<CGraph::GMultiConditionType::PARALLEL> {
public:
explicit PywGParallelMultiCondition(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
CGraph::GMultiCondition<CGraph::GMultiConditionType::PARALLEL>::__addGElements_4py(elements);
CGraph::GMultiCondition<CGraph::GMultiConditionType::PARALLEL>::__addGElements_4expose(elements);
};

~PywGParallelMultiCondition() override = default;
Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGRegion.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class PywGRegion : public CGraph::GRegion {
public:
explicit PywGRegion(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
__addGElements_4py(elements);
__addGElements_4expose(elements);
};

~PywGRegion() override = default;
Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGSerialMultiCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class PywGSerialMultiCondition : public CGraph::GMultiCondition<CGraph::GMultiConditionType::SERIAL> {
public:
explicit PywGSerialMultiCondition(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
CGraph::GMultiCondition<CGraph::GMultiConditionType::SERIAL>::__addGElements_4py(elements);
CGraph::GMultiCondition<CGraph::GMultiConditionType::SERIAL>::__addGElements_4expose(elements);
};

~PywGSerialMultiCondition() override = default;
Expand Down
2 changes: 1 addition & 1 deletion python/wrapper/PywGSome.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class PywGSome : public CGraph::GSome {
public:
explicit PywGSome(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
__addGElements_4py(elements);
__addGElements_4expose(elements);
}
~PywGSome() override = default;

Expand Down
4 changes: 2 additions & 2 deletions src/GraphCtrl/GraphAspect/GAspectObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class GAspectObject : public GraphObject,
friend class GAspect;
friend class GElement;

public:
const std::string& __getName_4py() const {
CGRAPH_INTERNAL_ACCESS:
const std::string& __getName_4expose() const {
return getName();
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphDaemon/GDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CMSec GDaemon::modify(GDaemonParamPtr param) {
}


CMSec GDaemon::__getInterval_4py() const {
CMSec GDaemon::__getInterval_4expose() const {
return getInterval();
}

Expand Down
4 changes: 2 additions & 2 deletions src/GraphCtrl/GraphDaemon/GDaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class GDaemon : public GDaemonObject {
UTimer timer_; // 计时器


public:
CMSec __getInterval_4py() const;
CGRAPH_INTERNAL_ACCESS:
CMSec __getInterval_4expose() const;
};

using GDaemonPtr = GDaemon *;
Expand Down
8 changes: 4 additions & 4 deletions src/GraphCtrl/GraphElement/GElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ GElementPtr GElement::updateAspectInfo() {
}


GElementPtr GElement::__addGAspect_4py(GAspectPtr aspect) {
GElementPtr GElement::__addGAspect_4expose(GAspectPtr aspect) {
CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(aspect)
if (!aspect_manager_) {
aspect_manager_ = CGRAPH_SAFE_MALLOC_COBJECT(GAspectManager)
Expand All @@ -652,17 +652,17 @@ GElementPtr GElement::__addGAspect_4py(GAspectPtr aspect) {
}


CStatus GElement::__enterStage_4py(const std::string& key) {
CStatus GElement::__enterStage_4expose(const std::string& key) {
return enterStage(key);
}


CBool GElement::__isTimeout_4py() {
CBool GElement::__isTimeout_4expose() {
return isTimeout();
}


std::string GElement::__str_4py() {
std::string GElement::__str_4expose() {
// python 中 print 展示的格式
std::string info = "<name=" + this->getName() +
", session=" + this->getSession() + ", loop=" + std::to_string(this->getLoop());
Expand Down
10 changes: 5 additions & 5 deletions src/GraphCtrl/GraphElement/GElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,11 @@ class GElement : public GElementObject,
CGRAPH_DECLARE_GEVENT_MANAGER_WRAPPER_WITH_MEMBER
CGRAPH_DECLARE_GSTAGE_MANAGER_WRAPPER_WITH_MEMBER

public:
GElement* __addGAspect_4py(GAspectPtr aspect);
CStatus __enterStage_4py(const std::string& key);
CBool __isTimeout_4py();
std::string __str_4py();
CGRAPH_INTERNAL_ACCESS:
GElement* __addGAspect_4expose(GAspectPtr aspect);
CStatus __enterStage_4expose(const std::string& key);
CBool __isTimeout_4expose();
std::string __str_4expose();
};

using GElementRef = GElement &;
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphElement/GGroup/GGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ CBool GGroup::isSeparate(GElementCPtr a, GElementCPtr b) const {
}


CStatus GGroup::__addGElements_4py(const GElementPtrArr& elements) {
CStatus GGroup::__addGElements_4expose(const GElementPtrArr& elements) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_ASSERT_INIT(false)
for (auto* element : elements) {
Expand Down
4 changes: 2 additions & 2 deletions src/GraphCtrl/GraphElement/GGroup/GGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class GGroup : public GElement {
template<GMultiConditionType> friend class GMultiCondition;
friend class GSome;

public:
CStatus __addGElements_4py(const GElementPtrArr& elements);
CGRAPH_INTERNAL_ACCESS:
CStatus __addGElements_4expose(const GElementPtrArr& elements);
};

using GGroupPtr = GGroup *;
Expand Down
6 changes: 3 additions & 3 deletions src/GraphCtrl/GraphEvent/GEventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CGRAPH_NAMESPACE_BEGIN

CStatus GEventManager::init() {
CGRAPH_FUNCTION_BEGIN
for (auto& iter : events_map_) {
for (const auto& iter : events_map_) {
// fatInit 中包含了init(),和部分其他逻辑
auto event = iter.second;
event->setGParamManager(param_manager_);
Expand All @@ -24,7 +24,7 @@ CStatus GEventManager::init() {

CStatus GEventManager::destroy() {
CGRAPH_FUNCTION_BEGIN
for (auto& iter : events_map_) {
for (const auto& iter : events_map_) {
status += (iter.second)->fatDestroy();
}
CGRAPH_FUNCTION_END
Expand Down Expand Up @@ -90,7 +90,7 @@ CStatus GEventManager::reset() {
}


CStatus GEventManager::__create_4py(GEventPtr event, const std::string& key) {
CStatus GEventManager::__create_4expose(GEventPtr event, const std::string& key) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(event)
CGRAPH_RETURN_ERROR_STATUS_BY_CONDITION(events_map_.find(key) != events_map_.end(),
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphEvent/GEventManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class GEventManager : public GEventObject,
friend class GStorage;

private:
CStatus __create_4py(GEventPtr event, const std::string& key);
CStatus __create_4expose(GEventPtr event, const std::string& key);
};

using GEventManagerPtr = GEventManager *;
Expand Down
6 changes: 3 additions & 3 deletions src/GraphCtrl/GraphEvent/GEventManagerWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ CGRAPH_NAMESPACE_BEGIN
return this->event_manager_->asyncTrigger(key, strategy); \
} \
\
public: \
CStatus __notify_4py(const std::string& key, GEventType type, \
CGRAPH_INTERNAL_ACCESS: \
CStatus __notify_4expose(const std::string& key, GEventType type, \
GEventAsyncStrategy strategy = GEventAsyncStrategy::PIPELINE_RUN_FINISH) { \
return this->notify(key, type, strategy); \
} \
\
std::shared_future<CVoid> __asyncNotify_4py(const std::string& key, \
std::shared_future<CVoid> __asyncNotify_4expose(const std::string& key, \
GEventAsyncStrategy strategy = GEventAsyncStrategy::PIPELINE_RUN_FINISH) { \
return asyncNotify(key, strategy); \
} \
Expand Down
4 changes: 2 additions & 2 deletions src/GraphCtrl/GraphMessage/GMessageDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ CGRAPH_NAMESPACE_BEGIN
using GMessagePushStrategy = URingBufferPushStrategy;

CGRAPH_INTERNAL_NAMESPACE_BEGIN
static const char* PUB_SUB_PREFIX = "PS_PRE_";
static const char* SEND_RECV_PREFIX = "SR_PRE_";
static auto PUB_SUB_PREFIX = "PS_PRE_";
static auto SEND_RECV_PREFIX = "SR_PRE_";
CGRAPH_INTERNAL_NAMESPACE_END

CGRAPH_NAMESPACE_END
Expand Down
8 changes: 4 additions & 4 deletions src/GraphCtrl/GraphParam/GParamManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ std::vector<std::string> GParamManager::getKeys() {
}


CStatus GParamManager::__create_4py(GParamPtr param, const std::string& key) {
CStatus GParamManager::__create_4expose(GParamPtr param, const std::string& key) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_LOCK_GUARD lock(this->mutex_);
const auto& iter = params_map_.find(key);
Expand All @@ -115,7 +115,7 @@ CStatus GParamManager::__create_4py(GParamPtr param, const std::string& key) {
}


GParamPtr GParamManager::__get_4py(const std::string& key) {
GParamPtr GParamManager::__get_4expose(const std::string& key) {
const auto& iter = params_map_.find(key);
if (iter == params_map_.end()) {
return nullptr;
Expand All @@ -125,7 +125,7 @@ GParamPtr GParamManager::__get_4py(const std::string& key) {
}


CStatus GParamManager::__remove_4py(const std::string& key) {
CStatus GParamManager::__remove_4expose(const std::string& key) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_LOCK_GUARD lock(this->mutex_);
const auto& iter = params_map_.find(key);
Expand All @@ -139,7 +139,7 @@ CStatus GParamManager::__remove_4py(const std::string& key) {
}


CBool GParamManager::__has_4py(const std::string& key) {
CBool GParamManager::__has_4expose(const std::string& key) {
CGRAPH_LOCK_GUARD lock(this->mutex_);
return params_map_.find(key) != params_map_.end();
}
Expand Down
Loading
Loading