hqlattr.hpp 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 HQLATTR_HPP
  14. #define HQLATTR_HPP
  15. #include "hqlexpr.hpp"
  16. #include "workunit.hpp"
  17. #define MAX_MAXLENGTH (INFINITE_LENGTH-1)
  18. extern HQL_API IHqlExpression * queryAttribute(ITypeInfo * type, IAtom * search);
  19. extern HQL_API IHqlExpression * queryAttributeChild(ITypeInfo * type, IAtom * search, unsigned idx);
  20. extern HQL_API void cloneFieldModifier(Owned<ITypeInfo> & type, ITypeInfo * donorType, IAtom * attr);
  21. extern HQL_API ITypeInfo * cloneEssentialFieldModifiers(ITypeInfo * donor, ITypeInfo * rawtype);
  22. extern HQL_API ITypeInfo * removeProperty(ITypeInfo * type, IAtom * search);
  23. extern HQL_API size32_t getMinRecordSize(IHqlExpression * record);
  24. extern HQL_API size32_t getExpectedRecordSize(IHqlExpression * record);
  25. extern HQL_API unsigned getMaxRecordSize(IHqlExpression * record, unsigned defaultMaxRecordSize, bool & hasKnownSize, bool & usedDefault);
  26. extern HQL_API unsigned getMaxRecordSize(IHqlExpression * record, unsigned defaultMaxRecordSize);
  27. extern HQL_API bool maxRecordSizeUsesDefault(IHqlExpression * record); // wrapper around above.
  28. extern HQL_API bool maxRecordSizeIsAmbiguous(IHqlExpression * record, size32_t & specifiedSize, size32_t & derivedSize);
  29. extern HQL_API bool maxRecordSizeCanBeDerived(IHqlExpression * record);
  30. extern HQL_API bool reducesRowSize(IHqlExpression * expr);
  31. extern HQL_API bool increasesRowSize(IHqlExpression * expr);
  32. extern HQL_API bool isVariableSizeRecord(IHqlExpression * record);
  33. inline bool isFixedSizeRecord(IHqlExpression * record) { return !isVariableSizeRecord(record); }
  34. extern HQL_API bool recordRequiresLinkCount(IHqlExpression * expr);
  35. extern HQL_API bool recordRequiresDestructor(IHqlExpression * expr);
  36. extern HQL_API bool recordRequiresSerialization(IHqlExpression * expr, IAtom * serializeForm);
  37. extern HQL_API bool typeRequiresDeserialization(ITypeInfo * type, IAtom * serializeForm); // or can we use the serialized form directly
  38. extern HQL_API bool recordSerializationDiffers(IHqlExpression * expr, IAtom * serializeForm1, IAtom * serializeForm2);
  39. extern HQL_API IHqlExpression * getSerializedForm(IHqlExpression * expr, IAtom * variation);
  40. extern HQL_API ITypeInfo * getSerializedForm(ITypeInfo * type, IAtom * variation);
  41. extern HQL_API IHqlExpression * getPackedRecord(IHqlExpression * expr);
  42. //This returns a record that compares equal with another result if the normalized records will compare equal
  43. extern HQL_API IHqlExpression * getUnadornedRecordOrField(IHqlExpression * expr);
  44. extern HQL_API IHqlExpression * queryUID(IHqlExpression * expr);
  45. extern HQL_API IHqlExpression * querySelf(IHqlExpression * record);
  46. extern HQL_API IHqlExpression * queryNewSelector(node_operator op, IHqlExpression * datasetOrRow);
  47. extern HQL_API IHqlExpression * queryLocationIndependent(IHqlExpression * expr);
  48. extern HQL_API ITypeInfo * preserveTypeQualifiers(ITypeInfo * ownedType, IHqlExpression * donor);
  49. extern HQL_API bool preserveTypeQualifiers(HqlExprArray & args, ITypeInfo * donor);
  50. extern HQL_API IHqlExpression * preserveTypeQualifiers(IHqlExpression * ownedField, ITypeInfo * donor);
  51. extern unsigned getOperatorMetaFlags(node_operator op);
  52. extern HQL_API bool isLinkedRowset(ITypeInfo * t);
  53. extern HQL_API bool isArrayRowset(ITypeInfo * t);
  54. extern HQL_API bool hasLinkedRow(ITypeInfo * t);
  55. inline bool hasLinkCountedModifier(ITypeInfo * t) { return queryAttribute(t, _linkCounted_Atom) != NULL; }
  56. inline bool hasOutOfLineRows(ITypeInfo * type) { return (hasOutOfLineModifier(type) || hasLinkCountedModifier(type)); }
  57. inline bool hasLinkCountedModifier(IHqlExpression * expr) { return hasLinkCountedModifier(expr->queryType()); }
  58. inline bool hasStreamedModifier(ITypeInfo * t) { return queryAttribute(t, streamedAtom) != NULL; }
  59. inline bool isStreamed(IHqlExpression * expr) { return hasStreamedModifier(expr->queryType()); }
  60. extern HQL_API ITypeInfo * setLinkCountedAttr(ITypeInfo * _type, bool setValue);
  61. extern HQL_API ITypeInfo * setStreamedAttr(ITypeInfo * _type, bool setValue);
  62. extern HQL_API bool isSmallGrouping(IHqlExpression * sortlist);
  63. extern HQL_API void getRecordCountText(StringBuffer & result, IHqlExpression * expr);
  64. extern HQL_API IHqlExpression * queryRecordCountInfo(IHqlExpression * expr);
  65. extern HQL_API IHqlExpression * getRecordCountInfo(IHqlExpression * expr);
  66. extern HQL_API bool hasNoMoreRowsThan(IHqlExpression * expr, __int64 limit);
  67. extern HQL_API bool spillToWorkunitNotFile(IHqlExpression * expr, ClusterType platform);
  68. class CHqlMetaProperty;
  69. extern HQL_API CHqlMetaProperty * queryMetaProperty(IHqlExpression * expr);
  70. #endif