bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::utils::io::FileWriterBase Class Reference

The FileWriterBase class. More...

#include <file_writer_base.h>

Inheritance diagram for bitsim::utils::io::FileWriterBase:
Collaboration diagram for bitsim::utils::io::FileWriterBase:

Public Member Functions

 FileWriterBase ()=default
 Default ctor.
 FileWriterBase (const std::string &file_name, FileFormats::Type t)
 Constructor. Construct by passing the name of the file to write into.
virtual ~FileWriterBase ()
 Destructor.
virtual void open () override
 Open the file for writing.
char get_comment_mark () const
 Return the mark that signifies the beginning of a comment line.
void set_comment_mark (char mark)
 Set the comment mark.
virtual void write_header ()
 Write the header of the file. By default some information such as date and time the file was created is written.
Public Member Functions inherited from bitsim::utils::io::FileHandlerBase< std::ofstream >
virtual ~FileHandlerBase ()
 Destructor. Ensures that the file is properly closed.
FileFormats::Type get_type () const noexcept
 Returns the type/format of the file.
handler_type & get_file_stream () noexcept
 Provides mutable access to the underlying file stream.
std::string get_filename () const noexcept
 Returns the file name associated with this handler.
std::filesystem::path get_file_path () const noexcept
 Returns the file path associated with this handler.
bool is_open () const noexcept
 Checks whether the file is currently open.
virtual void close ()
 Closes the file if it is currently open.

Static Public Member Functions

static char default_comment_mark ()
 The default comment mark.

Protected Attributes

char comment_mark_
 The mark that signifies the beginning of a comment line. The default is #.
Protected Attributes inherited from bitsim::utils::io::FileHandlerBase< std::ofstream >
std::string file_name_
 The name of the file to read from or write to.
const FileFormats::Type t_
 The format/type of the file.
handler_type f_
 The underlying file stream/handler.

Additional Inherited Members

Public Types inherited from bitsim::utils::io::FileHandlerBase< std::ofstream >
using handler_type
Protected Member Functions inherited from bitsim::utils::io::FileHandlerBase< std::ofstream >
 FileHandlerBase (const std::string &file_name, FileFormats::Type t)
 Protected constructor.

Detailed Description

The FileWriterBase class.

Constructor & Destructor Documentation

◆ FileWriterBase() [1/2]

bitsim::utils::io::FileWriterBase::FileWriterBase ( )
default

Default ctor.

◆ FileWriterBase() [2/2]

bitsim::utils::io::FileWriterBase::FileWriterBase ( const std::string & file_name,
FileFormats::Type t )

Constructor. Construct by passing the name of the file to write into.

◆ ~FileWriterBase()

bitsim::utils::io::FileWriterBase::~FileWriterBase ( )
virtual

Destructor.

Member Function Documentation

◆ default_comment_mark()

char bitsim::utils::io::FileWriterBase::default_comment_mark ( )
inlinestatic

The default comment mark.

◆ get_comment_mark()

char bitsim::utils::io::FileWriterBase::get_comment_mark ( ) const
inline

Return the mark that signifies the beginning of a comment line.

◆ open()

void bitsim::utils::io::FileWriterBase::open ( )
overridevirtual

Open the file for writing.

attempt to split the file name and check if a suffix has been given if yes check if this is the same with the file type

Implements bitsim::utils::io::FileHandlerBase< std::ofstream >.

◆ set_comment_mark()

void bitsim::utils::io::FileWriterBase::set_comment_mark ( char mark)
inline

Set the comment mark.

◆ write_header()

void bitsim::utils::io::FileWriterBase::write_header ( )
virtual

Write the header of the file. By default some information such as date and time the file was created is written.

Member Data Documentation

◆ comment_mark_

char bitsim::utils::io::FileWriterBase::comment_mark_
protected

The mark that signifies the beginning of a comment line. The default is #.


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