123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #pragma once
- #include "Common.h"
- /// <summary>
- /// 工具仓库类,用于从dll中加载所有的工具信息
- /// 本项目中将工具的静态信息和动态信息分开定义
- /// </summary>
- class ToolDepository
- {
- public:
- ToolDepository();
- virtual ~ToolDepository();
- // 加载文件中保存的工具信息
- bool LoadTools();
- // 获取指定DLL的指针
- DllTool* GetToolPtr(const QString& strToolName);
- // 2022-10-4,查询指定Dll的全路径
- QString GetDllPathByName(const QString& strToolName);
- // 直接获取输出Port
- const STATIC_TOOL* GetOutputPort() const
- {
- return &m_toolPortOutput;
- }
- // 直接获取输出Port
- const STATIC_TOOL* GetInputPort() const
- {
- return &m_toolPortInput;
- }
- // 通过名称获取工具的指针
- TOOL* getToolByName(QString strName);
- //// 检测Tool的有效性
- //bool ValidateTool(const TOOL& toolInfo);
- public:
- QVector<TOOL_CATEGORY> m_TotalTools; // 工具箱中所有的工具
- protected:
- // 从文件中加载工具信息
- bool LoadFromFile(const QString& strPath);
- // 从dll中提取工具信息
- bool ParseToolsFromDll(const QString& strDllPath, const QString& strDllName);
- // 将工具信息添加到Category中
- bool AddToCategory(const STATIC_TOOL& newTool, const QString& strCategoryName);
- // 2021-3-29增加,直接在内部生成port工具,不从外部加载了
- void createPortTool();
- // 2022-3-13 生成内置注释工具
- void createCommentTool();
- // 2022-3-22 生成内置的Goto工具
- void createGotoTool();
- // 2022-4-18 生成内置的并行计算工具
- void createParallelTool();
- // 2022-8-22 生成内置的For循环工具
- void createForLoopTool();
- // 2022-9-2 生成内置的等待Event工具
- void createWaitTool();
- protected:
- // 内部直接生成的port工具
- STATIC_TOOL m_toolPortOutput;
- STATIC_TOOL m_toolPortInput;
- // 2022-3-13 内置的注释工具
- STATIC_TOOL m_toolComment;
- // 2022-3-22 内置的Goto工具
- STATIC_TOOL m_toolGoto;
- // 2022-4-18 内置的并行计算工具
- STATIC_TOOL m_toolParallel;
- // 2022-8-22 内置的For循环工具
- STATIC_TOOL m_toolForLoop;
- // 2022-9-2 内置的Wait工具
- STATIC_TOOL m_toolWait;
- // 存储标准工具对应的Dll路径,用于快速检索
- QHash<QString, QString> m_toolDllPaths;
- };
|