iceberg-cpp
Loading...
Searching...
No Matches
Namespaces | Macros
visitor_generate.h File Reference

Define macros for generating type visitors. More...

Go to the source code of this file.

Namespaces

namespace  iceberg
 Core Apache Iceberg C++ APIs.
 

Macros

#define ICEBERG_GENERATE_FOR_ALL_TYPES(ACTION)
 
#define ICEBERG_TYPE_SWITCH_WITH_PRIMITIVE_DEFAULT(ACTION)
 Generate switch-case for schema visitor pattern.
 

Detailed Description

Define macros for generating type visitors.

Macro Definition Documentation

◆ ICEBERG_GENERATE_FOR_ALL_TYPES

#define ICEBERG_GENERATE_FOR_ALL_TYPES (   ACTION)
Value:
ACTION(Boolean); \
ACTION(Int); \
ACTION(Long); \
ACTION(Float); \
ACTION(Double); \
ACTION(Decimal); \
ACTION(Date); \
ACTION(Time); \
ACTION(Timestamp); \
ACTION(TimestampTz); \
ACTION(TimestampNs); \
ACTION(TimestampTzNs); \
ACTION(String); \
ACTION(Uuid); \
ACTION(Fixed); \
ACTION(Binary); \
ACTION(Unknown); \
ACTION(Variant); \
ACTION(Geometry); \
ACTION(Geography); \
ACTION(Struct); \
ACTION(List); \
ACTION(Map);

◆ ICEBERG_TYPE_SWITCH_WITH_PRIMITIVE_DEFAULT

#define ICEBERG_TYPE_SWITCH_WITH_PRIMITIVE_DEFAULT (   ACTION)
Value:
case ::iceberg::TypeId::kStruct: \
ACTION(Struct) \
case ::iceberg::TypeId::kList: \
ACTION(List) \
case ::iceberg::TypeId::kMap: \
ACTION(Map) \
case ::iceberg::TypeId::kVariant: \
ACTION(Variant) \
default: \
ACTION(Primitive)

Generate switch-case for schema visitor pattern.

This macro generates switch cases that dispatch to visitor methods based on type:

  • Struct types -> calls ACTION with Struct
  • List types -> calls ACTION with List
  • Map types -> calls ACTION with Map
  • Variant type -> calls ACTION with Variant
  • All primitive types (default) -> calls ACTION with Primitive

Variant is dispatched explicitly because it is neither a nested nor a primitive type, so it must not be routed into the primitive default (which would cast it to PrimitiveType).