hqlfunc.ipp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #ifndef BUILDFUNC_IPP
  15. #define BUILDFUNC_IPP
  16. class FunctionParamInfo : public CInterface, implements IFunctionParamInfo
  17. {
  18. public:
  19. FunctionParamInfo(ITypeInfo * type, _ATOM name, unsigned _dir, bool _isArray);
  20. ~FunctionParamInfo();
  21. IMPLEMENT_IINTERFACE
  22. //interface IFunctionParamInfo
  23. virtual ITypeInfo * queryType() const;
  24. StringBuffer & generateCpp(StringBuffer & out);
  25. public:
  26. enum { ParamIn = 1, ParamOut=2, ParamInOut=3 };
  27. protected:
  28. ITypeInfo * type;
  29. _ATOM name;
  30. unsigned dir;
  31. bool isArray;
  32. };
  33. class FunctionInfo : public CInterface, implements IFunctionInfo
  34. {
  35. public:
  36. FunctionInfo(_ATOM _name, IModuleInfo * _module);
  37. ~FunctionInfo();
  38. IMPLEMENT_IINTERFACE
  39. //interface IFunctionInfo
  40. virtual StringBuffer & generateCpp(StringBuffer & out);
  41. virtual unsigned getNumParameters();
  42. virtual const char * queryCppName();
  43. virtual IModuleInfo * queryModule();
  44. virtual _ATOM queryName();
  45. virtual IFunctionParamInfo * queryParam(unsigned idx);
  46. virtual ITypeInfo * queryReturnType();
  47. void addParameter(FunctionParamInfo & info) { params.append(info); }
  48. void setName(const char * _cppname);
  49. void setReturnType(ITypeInfo * type);
  50. protected:
  51. _ATOM name;
  52. StringAttr cppName;
  53. CIArray params;
  54. ITypeInfo * returnType;
  55. IModuleInfo * module;
  56. };
  57. class ModuleInfo : public CInterface, implements IModuleInfo
  58. {
  59. public:
  60. ModuleInfo(const char * _filename, bool _isSystem);
  61. IMPLEMENT_IINTERFACE
  62. virtual StringBuffer & getName(StringBuffer & out);
  63. virtual bool inLibrary();
  64. virtual bool isSystem();
  65. protected:
  66. StringAttr filename;
  67. bool systemModule;
  68. };
  69. class FunctionDatabase : public CInterface, implements IFunctionDatabase
  70. {
  71. public:
  72. FunctionDatabase();
  73. IMPLEMENT_IINTERFACE
  74. //interface IFunctionDatabase
  75. virtual IFunctionInfo * queryFunction(unsigned idx);
  76. virtual IFunctionInfo * queryFunction(_ATOM name);
  77. virtual IModuleInfo * queryModule(unsigned idx);
  78. void addFunction(FunctionInfo & info) { functions.append(info); }
  79. void addModule(ModuleInfo & info) { modules.append(info); }
  80. protected:
  81. CIArray modules;
  82. CIArray functions;
  83. };
  84. #endif