//===----------------------------------------------------------------------===// // DuckDB // // duckdb/planner/bound_tableref.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/common/common.hpp" #include "duckdb/common/enums/tableref_type.hpp" #include "duckdb/parser/parsed_data/sample_options.hpp" namespace duckdb { class BoundTableRef { public: explicit BoundTableRef(TableReferenceType type) : type(type) { } virtual ~BoundTableRef() { } //! The type of table reference TableReferenceType type; //! The sample options (if any) unique_ptr sample; public: template TARGET &Cast() { if (type != TARGET::TYPE) { throw InternalException("Failed to cast bound table ref to type - table ref type mismatch"); } return reinterpret_cast(*this); } template const TARGET &Cast() const { if (type != TARGET::TYPE) { throw InternalException("Failed to cast bound table ref to type - table ref type mismatch"); } return reinterpret_cast(*this); } }; } // namespace duckdb