📄 ipsntp.h
字号:
#ifndef _IPSNTP_H
#define _IPSNTP_H
#include <map>
#include <set>
#include <vector>
#include <string>
using namespace std;
#ifdef _WINDOWS32
//#ifdef DLL_OUT
#define PSNTP_API __declspec(dllexport)
//#else
// #define PSNTP_API __declspec(dllimport)
//#endif
#else
#define PSNTP_API
#endif
namespace NM_PSNTP
{
typedef int StId_T;
typedef int VlId_T;
typedef int DevId_T;
typedef int NodeName_T;
typedef NodeName_T NodePair_T[2];
enum SwitchType{SWITCH_TYPE_BRK = 0, SWITCH_TYPE_DISCR = 1, SWITCH_TYPE_GDDISCR = 2};
struct Dev_T
{
DevId_T m_id;
StId_T m_st;
VlId_T m_vl;
};
struct Term_T : public Dev_T
{
NodeName_T m_nd;
};
struct PTerm_T : public Term_T
{
};
struct STerm_T : public Term_T
{
DevId_T m_link_dev_id;
};
struct Trwd_T : public STerm_T
{
NodeName_T m_neu_nd;
};
struct KvBranch_T : public Dev_T
{
NodePair_T m_nd_pair;
};
struct KvTriNdDev_T : public Dev_T
{
NodeName_T m_nd_arr[3];
};
template <class T>
struct Section_T : public pair<T const*, T const*>
{
};
struct DevType_T
{
DevId_T m_id;
SwitchType switch_type;
};
struct AllDevice_T
{
Section_T<PTerm_T> m_gn_sec;
Section_T<PTerm_T> m_ld_sec;
Section_T<PTerm_T> m_bsbar_sec;
Section_T<PTerm_T> m_gddiscr_sec;
Section_T<PTerm_T> m_other_pterm_sec;
Section_T<STerm_T> m_dot_sec;
Section_T<Trwd_T> m_trwd_sec;
Section_T<KvBranch_T> m_brk_sec;
Section_T<KvBranch_T> m_discr_sec;
Section_T<KvBranch_T> m_other_branch_sec;
Section_T<KvTriNdDev_T> m_kvtrind_dev_sec;
};
typedef int BsNo_T;
typedef int BsDegNo_T;
typedef int IslandNo_T;
typedef unsigned char IslandColorNo_T;
enum SpecialColorNo{ISLAND_COLOR_MAINISLAND = 1, ISLAND_COLOR_NOPOWER = 0, ISLAND_COLOR_GROUND = IslandColorNo_T(-1), ISLAND_COLOR_EQUIVOCAL_GROUND = IslandColorNo_T(-2)};
typedef int SubBsNo_T;
enum GraphModelType{GRAPH_MODEL_NODE = 0, GRAPH_MODEL_BS = 1, GRAPH_MODEL_SUBBS = 2, GRAPH_MODEL_PRIM_BS = 3, GRAPH_MODEL_PRIM_SUBBS = 4};
enum InvalidOpType{INVALID_DEV_ID = 0, INVALID_GROUND_OP = 1, INVALID_DISCR_OP = 2, DANGEROUS_GROUND_OP = 11, DANGEROUS_DISCR_OP = 12, IMPROPER_OP_SEQUENCE = 21,DANGEROUS_BRK_OP};
struct BayResult_T
{
Section_T<NodeName_T> m_in_nd_sec;
Section_T<NodeName_T> m_end_nd_sec;
Section_T<DevId_T> m_brk_sec;
Section_T<DevId_T> m_discr_sec;
Section_T<DevId_T> m_gddiscr_sec;
Section_T<DevId_T> m_other_dev_sec;
bool m_is_buslink;
};
class IPsntp
{
public:
//Update model
virtual int UpdateModel(const AllDevice_T&) = 0;
//static info
virtual int GetBypassBar(vector<DevId_T>&) = 0;
virtual int GetBusLinker(vector<DevId_T> &) = 0;
virtual int GetNormalControl(vector<pair<DevId_T, DevId_T> >&) = 0;
virtual int GetBayInfo(vector<BayResult_T> &) = 0;
virtual bool IsBypassBar(const DevId_T) = 0;
virtual bool IsBusLinker(const DevId_T) = 0;
virtual int GetNormalControl(vector<DevId_T> &, const NodeName_T) = 0;
virtual int GetBayInfo(BayResult_T &, const NodeName_T) = 0;
//set mode
virtual int ResetAllCbOpen() = 0;
virtual int SetAllCbOpen() = 0;
virtual int ResetAllCbOpen(const SwitchType cb_type,bool update_mode = true) = 0;
virtual int SetAllCbOpen(const SwitchType cb_type,bool update_mode = true) = 0;
virtual int ResetCbOpen(const SwitchType, const DevId_T) = 0;
virtual int SetCbOpen(const SwitchType, const DevId_T) = 0;
virtual int ResetCbOpen(const map<SwitchType, vector<DevId_T> >&,bool update_mode = true) = 0;
virtual int SetCbOpen(const map<SwitchType, vector<DevId_T> >&,bool update_mode = true) = 0;
virtual int ResetCbOpen(const vector<DevType_T>& open_cb_vec,bool update_mode = true) = 0;
virtual int SetCbOpen(const vector<DevType_T>& open_cb_vec,bool update_mode = true) = 0;
virtual int SetAndResetCbOpen(const vector<DevType_T>& open_cb_vecs,const vector<DevType_T>& close_cb_vecs,bool update_mode)= 0;
virtual int SetGround(const vector<NodeName_T>&) = 0;
virtual int SetShort(const pair<NodeName_T, NodeName_T> &) = 0;
virtual int SetGround(const vector<PTerm_T>&,bool clear_flag = false) = 0;
virtual int RemoveGround(vector<PTerm_T> ) = 0;
virtual void SetPower(vector<NodeName_T> &)=0;//dynamic info
virtual int GetBusIslandResult(map<NodeName_T, pair<BsNo_T, IslandNo_T> >&, vector<BsDegNo_T>&, vector<IslandColorNo_T>&) = 0;
virtual int GetSubBusResult(map<NodeName_T, SubBsNo_T>&) = 0;
virtual int GetControlResult(vector<pair<DevId_T, DevId_T> >&) = 0;
virtual int GetControlResult(vector<DevId_T> &, const NodeName_T) = 0;
virtual IslandColorNo_T GetQcolorOfNode(const NodeName_T) = 0;
//operation validation
virtual int OpValidationCheck(InvalidOpType&, string &msg, const SwitchType, const DevId_T,vector<DevId_T> &,vector<DevId_T> &gddiscr_dev_vec,int topo_mode = 0,bool isScDev = false) = 0;
// virtual int OpDiscrValidationCheck(InvalidOpType& valid_code, string & msg, const SwitchType type, const DevId_T dev,vector<DevId_T> &need_verify_dev_vec);
// virtual int OpGddiscrValidationCheck(InvalidOpType& valid_code, string & msg, const SwitchType type, const DevId_T dev,vector<DevId_T> &need_verify_dev_vec)=0;
// virtual int OpBrkValidationCheck(InvalidOpType& valid_code, string & msg, const SwitchType type, const DevId_T dev,vector<DevId_T> &need_verify_dev_vec)=0;
// virtual int SearchSpecialTypeDevs(const NodeName_T node,set<int> dev_type_vec,vector<DevId_T> &dev_vec,vector<DevId_T>&term_vec,const set<int> &stop_dev_type =set<int>(),const set<int> &bs_node_set = set<int>(),DevId_T dev_id = -1,bool judge_state=false,bool isReadDevVec = false)=0;
virtual int SearchSpecialTypeDevs(const NodeName_T node,set<int> dev_type_vec,vector<DevId_T> &dev_vec,vector<DevId_T>&term_vec,const set<int> &stop_dev_type =set<int>(),const set<int> &bs_node_set = set<int>(),DevId_T dev_id = -1,bool judge_state=false,bool isReadDevVec = false)=0;
virtual int GetSupplyRange(set<int> &supply_dev_vec,const set<int> &dev_vec =set<int>())=0;
virtual void SetBusLinkBrk(set<DevId_T> &brk_set) = 0;
//low-level functions
virtual int GetConnection(vector<DevId_T>&, vector<DevId_T>&, const NodeName_T&, const GraphModelType) = 0;
// virtual int SearchRoute(vector<DevId_T> &, const pair<NodeName_T, NodeName_T>&, const GraphModelType, const set<DevId_T> & = set<DevId_T>()) = 0;
virtual int SearchRoute(vector<DevId_T> &, const pair<NodeName_T, NodeName_T>&, const GraphModelType, const set<DevId_T> & = set<DevId_T>()) = 0;
virtual int GetTrees(vector<DevId_T>&, const GraphModelType) = 0;
virtual void Release() = 0;
virtual ~IPsntp() {};
};
class IPsntpFactory
{
public :
virtual int CreatePsntp(IPsntp** ppObj) = 0;
virtual int Release() = 0;
};
};
int PSNTP_API DllGetPsntpFactoryObject(NM_PSNTP::IPsntpFactory ** ppObj);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -