Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::TypeVisitor Struct Reference

Static Public Member Functions

template<class F >
static bool Contains (const LogicalType &type, F &&predicate)
 
static bool Contains (const LogicalType &type, LogicalTypeId type_id)
 
template<class F >
static LogicalType VisitReplace (const LogicalType &type, F &&func)
 

Member Function Documentation

◆ Contains() [1/2]

template<class F >
bool duckdb::TypeVisitor::Contains ( const LogicalType type,
F &&  predicate 
)
inlinestatic
13051 {
13052 if (predicate(type)) {
13053 return true;
13054 }
13055 switch (type.id()) {
13056 case LogicalTypeId::STRUCT: {
13057 if (!type.AuxInfo()) {
13058 return false;
13059 }
13060 for (const auto &child : StructType::GetChildTypes(type)) {
13061 if (Contains(child.second, predicate)) {
13062 return true;
13063 }
13064 }
13065 return false;
13066 }
13067 case LogicalTypeId::UNION:
13068 if (!type.AuxInfo()) {
13069 return false;
13070 }
13071 for (idx_t i = 0; i < UnionType::GetMemberCount(type); i++) {
13072 if (Contains(UnionType::GetMemberType(type, i), predicate)) {
13073 return true;
13074 }
13075 }
13076 return false;
13077 case LogicalTypeId::LIST:
13078 if (!type.AuxInfo()) {
13079 return false;
13080 }
13081 return Contains(ListType::GetChildType(type), predicate);
13082 case LogicalTypeId::ARRAY:
13083 if (!type.AuxInfo()) {
13084 return false;
13085 }
13086 return Contains(ArrayType::GetChildType(type), predicate);
13087 case LogicalTypeId::MAP:
13088 if (!type.AuxInfo()) {
13089 return false;
13090 }
13091 return Contains(MapType::KeyType(type), predicate) || Contains(MapType::ValueType(type), predicate);
13092 default:
13093 return false;
13094 }
13095}

◆ Contains() [2/2]

bool duckdb::TypeVisitor::Contains ( const LogicalType type,
LogicalTypeId  type_id 
)
inlinestatic
13097 {
13098 return Contains(type, [&](const LogicalType &ty) { return ty.id() == type_id; });
13099}

◆ VisitReplace()

template<class F >
LogicalType duckdb::TypeVisitor::VisitReplace ( const LogicalType type,
F &&  func 
)
inlinestatic
13001 {
13002 switch (type.id()) {
13003 case LogicalTypeId::STRUCT: {
13004 if (!type.AuxInfo()) {
13005 return func(type);
13006 }
13007 auto children = StructType::GetChildTypes(type);
13008 for (auto &child : children) {
13009 child.second = VisitReplace(child.second, func);
13010 }
13011 return func(LogicalType::STRUCT(children));
13012 }
13013 case LogicalTypeId::UNION: {
13014 if (!type.AuxInfo()) {
13015 return func(type);
13016 }
13017 auto children = UnionType::CopyMemberTypes(type);
13018 for (auto &child : children) {
13019 child.second = VisitReplace(child.second, func);
13020 }
13021 return func(LogicalType::UNION(children));
13022 }
13023 case LogicalTypeId::LIST: {
13024 if (!type.AuxInfo()) {
13025 return func(type);
13026 }
13027 const auto &child = ListType::GetChildType(type);
13028 return func(LogicalType::LIST(VisitReplace(child, func)));
13029 }
13030 case LogicalTypeId::ARRAY: {
13031 if (!type.AuxInfo()) {
13032 return func(type);
13033 }
13034 const auto &child = ArrayType::GetChildType(type);
13035 return func(LogicalType::ARRAY(VisitReplace(child, func), ArrayType::GetSize(type)));
13036 }
13037 case LogicalTypeId::MAP: {
13038 if (!type.AuxInfo()) {
13039 return func(type);
13040 }
13041 const auto &key = MapType::KeyType(type);
13042 const auto &value = MapType::ValueType(type);
13043 return func(LogicalType::MAP(VisitReplace(key, func), VisitReplace(value, func)));
13044 }
13045 default:
13046 return func(type);
13047 }
13048}

The documentation for this struct was generated from the following file: