mkql_node_cast.h 969 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "mkql_node.h"
  3. #include <util/system/src_location.h>
  4. #define AS_VALUE(type, node) ::NKikimr::NMiniKQL::AsValue<type>((node), __LOCATION__)
  5. #define AS_TYPE(type, node) ::NKikimr::NMiniKQL::AsType<type>((node), __LOCATION__)
  6. #define AS_CALLABLE(name, node) ::NKikimr::NMiniKQL::AsCallable(TStringBuf(name), node, __LOCATION__)
  7. namespace NKikimr {
  8. namespace NMiniKQL {
  9. template <typename T>
  10. T* AsValue(TRuntimeNode node, const TSourceLocation& location);
  11. template <typename T>
  12. T* AsType(TType* type, const TSourceLocation& location);
  13. template <typename T>
  14. const T* AsType(const TType* type, const TSourceLocation& location);
  15. template <typename T>
  16. T* AsType(TRuntimeNode node, const TSourceLocation& location) {
  17. return AsType<T>(node.GetStaticType(), location);
  18. }
  19. TCallable* AsCallable(
  20. const TStringBuf& name,
  21. TRuntimeNode node,
  22. const TSourceLocation& location);
  23. } // namespace NMiniKQL
  24. } // namespace NKikimr