OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
olb::FileName Class Reference

FileName class. More...

#include <plainWriter.h>

+ Collaboration diagram for olb::FileName:

Public Member Functions

 FileName (std::string baseName, std::string suffix=".dat")
 Constructor.
 
template<typename T >
std::string addParameter (std::string quantity, T value, int digits=6, int precision=2)
 Add parameters.
 
std::string str ()
 
const char * c_str ()
 

Friends

template<class Ch , class Tr >
auto & operator<< (std::basic_ostream< Ch, Tr > &, FileName &)
 Befriend overloaded << operator.
 

Detailed Description

FileName class.

Definition at line 31 of file plainWriter.h.

Constructor & Destructor Documentation

◆ FileName()

olb::FileName::FileName ( std::string baseName,
std::string suffix = ".dat" )
inline

Constructor.

Definition at line 41 of file plainWriter.h.

42 : _fileName(baseName, std::ios_base::app | std::ios_base::out), _suffix(suffix)
43 {}

Member Function Documentation

◆ addParameter()

template<typename T >
std::string olb::FileName::addParameter ( std::string quantity,
T value,
int digits = 6,
int precision = 2 )
inline

Add parameters.

Definition at line 46 of file plainWriter.h.

46 {
47 _fileName << "_" << quantity;
48 if constexpr(std::is_same_v<T,double>){
49 _fileName << std::setw(digits) << std::setfill('0') << std::setprecision(precision) << value;
50 } else {
51 _fileName << std::setw(digits) << std::setfill('0') << value;
52 }
53 return _fileName.str();
54 };
typename std::integral_constant< TYPE, VALUE >::type value
Identity type to wrap non-type template arguments.
Definition meta.h:96

◆ c_str()

const char * olb::FileName::c_str ( )
inline

Definition at line 60 of file plainWriter.h.

60 {
61 _fullname = str();
62 return _fullname.c_str();
63 }
std::string str()
Definition plainWriter.h:56

References str().

+ Here is the call graph for this function:

◆ str()

std::string olb::FileName::str ( )
inline

Definition at line 56 of file plainWriter.h.

56 {
57 return _fileName.str()+_suffix;
58 }
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

template<class Ch , class Tr >
auto & operator<< ( std::basic_ostream< Ch, Tr > & os,
FileName & fileName )
friend

Befriend overloaded << operator.

Definition at line 68 of file plainWriter.h.

69{
70 return os << fileName.str();
71}

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