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::Serializer Class Referenceabstract
Inheritance diagram for duckdb::Serializer:
Collaboration diagram for duckdb::Serializer:

Classes

class  List
 

Public Member Functions

bool ShouldSerialize (idx_t version_added)
 
SerializationOptions GetOptions ()
 
SerializationDataGetSerializationData ()
 
void SetSerializationData (const SerializationData &other)
 
template<class T >
void WriteProperty (const field_id_t field_id, const char *tag, const T &value)
 
template<class T >
void WritePropertyWithDefault (const field_id_t field_id, const char *tag, const T &value)
 
template<class T >
void WritePropertyWithDefault (const field_id_t field_id, const char *tag, const T &value, const T &default_value)
 
template<class T >
void WritePropertyWithDefault (const field_id_t field_id, const char *tag, const CSVOption< T > &value, const T &default_value)
 
void WriteProperty (const field_id_t field_id, const char *tag, const_data_ptr_t ptr, idx_t count)
 
template<class FUNC >
void WriteObject (const field_id_t field_id, const char *tag, FUNC f)
 
template<class FUNC >
void WriteList (const field_id_t field_id, const char *tag, idx_t count, FUNC func)
 
template<>
void WriteValue (const vector< bool > &vec)
 
template<>
void WritePropertyWithDefault (const field_id_t field_id, const char *tag, const Value &value, const Value &default_value)
 

Protected Member Functions

template<typename T >
std::enable_if< std::is_enum< T >::value, void >::type WriteValue (const T value)
 
template<typename T >
void WriteValue (const optionally_owned_ptr< T > &ptr)
 
template<typename T >
void WriteValue (const unique_ptr< T > &ptr)
 
template<typename T >
void WriteValue (const shared_ptr< T > &ptr)
 
template<typename T >
void WriteValue (const T *ptr)
 
template<class K , class V >
void WriteValue (const std::pair< K, V > &pair)
 
template<class T >
void WriteValue (const reference< T > ref)
 
template<class T >
void WriteValue (const vector< T > &vec)
 
template<class T >
void WriteValue (const unsafe_vector< T > &vec)
 
template<class T , class HASH , class CMP >
void WriteValue (const duckdb::unordered_set< T, HASH, CMP > &set)
 
template<class T , class HASH , class CMP >
void WriteValue (const duckdb::set< T, HASH, CMP > &set)
 
template<class K , class V , class HASH , class CMP >
void WriteValue (const duckdb::unordered_map< K, V, HASH, CMP > &map)
 
template<class K , class V , class HASH , class CMP >
void WriteValue (const duckdb::map< K, V, HASH, CMP > &map)
 
template<class V >
void WriteValue (const duckdb::InsertionOrderPreservingMap< V > &map)
 
template<typename T >
void WriteValue (const std::priority_queue< T > &queue)
 
template<typename T >
std::enable_if< has_serialize< T >::value >::type WriteValue (const T &value)
 
virtual void OnPropertyBegin (const field_id_t field_id, const char *tag)=0
 
virtual void OnPropertyEnd ()=0
 
virtual void OnOptionalPropertyBegin (const field_id_t field_id, const char *tag, bool present)=0
 
virtual void OnOptionalPropertyEnd (bool present)=0
 
virtual void OnObjectBegin ()=0
 
virtual void OnObjectEnd ()=0
 
virtual void OnListBegin (idx_t count)=0
 
virtual void OnListEnd ()=0
 
virtual void OnNullableBegin (bool present)=0
 
virtual void OnNullableEnd ()=0
 
virtual void WriteNull ()=0
 
virtual void WriteValue (char value)
 
virtual void WriteValue (bool value)=0
 
virtual void WriteValue (uint8_t value)=0
 
virtual void WriteValue (int8_t value)=0
 
virtual void WriteValue (uint16_t value)=0
 
virtual void WriteValue (int16_t value)=0
 
virtual void WriteValue (uint32_t value)=0
 
virtual void WriteValue (int32_t value)=0
 
virtual void WriteValue (uint64_t value)=0
 
virtual void WriteValue (int64_t value)=0
 
virtual void WriteValue (hugeint_t value)=0
 
virtual void WriteValue (uhugeint_t value)=0
 
virtual void WriteValue (float value)=0
 
virtual void WriteValue (double value)=0
 
virtual void WriteValue (const string_t value)=0
 
virtual void WriteValue (const string &value)=0
 
virtual void WriteValue (const char *str)=0
 
virtual void WriteDataPtr (const_data_ptr_t ptr, idx_t count)=0
 
void WriteValue (LogicalIndex value)
 
void WriteValue (PhysicalIndex value)
 
void WriteValue (optional_idx value)
 

Protected Attributes

SerializationOptions options
 
SerializationData data
 

Constructor & Destructor Documentation

◆ ~Serializer()

virtual duckdb::Serializer::~Serializer ( )
inlinevirtual
52767 {
52768 }

Member Function Documentation

◆ ShouldSerialize()

bool duckdb::Serializer::ShouldSerialize ( idx_t  version_added)
inline
52770 {
52771 return options.serialization_compatibility.Compare(version_added);
52772 }

◆ GetOptions()

SerializationOptions duckdb::Serializer::GetOptions ( )
inline
52796 {
52797 return options;
52798 }

◆ GetSerializationData()

SerializationData & duckdb::Serializer::GetSerializationData ( )
inline
52799 {
52800 return data;
52801 }

◆ SetSerializationData()

void duckdb::Serializer::SetSerializationData ( const SerializationData other)
inline
52803 {
52804 data = other;
52805 }

◆ WriteProperty() [1/2]

template<class T >
void duckdb::Serializer::WriteProperty ( const field_id_t  field_id,
const char tag,
const T &  value 
)
inline
52809 {
52810 OnPropertyBegin(field_id, tag);
52811 WriteValue(value);
52812 OnPropertyEnd();
52813 }

◆ WritePropertyWithDefault() [1/3]

template<class T >
void duckdb::Serializer::WritePropertyWithDefault ( const field_id_t  field_id,
const char tag,
const T &  value 
)
inline
52817 {
52818 // If current value is default, don't write it
52819 if (!options.serialize_default_values && SerializationDefaultValue::IsDefault<T>(value)) {
52820 OnOptionalPropertyBegin(field_id, tag, false);
52821 OnOptionalPropertyEnd(false);
52822 return;
52823 }
52824 OnOptionalPropertyBegin(field_id, tag, true);
52825 WriteValue(value);
52826 OnOptionalPropertyEnd(true);
52827 }

◆ WritePropertyWithDefault() [2/3]

template<class T >
void duckdb::Serializer::WritePropertyWithDefault ( const field_id_t  field_id,
const char tag,
const T &  value,
const T &  default_value 
)
inline
52830 {
52831 // If current value is default, don't write it
52832 if (!options.serialize_default_values && (value == default_value)) {
52833 OnOptionalPropertyBegin(field_id, tag, false);
52834 OnOptionalPropertyEnd(false);
52835 return;
52836 }
52837 OnOptionalPropertyBegin(field_id, tag, true);
52838 WriteValue(value);
52839 OnOptionalPropertyEnd(true);
52840 }

◆ WritePropertyWithDefault() [3/3]

template<class T >
void duckdb::Serializer::WritePropertyWithDefault ( const field_id_t  field_id,
const char tag,
const CSVOption< T > &  value,
const T &  default_value 
)
inline
52845 {
52846 // If current value is default, don't write it
52847 if (!options.serialize_default_values && (value == default_value)) {
52848 OnOptionalPropertyBegin(field_id, tag, false);
52849 OnOptionalPropertyEnd(false);
52850 return;
52851 }
52852 OnOptionalPropertyBegin(field_id, tag, true);
52853 WriteValue(value.GetValue());
52854 OnOptionalPropertyEnd(true);
52855 }

◆ WriteProperty() [2/2]

void duckdb::Serializer::WriteProperty ( const field_id_t  field_id,
const char tag,
const_data_ptr_t  ptr,
idx_t  count 
)
inline
52858 {
52859 OnPropertyBegin(field_id, tag);
52860 WriteDataPtr(ptr, count);
52861 OnPropertyEnd();
52862 }

◆ WriteObject()

template<class FUNC >
void duckdb::Serializer::WriteObject ( const field_id_t  field_id,
const char tag,
FUNC  f 
)
inline
52866 {
52867 OnPropertyBegin(field_id, tag);
52868 OnObjectBegin();
52869 f(*this);
52870 OnObjectEnd();
52871 OnPropertyEnd();
52872 }

◆ WriteList()

template<class FUNC >
void duckdb::Serializer::WriteList ( const field_id_t  field_id,
const char tag,
idx_t  count,
FUNC  func 
)
inline
52875 {
52876 OnPropertyBegin(field_id, tag);
52877 OnListBegin(count);
52878 List list {*this};
52879 for (idx_t i = 0; i < count; i++) {
52880 func(list, i);
52881 }
52882 OnListEnd();
52883 OnPropertyEnd();
52884 }

◆ WriteValue() [1/20]

template<typename T >
std::enable_if< std::is_enum< T >::value, void >::type duckdb::Serializer::WriteValue ( const value)
inlineprotected
52888 {
52889 if (options.serialize_enum_as_string) {
52890 // Use the enum serializer to lookup tostring function
52891 auto str = EnumUtil::ToChars(value);
52892 WriteValue(str);
52893 } else {
52894 // Use the underlying type
52895 WriteValue(static_cast<typename std::underlying_type<T>::type>(value));
52896 }
52897 }

◆ WriteValue() [2/20]

template<typename T >
void duckdb::Serializer::WriteValue ( const optionally_owned_ptr< T > &  ptr)
inlineprotected
52901 {
52902 WriteValue(ptr.get());
52903 }

◆ WriteValue() [3/20]

template<typename T >
void duckdb::Serializer::WriteValue ( const unique_ptr< T > &  ptr)
inlineprotected
52907 {
52908 WriteValue(ptr.get());
52909 }

◆ WriteValue() [4/20]

template<typename T >
void duckdb::Serializer::WriteValue ( const shared_ptr< T > &  ptr)
inlineprotected
52913 {
52914 WriteValue(ptr.get());
52915 }

◆ WriteValue() [5/20]

template<typename T >
void duckdb::Serializer::WriteValue ( const T *  ptr)
inlineprotected
52919 {
52920 if (ptr == nullptr) {
52921 OnNullableBegin(false);
52922 OnNullableEnd();
52923 } else {
52924 OnNullableBegin(true);
52925 WriteValue(*ptr);
52926 OnNullableEnd();
52927 }
52928 }

◆ WriteValue() [6/20]

template<class K , class V >
void duckdb::Serializer::WriteValue ( const std::pair< K, V > &  pair)
inlineprotected
52932 {
52933 OnObjectBegin();
52934 WriteProperty(0, "first", pair.first);
52935 WriteProperty(1, "second", pair.second);
52936 OnObjectEnd();
52937 }

◆ WriteValue() [7/20]

template<class T >
void duckdb::Serializer::WriteValue ( const reference< T >  ref)
inlineprotected
52941 {
52942 WriteValue(ref.get());
52943 }

◆ WriteValue() [8/20]

template<class T >
void duckdb::Serializer::WriteValue ( const vector< T > &  vec)
inlineprotected
52947 {
52948 auto count = vec.size();
52949 OnListBegin(count);
52950 for (auto &item : vec) {
52951 WriteValue(item);
52952 }
52953 OnListEnd();
52954 }

◆ WriteValue() [9/20]

template<class T >
void duckdb::Serializer::WriteValue ( const unsafe_vector< T > &  vec)
inlineprotected
52957 {
52958 auto count = vec.size();
52959 OnListBegin(count);
52960 for (auto &item : vec) {
52961 WriteValue(item);
52962 }
52963 OnListEnd();
52964 }

◆ WriteValue() [10/20]

template<class T , class HASH , class CMP >
void duckdb::Serializer::WriteValue ( const duckdb::unordered_set< T, HASH, CMP > &  set)
inlineprotected
52969 {
52970 auto count = set.size();
52971 OnListBegin(count);
52972 for (auto &item : set) {
52973 WriteValue(item);
52974 }
52975 OnListEnd();
52976 }

◆ WriteValue() [11/20]

template<class T , class HASH , class CMP >
void duckdb::Serializer::WriteValue ( const duckdb::set< T, HASH, CMP > &  set)
inlineprotected
52981 {
52982 auto count = set.size();
52983 OnListBegin(count);
52984 for (auto &item : set) {
52985 WriteValue(item);
52986 }
52987 OnListEnd();
52988 }

◆ WriteValue() [12/20]

template<class K , class V , class HASH , class CMP >
void duckdb::Serializer::WriteValue ( const duckdb::unordered_map< K, V, HASH, CMP > &  map)
inlineprotected
52993 {
52994 auto count = map.size();
52995 OnListBegin(count);
52996 for (auto &item : map) {
52997 OnObjectBegin();
52998 WriteProperty(0, "key", item.first);
52999 WriteProperty(1, "value", item.second);
53000 OnObjectEnd();
53001 }
53002 OnListEnd();
53003 }

◆ WriteValue() [13/20]

template<class K , class V , class HASH , class CMP >
void duckdb::Serializer::WriteValue ( const duckdb::map< K, V, HASH, CMP > &  map)
inlineprotected
53008 {
53009 auto count = map.size();
53010 OnListBegin(count);
53011 for (auto &item : map) {
53012 OnObjectBegin();
53013 WriteProperty(0, "key", item.first);
53014 WriteProperty(1, "value", item.second);
53015 OnObjectEnd();
53016 }
53017 OnListEnd();
53018 }

◆ WriteValue() [14/20]

template<class V >
void duckdb::Serializer::WriteValue ( const duckdb::InsertionOrderPreservingMap< V > &  map)
inlineprotected
53023 {
53024 auto count = map.size();
53025 OnListBegin(count);
53026 for (auto &entry : map) {
53027 OnObjectBegin();
53028 WriteProperty(0, "key", entry.first);
53029 WriteProperty(1, "value", entry.second);
53030 OnObjectEnd();
53031 }
53032 OnListEnd();
53033 }

◆ WriteValue() [15/20]

template<typename T >
void duckdb::Serializer::WriteValue ( const std::priority_queue< T > &  queue)
inlineprotected
53037 {
53038 vector<T> placeholder;
53039 auto queue_copy = std::priority_queue<T>(queue);
53040 while (queue_copy.size() > 0) {
53041 placeholder.emplace_back(queue_copy.top());
53042 queue_copy.pop();
53043 }
53044 WriteValue(placeholder);
53045 }

◆ WriteValue() [16/20]

template<typename T >
std::enable_if< has_serialize< T >::value >::type duckdb::Serializer::WriteValue ( const T &  value)
inlineprotected
53049 {
53050 OnObjectBegin();
53051 value.Serialize(*this);
53052 OnObjectEnd();
53053 }

◆ WriteValue() [17/20]

virtual void duckdb::Serializer::WriteValue ( char  value)
inlineprotectedvirtual
53070 {
53071 throw NotImplementedException("Write char value not implemented");
53072 }

◆ WriteValue() [18/20]

void duckdb::Serializer::WriteValue ( LogicalIndex  value)
inlineprotected
53090 {
53091 WriteValue(value.index);
53092 }

◆ WriteValue() [19/20]

void duckdb::Serializer::WriteValue ( PhysicalIndex  value)
inlineprotected
53093 {
53094 WriteValue(value.index);
53095 }

◆ WriteValue() [20/20]

void duckdb::Serializer::WriteValue ( optional_idx  value)
inlineprotected
53096 {
53097 WriteValue(value.IsValid() ? value.GetIndex() : DConstants::INVALID_INDEX);
53098 }

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