CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::FileIo Struct Reference

Helper structure for writing binary data. More...

#include <fileIo.hpp>

Public Member Functions

 FileIo (std::string const &file, bool write)
 
template<typename Data >
void readData (Data *data, size_t const length)
 
template<typename Data >
void writeData (Data const *data, size_t const length)
 
 ~FileIo ()
 Destructor.
 

Detailed Description

Helper structure for writing binary data.

Exceptions are thrown if:

  • file could not be opened,
  • file is used in the wrong mode,
  • number of bytes read/written is wrong.

Constructor & Destructor Documentation

◆ FileIo()

codi::FileIo::FileIo ( std::string const &  file,
bool  write 
)
inline

Constructor Will throw an IoException if file cannot be opened.

Member Function Documentation

◆ readData()

template<typename Data >
void codi::FileIo::readData ( Data *  data,
size_t const  length 
)
inline

Read data from a file. Will throw an IoException if not in read mode or if the number of bytes read is wrong.

◆ writeData()

template<typename Data >
void codi::FileIo::writeData ( Data const *  data,
size_t const  length 
)
inline

Write data to a file. Will throw an IoException if not in write mode or if the number of bytes written is wrong.


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