CivProjSmulResultCache.h 1.42 KB
Newer Older
刘乐's avatar
刘乐 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#pragma once
#include<string>
#include "CivSimuResStruct.h"
/**
*@brief 方案模拟结果缓存
*/
class CivProjSmulResultCache
{
public:
	CivProjSmulResultCache();
	~CivProjSmulResultCache();

	void setProjCode(const std::string& projCode) { mProjCode = projCode; }

	void addNodeHead(const std::string& nodeCode, float head);
	void addNodePressure(const std::string& nodeCode, float pressure);
	void addPipeFlow(const std::string& pipeSn, float flow);
	void addPipeVelcoity(const std::string& pipeSn, float velcocity);
	void addPipeHeadLoss(const std::string& pipeSn, float headLoss);

	void addProjNodeHead(const std::string& nodeCode, float head);
	void addProjNodePressure(const std::string& nodeCode, float pressure);
	void addProjPipeFlow(const std::string& pipeSn, float flow);
	void addProjPipeVelcoity(const std::string& pipeSn, float velcocity);
	void addProjPipeHeadLoss(const std::string& pipeSn, float headLoss);

	void addNodeItem(ProjNodeResultItem& nodeItem);

	void addPipeItem(PorjPipeResultItem& pipeItem);

	bool saveToUri(const std::string& dbUri, const std::string& time, const std::string& projCode);

	// 缓存code到sn的映射
	void getCodeToSnMap(const std::string& uri);

private:
	std::string mProjCode; // 方案编码

	std::map<std::string, ProjNodeResultItem> mNodeCache;
	std::map<std::string, PorjPipeResultItem> mPipeCache;

	std::map<std::string, std::string> mNodeCodeSnMap;
	std::map<std::string, std::string> mLineCodeSnMap;
};