roxierow.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 _ROXIEROW_INCL
  14. #define _ROXIEROW_INCL
  15. #include "thorhelper.hpp"
  16. #include "roxiemem.hpp"
  17. #include "eclhelper.hpp"
  18. extern THORHELPER_API IEngineRowAllocator * createRoxieRowAllocator(roxiemem::IRowManager & _rowManager, IOutputMetaData * _meta, unsigned _activityId, unsigned _allocatorId, roxiemem::RoxieHeapFlags flags);
  19. extern THORHELPER_API IEngineRowAllocator * createCrcRoxieRowAllocator(roxiemem::IRowManager & rowManager, IOutputMetaData * meta, unsigned activityId, unsigned allocatorId, roxiemem::RoxieHeapFlags flags);
  20. interface IRowAllocatorMetaActIdCache : extends roxiemem::IRowAllocatorCache
  21. {
  22. virtual IEngineRowAllocator *ensure(IOutputMetaData * meta, unsigned activityId, roxiemem::RoxieHeapFlags flags) = 0;
  23. virtual unsigned items() const = 0;
  24. };
  25. interface IRowAllocatorMetaActIdCacheCallback
  26. {
  27. virtual IEngineRowAllocator *createAllocator(IOutputMetaData *meta, unsigned activityId, unsigned cacheId, roxiemem::RoxieHeapFlags flags) const = 0;
  28. };
  29. extern THORHELPER_API IRowAllocatorMetaActIdCache *createRowAllocatorCache(IRowAllocatorMetaActIdCacheCallback *callback);
  30. extern THORHELPER_API bool isRowCheckValid(unsigned allocatorId, const void * row);
  31. //Inline call which avoids the call if no row checking is enabled.
  32. inline bool RoxieRowCheckValid(unsigned allocatorId, const void * row)
  33. {
  34. if (allocatorId & ALLOCATORID_CHECK_MASK)
  35. return isRowCheckValid(allocatorId, row);
  36. return true;
  37. }
  38. class RoxieRowLinkCounter : public CSimpleInterface, implements IRowLinkCounter
  39. {
  40. public:
  41. IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
  42. virtual void releaseRow(const void *row)
  43. {
  44. ReleaseRoxieRow(row);
  45. }
  46. virtual void linkRow(const void *row)
  47. {
  48. LinkRoxieRow(row);
  49. }
  50. };
  51. #endif