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

Printer is a static class that allows printing to logs or stdout/stderr. More...

#include <duckdb.hpp>

Static Public Member Functions

static DUCKDB_API void Print (OutputStream stream, const string &str)
 Print the object to the stream.
static DUCKDB_API void Print (const string &str)
 Print the object to stderr.
template<typename... ARGS>
static void PrintF (OutputStream stream, const string &str, ARGS... params)
 Print the formatted object to the stream.
template<typename... ARGS>
static void PrintF (const string &str, ARGS... params)
 Print the formatted object to stderr.
static DUCKDB_API void RawPrint (OutputStream stream, const string &str)
 Directly prints the string to stdout without a newline.
static DUCKDB_API void Flush (OutputStream stream)
 Flush an output stream.
static DUCKDB_API bool IsTerminal (OutputStream stream)
 Whether or not we are printing to a terminal.
static DUCKDB_API idx_t TerminalWidth ()
 The terminal width.

Static Public Attributes

static line_printer_f line_printer = Printer::DefaultLinePrint

Static Private Member Functions

static void DefaultLinePrint (OutputStream stream, const string &str)

Detailed Description

Printer is a static class that allows printing to logs or stdout/stderr.

Member Function Documentation

◆ Print() [1/2]

void duckdb::Printer::Print ( OutputStream stream,
const string & str )
static

Print the object to the stream.

92556 {
92557 Printer::line_printer(stream, str);
92558}
Here is the caller graph for this function:

◆ Print() [2/2]

void duckdb::Printer::Print ( const string & str)
static

Print the object to stderr.

92565 {
92566 Printer::Print(OutputStream::STREAM_STDERR, str);
92567}
static DUCKDB_API void Print(OutputStream stream, const string &str)
Print the object to the stream.
Definition duckdb.cpp:92556
Here is the call graph for this function:

◆ PrintF() [1/2]

template<typename... ARGS>
void duckdb::Printer::PrintF ( OutputStream stream,
const string & str,
ARGS... params )
inlinestatic

Print the formatted object to the stream.

41937 {
41938 Printer::Print(stream, StringUtil::Format(str, params...));
41939 }
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
PyParams params(const std::string &tag, const std::string &model, const std::string &weights, const std::string &device)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintF() [2/2]

template<typename... ARGS>
void duckdb::Printer::PrintF ( const string & str,
ARGS... params )
inlinestatic

Print the formatted object to stderr.

41942 {
41943 Printer::PrintF(OutputStream::STREAM_STDERR, str, std::forward<ARGS>(params)...);
41944 }
static void PrintF(OutputStream stream, const string &str, ARGS... params)
Print the formatted object to the stream.
Definition duckdb.hpp:41937
Here is the call graph for this function:

◆ RawPrint()

void duckdb::Printer::RawPrint ( OutputStream stream,
const string & str )
static

Directly prints the string to stdout without a newline.

92535 {
92536#ifndef DUCKDB_DISABLE_PRINT
92537#ifdef DUCKDB_WINDOWS
92538 if (IsTerminal(stream)) {
92539 // print utf8 to terminal
92540 auto unicode = WindowsUtil::UTF8ToMBCS(str.c_str());
92541 fprintf(stream == OutputStream::STREAM_STDERR ? stderr : stdout, "%s", unicode.c_str());
92542 return;
92543 }
92544#endif
92545 fprintf(stream == OutputStream::STREAM_STDERR ? stderr : stdout, "%s", str.c_str());
92546#endif
92547}
static DUCKDB_API bool IsTerminal(OutputStream stream)
Whether or not we are printing to a terminal.
Definition duckdb.cpp:92569
Here is the call graph for this function:

◆ Flush()

void duckdb::Printer::Flush ( OutputStream stream)
static

Flush an output stream.

92559 {
92560#ifndef DUCKDB_DISABLE_PRINT
92561 fflush(stream == OutputStream::STREAM_STDERR ? stderr : stdout);
92562#endif
92563}

◆ IsTerminal()

bool duckdb::Printer::IsTerminal ( OutputStream stream)
static

Whether or not we are printing to a terminal.

92569 {
92570#ifndef DUCKDB_DISABLE_PRINT
92571#ifdef DUCKDB_WINDOWS
92572 auto stream_handle = stream == OutputStream::STREAM_STDERR ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE;
92573 return GetFileType(GetStdHandle(stream_handle)) == FILE_TYPE_CHAR;
92574#else
92575 return isatty(stream == OutputStream::STREAM_STDERR ? 2 : 1);
92576#endif
92577#else
92578 throw InternalException("IsTerminal called while printing is disabled");
92579#endif
92580}
Here is the caller graph for this function:

◆ TerminalWidth()

idx_t duckdb::Printer::TerminalWidth ( )
static

The terminal width.

92582 {
92583#ifndef DUCKDB_DISABLE_PRINT
92584#ifdef DUCKDB_WINDOWS
92585 CONSOLE_SCREEN_BUFFER_INFO csbi;
92586 int rows;
92587
92588 GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
92589 rows = csbi.srWindow.Right - csbi.srWindow.Left + 1;
92590 return rows;
92591#else
92592 struct winsize w;
92593 ioctl(0, TIOCGWINSZ, &w);
92594 return w.ws_col;
92595#endif
92596#else
92597 throw InternalException("TerminalWidth called while printing is disabled");
92598#endif
92599}
int rows

◆ DefaultLinePrint()

void duckdb::Printer::DefaultLinePrint ( OutputStream stream,
const string & str )
staticprivate
92549 {
92550 Printer::RawPrint(stream, str + "\n");
92551}
static DUCKDB_API void RawPrint(OutputStream stream, const string &str)
Directly prints the string to stdout without a newline.
Definition duckdb.cpp:92535

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