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
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphDaemon/GDaemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class GDaemon : public GDaemonObject {

friend class GDaemonManager;
friend class GPipeline;
friend class GStorage;

private:
UTimer timer_; // 计时器
Expand Down
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphDaemon/GDaemonManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class GDaemonManager : public GDaemonObject,

friend class GPipeline;
friend class CAllocator;
friend class GStorage;
CGRAPH_NO_ALLOWED_COPY(GDaemonManager)

private:
Expand Down
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphDaemon/GDaemonObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class GDaemonObject : public GraphObject,
friend class GDaemon;
friend class GDaemonManager;
friend class GPipeline;
friend class GStorage;

private:
GParamManagerPtr param_manager_ = nullptr; // GParam参数管理类
Expand Down
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphParam/GParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class GParam : public GParamObject {
USpinLock backtrace_lock_; // 针对backtrace的自旋锁

friend class GParamManager;
friend class GStorage;
};

using GParamPtr = GParam *;
Expand Down
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphParam/GParamManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class GParamManager : public GParamObject,

friend class GPipeline;
friend class CAllocator;
friend class GStorage;

public:
/// 为 python 版本设定的函数,cpp 的童鞋不需要使用
Expand Down
308 changes: 216 additions & 92 deletions src/GraphCtrl/GraphPipeline/_GStroage/GStorage.cpp

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions src/GraphCtrl/GraphPipeline/_GStroage/GStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
CGRAPH_NAMESPACE_BEGIN

class GPipeline;
class GElement;

class GStorage : public GraphObject {
protected:
Expand All @@ -42,6 +41,22 @@ class GStorage : public GraphObject {
CGRAPH_NO_ALLOWED_COPY(GStorage)

private:
/**
* 构建 pipeline storage
* @param pipeline
* @param storage
* @return
*/
static CStatus buildPipelineStorage(GPipeline* pipeline, _GPipelineStorage& storage);

/**
* 将 storage 存储到 buffer 中
* @param storage
* @param path
* @return
*/
static CStatus saveBuffer(const _GPipelineStorage& storage, const std::string& path);

/**
* 从 buffer 中加载并还原pipeline 数据信息
* @param pipeline
Expand All @@ -50,10 +65,11 @@ class GStorage : public GraphObject {
* @return
*/
static CStatus loadBuffer(GPipeline* pipeline, char* buffer, CSize size);

static CStatus loadElement(GPipeline* pipeline, const _GPipelineStorage& storage);

static CStatus loadEvent(GPipeline* pipeline, const _GPipelineStorage& storage);
static CStatus loadParam(GPipeline* pipeline, const _GPipelineStorage& storage);
static CStatus loadDaemon(GPipeline* pipeline, const _GPipelineStorage& storage);
static CStatus loadStage(GPipeline* pipeline, const _GPipelineStorage& storage);

static CStatus loadAspect(GElementPtr element, const std::vector<_GAspectStorage>& aspStorages);

Expand Down
48 changes: 44 additions & 4 deletions src/GraphCtrl/GraphPipeline/_GStroage/GStorageDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,57 @@ struct _GEventStorage : public CStruct {
explicit _GEventStorage() = default;
explicit _GEventStorage(const std::string& key, const std::string& clz) {
key_ = key;
event_clz_name_ = clz;
clz_name_ = clz;
}

std::string key_ {};
std::string event_clz_name_ {};
std::string clz_name_ {};
};

struct _GAspectStorage : public CStruct {
explicit _GAspectStorage() = default;
explicit _GAspectStorage(const std::string& clz) {
aspect_clz_name_ = clz;
clz_name_ = clz;
}

std::string aspect_clz_name_ {};
std::string clz_name_ {};
};

struct _GDaemonStorage : public CStruct {
explicit _GDaemonStorage() = default;
explicit _GDaemonStorage(CMSec msec, const std::string& clz) {
msec_ = msec;
clz_name_ = clz;
}

CMSec msec_ {0};
std::string clz_name_ {};
};

struct _GStageStorage : public CStruct {
explicit _GStageStorage() = default;
explicit _GStageStorage(const std::string& key, CInt threshold, const std::string& clz) {
key_ = key;
threshold_ = threshold;
clz_name_ = clz;
}

std::string key_ {};
CInt threshold_ {0};
std::string clz_name_ {};
};

struct _GParamStorage : public CStruct {
explicit _GParamStorage() = default;
explicit _GParamStorage(const std::string& key, CBool backtrace, const std::string& clz) {
key_ = key;
backtrace_ = backtrace;
clz_name_ = clz;
}

std::string key_ {};
std::string clz_name_ {};
CBool backtrace_ { false };
};

struct _GElementStorage : public CStruct {
Expand Down Expand Up @@ -112,6 +149,9 @@ struct _GElementStorage : public CStruct {
struct _GPipelineStorage : public CStruct {
std::vector<_GElementStorage> element_storages_ {}; // 记录pipeline中所有 element 的信息
std::vector<_GEventStorage> event_storages_ {}; // 记录pipeline中所有 event 的信息
std::vector<_GParamStorage> param_storages_ {}; // 记录pipeline中所有 gparam 的信息
std::vector<_GDaemonStorage> daemon_storages_ {}; // 记录pipeline中所有 daemon 的信息
std::vector<_GStageStorage> stage_storages_ {}; // 记录pipeline中所有 stage 的信息
UThreadPoolConfig thread_pool_config_ {}; // 记录线程池配置信息
};

Expand Down
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphStage/GStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class GStage : public GStageObject {
friend class GStageManager;
friend class CAllocator;
friend class GPipeline;
friend class GStorage;
};

using GStagePtr = GStage *;
Expand Down
1 change: 1 addition & 0 deletions src/GraphCtrl/GraphStage/GStageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class GStageManager : public GStageObject,

friend class GPipeline;
friend class GElement;
friend class GStorage;

private:
CStatus __create_4py(GStagePtr stage, const std::string& key, CInt threshold) {
Expand Down
Loading