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::GeometryTypeSet Class Reference

Public Member Functions

bool IsEmpty () const
 
bool IsUnknown () const
 
void Add (GeometryType geom_type, VertexType vert_type)
 
void Merge (const GeometryTypeSet &other)
 
void Clear ()
 
bool HasOnly (GeometryType geom_type, VertexType vert_type) const
 
bool HasSingleType () const
 
bool TryGetSingleType (GeometryType &geom_type, VertexType &vert_type) const
 
void AddWKBType (int32_t wkb_type)
 
vector< int32_tToWKBList () const
 
vector< string > ToString (bool snake_case) const
 

Static Public Member Functions

static GeometryTypeSet Unknown ()
 
static GeometryTypeSet Empty ()
 

Public Attributes

uint8_t sets [VERT_TYPES]
 

Static Public Attributes

static constexpr auto VERT_TYPES = 4
 
static constexpr auto PART_TYPES = 8
 

Member Function Documentation

◆ Unknown()

static GeometryTypeSet duckdb::GeometryTypeSet::Unknown ( )
inlinestatic
15690 {
15691 GeometryTypeSet result;
15692 for (idx_t i = 0; i < VERT_TYPES; i++) {
15693 result.sets[i] = 0xFF;
15694 }
15695 return result;
15696 }

◆ Empty()

static GeometryTypeSet duckdb::GeometryTypeSet::Empty ( )
inlinestatic
15697 {
15698 GeometryTypeSet result;
15699 for (idx_t i = 0; i < VERT_TYPES; i++) {
15700 result.sets[i] = 0;
15701 }
15702 return result;
15703 }

◆ IsEmpty()

bool duckdb::GeometryTypeSet::IsEmpty ( ) const
inline
15705 {
15706 for (idx_t i = 0; i < VERT_TYPES; i++) {
15707 if (sets[i] != 0) {
15708 return false;
15709 }
15710 }
15711 return true;
15712 }

◆ IsUnknown()

bool duckdb::GeometryTypeSet::IsUnknown ( ) const
inline
15714 {
15715 for (idx_t i = 0; i < VERT_TYPES; i++) {
15716 if (sets[i] != 0xFF) {
15717 return false;
15718 }
15719 }
15720 return true;
15721 }

◆ Add()

void duckdb::GeometryTypeSet::Add ( GeometryType  geom_type,
VertexType  vert_type 
)
inline
15723 {
15724 const auto vert_idx = static_cast<uint8_t>(vert_type);
15725 const auto geom_idx = static_cast<uint8_t>(geom_type);
15726 D_ASSERT(vert_idx < VERT_TYPES);
15727 D_ASSERT(geom_idx < PART_TYPES);
15728 sets[vert_idx] |= (1 << geom_idx);
15729 }
::uint8_t uint8_t

◆ Merge()

void duckdb::GeometryTypeSet::Merge ( const GeometryTypeSet other)
inline
15731 {
15732 for (idx_t i = 0; i < VERT_TYPES; i++) {
15733 sets[i] |= other.sets[i];
15734 }
15735 }

◆ Clear()

void duckdb::GeometryTypeSet::Clear ( )
inline
15737 {
15738 for (idx_t i = 0; i < VERT_TYPES; i++) {
15739 sets[i] = 0;
15740 }
15741 }

◆ HasOnly()

bool duckdb::GeometryTypeSet::HasOnly ( GeometryType  geom_type,
VertexType  vert_type 
) const
inline

Check if only the given geometry and vertex type is present (all others are absent)

15745 {
15746 const auto vert_idx = static_cast<uint8_t>(vert_type);
15747 const auto geom_idx = static_cast<uint8_t>(geom_type);
15748 D_ASSERT(vert_idx < VERT_TYPES);
15749 D_ASSERT(geom_idx < PART_TYPES);
15750 for (uint8_t v_idx = 0; v_idx < VERT_TYPES; v_idx++) {
15751 for (uint8_t g_idx = 1; g_idx < PART_TYPES; g_idx++) {
15752 if (v_idx == vert_idx && g_idx == geom_idx) {
15753 if (!(sets[v_idx] & (1 << g_idx))) {
15754 return false;
15755 }
15756 } else {
15757 if (sets[v_idx] & (1 << g_idx)) {
15758 return false;
15759 }
15760 }
15761 }
15762 }
15763 return true;
15764 }

◆ HasSingleType()

bool duckdb::GeometryTypeSet::HasSingleType ( ) const
inline
15766 {
15767 idx_t type_count = 0;
15768 for (uint8_t v_idx = 0; v_idx < VERT_TYPES; v_idx++) {
15769 for (uint8_t g_idx = 1; g_idx < PART_TYPES; g_idx++) {
15770 if (sets[v_idx] & (1 << g_idx)) {
15771 type_count++;
15772 if (type_count > 1) {
15773 return false;
15774 }
15775 }
15776 }
15777 }
15778 return type_count == 1;
15779 }

◆ TryGetSingleType()

bool duckdb::GeometryTypeSet::TryGetSingleType ( GeometryType &  geom_type,
VertexType &  vert_type 
) const
inline
15781 {
15782 auto result_geom = GeometryType::INVALID;
15783 auto result_vert = VertexType::XY;
15784 auto result_found = false;
15785
15786 for (uint8_t v_idx = 0; v_idx < VERT_TYPES; v_idx++) {
15787 for (uint8_t g_idx = 1; g_idx < PART_TYPES; g_idx++) {
15788 if (sets[v_idx] & (1 << g_idx)) {
15789 if (result_found) {
15790 // Multiple types found
15791 return false;
15792 }
15793 result_found = true;
15794 result_geom = static_cast<GeometryType>(g_idx);
15795 result_vert = static_cast<VertexType>(v_idx);
15796 }
15797 }
15798 }
15799 if (result_found) {
15800 geom_type = result_geom;
15801 vert_type = result_vert;
15802 }
15803 return result_found;
15804 }

◆ AddWKBType()

void duckdb::GeometryTypeSet::AddWKBType ( int32_t  wkb_type)
inline
15806 {
15807 const auto vert_idx = static_cast<uint8_t>((wkb_type / 1000) % 10);
15808 const auto geom_idx = static_cast<uint8_t>(wkb_type % 1000);
15809 D_ASSERT(vert_idx < VERT_TYPES);
15810 D_ASSERT(geom_idx < PART_TYPES);
15811 sets[vert_idx] |= (1 << geom_idx);
15812 }

◆ ToWKBList()

vector< int32_t > duckdb::GeometryTypeSet::ToWKBList ( ) const
inline
15814 {
15815 vector<int32_t> result;
15816 for (uint8_t vert_idx = 0; vert_idx < VERT_TYPES; vert_idx++) {
15817 for (uint8_t geom_idx = 1; geom_idx < PART_TYPES; geom_idx++) {
15818 if (sets[vert_idx] & (1 << geom_idx)) {
15819 result.push_back(geom_idx + vert_idx * 1000);
15820 }
15821 }
15822 }
15823 return result;
15824 }

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