ToolInterface.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "Tool.h"
  2. #include "../../Common/DllToolCommon.h"
  3. DLL_TOOL_DESC m_Description;
  4. /// <summary>
  5. /// 获取工具描述
  6. /// </summary>
  7. /// <returns></returns>
  8. const DLL_TOOL_DESC& ToolImpl::Description()
  9. {
  10. // 生成dll描述
  11. m_Description.Type = TOOL_TYPE::TOOL_TYPE_STANDARD;
  12. m_Description.strCategory = ("数学工具");
  13. m_Description.strName = ("Arithmetic");
  14. m_Description.strVersion = ("3.0");
  15. m_Description.strInfo = ("数学运算");
  16. return m_Description;
  17. }
  18. /////////////////////////////////////////////////
  19. // 生成默认的接口描述
  20. // 2021-8-3备注,其实 withValue 参数没有任何意义,因为目前的设计里exe是不会保存tool中的任何值的
  21. // 全部的数据都保存在dll自身中
  22. void ToolImpl::InitDefaultInterfaces(bool withValue)
  23. {
  24. m_Interfaces.clear();
  25. // 接口
  26. DLL_INF inf;
  27. inf.strName = ("Value1");
  28. inf.Direction = INF_DIRECTION::INF_DIR_IN;
  29. inf.Type = INF_TYPE::INF_TYPE_STANDARD;
  30. inf.value.passMode = VALUE_PASS_MODE::PASS_BY_VALUE;
  31. inf.value.type = VALUE_TYPE::Type_Float;
  32. if (withValue)
  33. {
  34. inf.value.Ptr = (void**)&((ToolDialogImpl*)m_pDlgTool)->m_fInPutValue1;
  35. }
  36. // inf.bSmartLink = true;
  37. m_Interfaces.push_back(inf);
  38. inf.reset();//////////////////////////////////////////////////////////////////////////
  39. inf.strName = ("Value2");
  40. inf.Direction = INF_DIRECTION::INF_DIR_IN;
  41. inf.Type = INF_TYPE::INF_TYPE_STANDARD;
  42. inf.value.passMode = VALUE_PASS_MODE::PASS_BY_VALUE;
  43. inf.value.type = VALUE_TYPE::Type_Float;
  44. if (withValue)
  45. {
  46. inf.value.Ptr = (void**)&((ToolDialogImpl*)m_pDlgTool)->m_fInPutValue2;
  47. }
  48. // inf.bSmartLink = true;
  49. m_Interfaces.push_back(inf);
  50. inf.reset();//////////////////////////////////////////////////////////////////////////
  51. inf.strName = ("Value");
  52. inf.Direction = INF_DIRECTION::INF_DIR_OUT;
  53. inf.Type = INF_TYPE::INF_TYPE_STANDARD;
  54. inf.value.passMode = VALUE_PASS_MODE::PASS_BY_VALUE;
  55. inf.value.type = VALUE_TYPE::Type_Float;
  56. if (withValue)
  57. {
  58. inf.value.Ptr = (void**)&((ToolDialogImpl*)m_pDlgTool)->m_fOutPutValue;
  59. }
  60. // inf.bSmartLink = true;
  61. m_Interfaces.push_back(inf);
  62. inf.reset();//////////////////////////////////////////////////////////////////////////
  63. }