MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VTKCollection Class Reference

#include <VTKData.h>

Public Member Functions

 VTKCollection (std::string fileName)
 
 ~VTKCollection ()
 
 operator bool () const
 
void append (std::string filename)
 

Private Member Functions

void writeHeader ()
 
void writeFooter ()
 

Private Attributes

std::ofstream outFile_
 
bool hasHeader_
 
bool hasFooter_
 
std::size_t recordID_
 

Detailed Description

Definition at line 234 of file VTKData.h.

Constructor & Destructor Documentation

VTKCollection::VTKCollection ( std::string  fileName)
inline

Definition at line 259 of file VTKData.h.

260  : outFile_(fileName), hasHeader_(false), hasFooter_(false), recordID_(0)
261  {
262  }
std::size_t recordID_
Definition: VTKData.h:239
bool hasHeader_
Definition: VTKData.h:237
bool hasFooter_
Definition: VTKData.h:238
std::ofstream outFile_
Definition: VTKData.h:236
VTKCollection::~VTKCollection ( )
inline

Definition at line 264 of file VTKData.h.

References hasFooter_, hasHeader_, and writeFooter().

265  {
266  if (hasHeader_ && !hasFooter_)
267  writeFooter();
268  }
bool hasHeader_
Definition: VTKData.h:237
bool hasFooter_
Definition: VTKData.h:238
void writeFooter()
Definition: VTKData.h:250

Member Function Documentation

void VTKCollection::append ( std::string  filename)
inline

Definition at line 277 of file VTKData.h.

References hasHeader_, outFile_, recordID_, and writeHeader().

Referenced by transformMercuryToVTK().

278  {
279  if (!hasHeader_)
280  writeHeader();
281 
282  outFile_ <<
283  "<DataSet group=\"\" part=\"0\" timestep=\"" << recordID_ << "\" file=\"" << filename << "\" />\n";
284 
285  recordID_++;
286  }
std::size_t recordID_
Definition: VTKData.h:239
bool hasHeader_
Definition: VTKData.h:237
void writeHeader()
Definition: VTKData.h:241
std::ofstream outFile_
Definition: VTKData.h:236
VTKCollection::operator bool ( ) const
inline

Definition at line 271 of file VTKData.h.

References outFile_.

272  {
273  return outFile_.good();
274  }
std::ofstream outFile_
Definition: VTKData.h:236
void VTKCollection::writeFooter ( )
inlineprivate

Definition at line 250 of file VTKData.h.

References hasFooter_, and outFile_.

Referenced by ~VTKCollection().

251  {
252  outFile_ <<
253  " </Collection>\n"
254  "</VTKFile>\n";
255  hasFooter_ = true;
256  }
bool hasFooter_
Definition: VTKData.h:238
std::ofstream outFile_
Definition: VTKData.h:236
void VTKCollection::writeHeader ( )
inlineprivate

Definition at line 241 of file VTKData.h.

References hasHeader_, and outFile_.

Referenced by append().

242  {
243  outFile_ <<
244  "<?xml version=\"1.0\"?>\n"
245  "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">\n"
246  " <Collection>\n";
247  hasHeader_ = true;
248  }
bool hasHeader_
Definition: VTKData.h:237
std::ofstream outFile_
Definition: VTKData.h:236

Member Data Documentation

bool VTKCollection::hasFooter_
private

Definition at line 238 of file VTKData.h.

Referenced by writeFooter(), and ~VTKCollection().

bool VTKCollection::hasHeader_
private

Definition at line 237 of file VTKData.h.

Referenced by append(), writeHeader(), and ~VTKCollection().

std::ofstream VTKCollection::outFile_
private

Definition at line 236 of file VTKData.h.

Referenced by append(), operator bool(), writeFooter(), and writeHeader().

std::size_t VTKCollection::recordID_
private

Definition at line 239 of file VTKData.h.

Referenced by append().


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