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::CSVOption< T > Struct Template Reference

#include <duckdb.hpp>

Collaboration diagram for duckdb::CSVOption< T >:

Public Member Functions

 CSVOption (T value_p)
 
 CSVOption (T value_p, bool set_by_user_p)
 
void Set (T value_p, bool by_user=true)
 
void Set (CSVOption value_p, bool by_user=true)
 
void ChangeSetByUserTrue ()
 
bool operator== (const CSVOption &other) const
 
bool operator!= (const CSVOption &other) const
 
bool operator== (const T &other) const
 
bool operator!= (const T &other) const
 
const T & GetValue () const
 Returns CSV Option value.
 
bool IsSetByUser () const
 
string FormatSet () const
 Returns a formatted string with information regarding how this option was set.
 
string FormatValue () const
 Returns a formatted string with the actual value of this option.
 
DUCKDB_API void Serialize (Serializer &serializer) const
 Serializes CSV Option.
 

Static Public Member Functions

static DUCKDB_API CSVOption< T > Deserialize (Deserializer &deserializer)
 Deserializes CSV Option.
 

Private Member Functions

template<typename U >
std::string FormatValueInternal (const U &val) const
 
std::string FormatValueInternal (const std::string &val) const
 
std::string FormatValueInternal (const idx_t &val) const
 
std::string FormatValueInternal (const char &val) const
 
std::string FormatValueInternal (const NewLineIdentifier &val) const
 
std::string FormatValueInternal (const StrpTimeFormat &val) const
 
std::string FormatValueInternal (const bool &val) const
 

Private Attributes

bool set_by_user = false
 If this option was manually set by the user.
 
value
 

Detailed Description

template<typename T>
struct duckdb::CSVOption< T >

Wrapper for CSV Options that can be manually set by the user It is important to make this difference for options that can be automatically sniffed AND manually set.

Constructor & Destructor Documentation

◆ CSVOption() [1/3]

template<typename T >
duckdb::CSVOption< T >::CSVOption ( value_p)
inline
46241 : value(value_p) { // NOLINT: allow implicit conversion from value
46242 }

◆ CSVOption() [2/3]

template<typename T >
duckdb::CSVOption< T >::CSVOption ( value_p,
bool  set_by_user_p 
)
inline
46243 : set_by_user(set_by_user_p), value(value_p) {
46244 }
bool set_by_user
If this option was manually set by the user.
Definition duckdb.hpp:46319

◆ CSVOption() [3/3]

template<typename T >
duckdb::CSVOption< T >::CSVOption ( )
inline
46246{};

Member Function Documentation

◆ Set() [1/2]

template<typename T >
void duckdb::CSVOption< T >::Set ( value_p,
bool  by_user = true 
)
inline

Sets value. If by user it also toggles the set_by user flag

46250 {
46251 D_ASSERT(!(by_user && set_by_user));
46252 if (!set_by_user) {
46253 // If it's not set by user we can change the value
46254 value = value_p;
46255 set_by_user = by_user;
46256 }
46257 }

◆ Set() [2/2]

template<typename T >
void duckdb::CSVOption< T >::Set ( CSVOption< T >  value_p,
bool  by_user = true 
)
inline

Sets value. If by user it also toggles the set_by user flag

46261 {
46262 D_ASSERT(!(by_user && set_by_user));
46263 if (!set_by_user) {
46264 // If it's not set by user we can change the value
46265 value = value_p;
46266 set_by_user = by_user;
46267 }
46268 }

◆ ChangeSetByUserTrue()

template<typename T >
void duckdb::CSVOption< T >::ChangeSetByUserTrue ( )
inline
46271 {
46272 set_by_user = true;
46273 }

◆ operator==() [1/2]

template<typename T >
bool duckdb::CSVOption< T >::operator== ( const CSVOption< T > &  other) const
inline
46275 {
46276 return value == other.value;
46277 }

◆ operator!=() [1/2]

template<typename T >
bool duckdb::CSVOption< T >::operator!= ( const CSVOption< T > &  other) const
inline
46279 {
46280 return value != other.value;
46281 }

◆ operator==() [2/2]

template<typename T >
bool duckdb::CSVOption< T >::operator== ( const T &  other) const
inline
46283 {
46284 return value == other;
46285 }

◆ operator!=() [2/2]

template<typename T >
bool duckdb::CSVOption< T >::operator!= ( const T &  other) const
inline
46287 {
46288 return value != other;
46289 }

◆ GetValue()

template<typename T >
const T & duckdb::CSVOption< T >::GetValue ( ) const
inline

Returns CSV Option value.

46291 {
46292 return value;
46293 }

◆ IsSetByUser()

template<typename T >
bool duckdb::CSVOption< T >::IsSetByUser ( ) const
inline
46294 {
46295 return set_by_user;
46296 }

◆ FormatSet()

template<typename T >
string duckdb::CSVOption< T >::FormatSet ( ) const
inline

Returns a formatted string with information regarding how this option was set.

46299 {
46300 if (set_by_user) {
46301 return "(Set By User)";
46302 }
46303 return "(Auto-Detected)";
46304 }

◆ FormatValue()

template<typename T >
string duckdb::CSVOption< T >::FormatValue ( ) const
inline

Returns a formatted string with the actual value of this option.

46307 {
46308 return FormatValueInternal(value);
46309 }
std::string FormatValueInternal(const U &val) const
Definition duckdb.hpp:46327
Here is the call graph for this function:

◆ FormatValueInternal() [1/7]

template<typename T >
template<typename U >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const U &  val) const
inlineprivate

------------------------------------------------— // Functions used to convert a value to a string ------------------------------------------------— //

46327 {
46328 throw InternalException("Type not accepted as CSV Option.");
46329 }
Here is the caller graph for this function:

◆ FormatValueInternal() [2/7]

template<typename T >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const std::string &  val) const
inlineprivate
46331 {
46332 return val;
46333 }

◆ FormatValueInternal() [3/7]

template<typename T >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const idx_t val) const
inlineprivate
46335 {
46336 return to_string(val);
46337 }

◆ FormatValueInternal() [4/7]

template<typename T >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const char val) const
inlineprivate
46339 {
46340 string char_val;
46341 if (val == '\0') {
46342 char_val = "(empty)";
46343 return char_val;
46344 }
46345 char_val += val;
46346 return char_val;
46347 }

◆ FormatValueInternal() [5/7]

template<typename T >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const NewLineIdentifier &  val) const
inlineprivate
46349 {
46350 switch (val) {
46351 case NewLineIdentifier::SINGLE_N:
46352 return "\\n";
46353 case NewLineIdentifier::SINGLE_R:
46354 return "\\r";
46355 case NewLineIdentifier::CARRY_ON:
46356 return "\\r\\n";
46357 case NewLineIdentifier::NOT_SET:
46358 return "Single-Line File";
46359 default:
46360 throw InternalException("Invalid Newline Detected.");
46361 }
46362 }

◆ FormatValueInternal() [6/7]

template<typename T >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const StrpTimeFormat val) const
inlineprivate
46364 {
46365 return val.format_specifier;
46366 }

◆ FormatValueInternal() [7/7]

template<typename T >
std::string duckdb::CSVOption< T >::FormatValueInternal ( const bool &  val) const
inlineprivate
46368 {
46369 if (val) {
46370 return "true";
46371 }
46372 return "false";
46373 }

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