hqlfunc.ipp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef BUILDFUNC_IPP
  14. #define BUILDFUNC_IPP
  15. class FunctionParamInfo : implements IFunctionParamInfo, public CInterface
  16. {
  17. public:
  18. FunctionParamInfo(ITypeInfo * type, IAtom * name, unsigned _dir, bool _isArray);
  19. ~FunctionParamInfo();
  20. IMPLEMENT_IINTERFACE
  21. //interface IFunctionParamInfo
  22. virtual ITypeInfo * queryType() const;
  23. StringBuffer & generateCpp(StringBuffer & out);
  24. public:
  25. enum { ParamIn = 1, ParamOut=2, ParamInOut=3 };
  26. protected:
  27. ITypeInfo * type;
  28. IAtom * name;
  29. unsigned dir;
  30. bool isArray;
  31. };
  32. class FunctionInfo : implements IFunctionInfo, public CInterface
  33. {
  34. public:
  35. FunctionInfo(IAtom * _name, IModuleInfo * _module);
  36. ~FunctionInfo();
  37. IMPLEMENT_IINTERFACE
  38. //interface IFunctionInfo
  39. virtual StringBuffer & generateCpp(StringBuffer & out);
  40. virtual unsigned getNumParameters();
  41. virtual const char * queryCppName();
  42. virtual IModuleInfo * queryModule();
  43. virtual IAtom * queryName();
  44. virtual IFunctionParamInfo * queryParam(unsigned idx);
  45. virtual ITypeInfo * queryReturnType();
  46. void addParameter(FunctionParamInfo & info) { params.append(info); }
  47. void setName(const char * _cppname);
  48. void setReturnType(ITypeInfo * type);
  49. protected:
  50. IAtom * name;
  51. StringAttr cppName;
  52. CIArray params;
  53. ITypeInfo * returnType;
  54. IModuleInfo * module;
  55. };
  56. class ModuleInfo : implements IModuleInfo, public CInterface
  57. {
  58. public:
  59. ModuleInfo(const char * _filename, bool _isSystem);
  60. IMPLEMENT_IINTERFACE
  61. virtual StringBuffer & getName(StringBuffer & out);
  62. virtual bool inLibrary();
  63. virtual bool isSystem();
  64. protected:
  65. StringAttr filename;
  66. bool systemModule;
  67. };
  68. class FunctionDatabase : implements IFunctionDatabase, public CInterface
  69. {
  70. public:
  71. FunctionDatabase();
  72. IMPLEMENT_IINTERFACE
  73. //interface IFunctionDatabase
  74. virtual IFunctionInfo * queryFunction(unsigned idx);
  75. virtual IFunctionInfo * queryFunction(IAtom * name);
  76. virtual IModuleInfo * queryModule(unsigned idx);
  77. void addFunction(FunctionInfo & info) { functions.append(info); }
  78. void addModule(ModuleInfo & info) { modules.append(info); }
  79. protected:
  80. CIArray modules;
  81. CIArray functions;
  82. };
  83. #endif