Molecular Dynamics Simulation  1.0
Functions
CSVWriter.cpp File Reference
#include "CSVWriter.h"
#include <utility>
#include "io/logger/Logger.h"
Include dependency graph for CSVWriter.cpp:

Go to the source code of this file.

Functions

template<typename T >
void write_csv_element (std::ofstream &file, const T &value)
 Writes a single element to the CSV file. More...
 
template<>
void write_csv_element< std::string > (std::ofstream &file, const std::string &value)
 Escapes a string value to be written to the CSV file. More...
 

Function Documentation

◆ write_csv_element()

template<typename T >
void write_csv_element ( std::ofstream &  file,
const T &  value 
)

Writes a single element to the CSV file.

Parameters
fileThe file stream to write to.
valueThe value to write.

Definition at line 8 of file CSVWriter.cpp.

8  {
9  file << value;
10 }

◆ write_csv_element< std::string >()

template<>
void write_csv_element< std::string > ( std::ofstream &  file,
const std::string &  value 
)

Escapes a string value to be written to the CSV file.

Parameters
fileThe file stream to write to.
valueThe value to write.

Definition at line 13 of file CSVWriter.cpp.

13  {
14  file << "\"" << value << "\"";
15 }