Public Member Functions | Private Attributes | List of all members
gtsam::RedirectCout Struct Reference

#include <utilities.h>

Public Member Functions

 RedirectCout ()
 constructor – redirect stdout buffer to a stringstream buffer More...
 
std::string str () const
 return the string More...
 
 ~RedirectCout ()
 destructor – redirect stdout buffer to its original buffer More...
 

Private Attributes

std::streambuf * coutBuffer_
 
std::stringstream ssBuffer_
 

Detailed Description

For Python str(). Redirect std cout to a string stream so we can return a string representation of an object when it prints to cout. https://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-string

Definition at line 14 of file base/utilities.h.

Constructor & Destructor Documentation

◆ RedirectCout()

gtsam::RedirectCout::RedirectCout ( )
inline

constructor – redirect stdout buffer to a stringstream buffer

Definition at line 16 of file base/utilities.h.

◆ ~RedirectCout()

gtsam::RedirectCout::~RedirectCout ( )

destructor – redirect stdout buffer to its original buffer

Definition at line 9 of file utilities.cpp.

Member Function Documentation

◆ str()

std::string gtsam::RedirectCout::str ( ) const

return the string

Definition at line 5 of file utilities.cpp.

Member Data Documentation

◆ coutBuffer_

std::streambuf* gtsam::RedirectCout::coutBuffer_
private

Definition at line 26 of file base/utilities.h.

◆ ssBuffer_

std::stringstream gtsam::RedirectCout::ssBuffer_
private

Definition at line 25 of file base/utilities.h.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:47:07