bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
file_writer_base.h
Go to the documentation of this file.
1#ifndef BITSIM_UTILS_IO_FILE_WRITER_BASE_H
2#define BITSIM_UTILS_IO_FILE_WRITER_BASE_H
3
6
7#include <fstream>
8#include <string>
9
10namespace bitsim
11{
12namespace utils::io
13{
14
18class FileWriterBase : public FileHandlerBase<std::ofstream>
19{
20
21 public:
25 static char default_comment_mark() { return '#'; }
26
30 FileWriterBase() = default;
31
36 FileWriterBase(const std::string &file_name,
37 FileFormats::Type t); // const std::ios_base::openmode mode=std::ios_base::out);
38
42 virtual ~FileWriterBase();
43
47 virtual void open() override;
48
52 char get_comment_mark() const { return comment_mark_; }
53
57 void set_comment_mark(char mark) { comment_mark_ = mark; }
58
63 virtual void write_header();
64
65 protected:
70};
71
72} // namespace utils::io
73} // namespace bitsim
74#endif // BITSIM_UTILS_IO_FILE_WRITER_BASE_H
FileHandlerBase(const std::string &file_name, FileFormats::Type t)
Definition file_handler_base.h:181
virtual ~FileWriterBase()
Destructor.
Definition file_writer_base.cpp:19
virtual void open() override
Open the file for writing.
Definition file_writer_base.cpp:21
virtual void write_header()
Write the header of the file. By default some information such as date and time the file was created ...
Definition file_writer_base.cpp:59
FileWriterBase()=default
Default ctor.
char get_comment_mark() const
Return the mark that signifies the beginning of a comment line.
Definition file_writer_base.h:52
static char default_comment_mark()
The default comment mark.
Definition file_writer_base.h:25
char comment_mark_
The mark that signifies the beginning of a comment line. The default is #.
Definition file_writer_base.h:69
void set_comment_mark(char mark)
Set the comment mark.
Definition file_writer_base.h:57
Definition csv_file_reader.cpp:12
Definition dc_motor_backend_base.h:9
Type
Definition file_formats.h:24