Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
Ofstream Class Reference

#include <core_out.h>

Inheritance diagram for Ofstream:
Collaboration diagram for Ofstream:

Public Member Functions

 Ofstream (std::string file_name)
 
 ~Ofstream ()
 

Public Attributes

char * buf
 

Detailed Description

class Ofstream handles opening and closing files, has 16MB buffer for output

Definition at line 21 of file core_out.h.

Constructor & Destructor Documentation

Ofstream::Ofstream ( std::string  file_name)

Definition at line 18 of file core_out.cpp.

References buf.

18  : std::ofstream(file_name), buf(new char[BUFF_SIZE])
19 {
20  if (!this->is_open()) throw std::runtime_error("Error while opening '" + file_name + "'");
21  this->rdbuf()->pubsetbuf(buf, sizeof(buf));
22 }
#define BUFF_SIZE
Definition: core_out.cpp:16
char * buf
Definition: core_out.h:25
Ofstream::~Ofstream ( )

Definition at line 24 of file core_out.cpp.

References buf.

25 {
26  delete[] buf;
27  if (this->is_open()) this->close();
28 }
char * buf
Definition: core_out.h:25

Member Data Documentation

char* Ofstream::buf

Definition at line 25 of file core_out.h.

Referenced by Ofstream(), and ~Ofstream().


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