Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

ImpFileManager Class Reference

#include <ImpFileManager.h>

List of all members.


Detailed Description

The file manager class allows for reading and writing implicit surface descriptions to *.imp files.

It makes use of factories to create objects from file descriptions.

The file manager has a version number and checks this against the version number that appears at the top of .imp files. If the file format ever changes this can be used to read the file properly based on version number.

Usage:

ImpFileManager ifm; // your very own file manager Implicit* surface; // your handy surface pointer

ifm.readFile("surf.imp", surface); // read from file ifm.writeFile("surf.imp", surface); // write to file

You can also leave off the .imp extension and the file manager will add it in automatically.

Definition at line 38 of file ImpFileManager.h.

Public Member Functions

 ImpFileManager ()
 Constructor.

void setVerbose (int v)
 Set verbose mode.

bool readImplicit (std::ifstream &file, Implicit *&object, std::string &name)
 Read an implicit object from file.

bool writeImplicit (std::ofstream &file, Implicit *&object, std::string tabs)
 Write an implicit object to file.

bool readFile (const std::string &name, Implicit *&surface)
 Read an implicit surface from file.

bool readFile (const std::string &name, std::vector< Surface * > &surfaces)
 Read a group of implicit surfaces from file.

bool writeFile (const std::string &name, std::vector< Surface * > &surfaces)
 Write a group of implicit surfaces to file.

bool writeFile (const std::string &name, Implicit *&surface)
 Write an implicit surface to file.


Private Attributes

const std::string version
 Version of this file manager.

const std::string suffix
 Implicit file suffix.

int verbose


Constructor & Destructor Documentation

ImpFileManager::ImpFileManager  ) 
 

Constructor.

Definition at line 14 of file ImpFileManager.cpp.


Member Function Documentation

bool ImpFileManager::readFile const std::string &  name,
std::vector< Surface * > &  surfaces
 

Read a group of implicit surfaces from file.

Definition at line 227 of file ImpFileManager.cpp.

References readImplicit(), verbose, and version.

bool ImpFileManager::readFile const std::string &  name,
Implicit *&  surface
 

Read an implicit surface from file.

Read an implicit surface from file.

Parameters:
name File name (with or without extension)
surface Pointer to resulting surface.
Returns:
True on success, false on failure.

Definition at line 177 of file ImpFileManager.cpp.

References readImplicit(), surface, verbose, and version.

bool ImpFileManager::readImplicit std::ifstream &  file,
Implicit *&  object,
std::string &  name
 

Read an implicit object from file.

The format for an object is: name [params] { ... }

Parameters:
file File stream to read from.
object Pointer to new object.
name The name of the object being created.
Returns:
True if successful.

Definition at line 29 of file ImpFileManager.cpp.

References Algebraic::coefficients(), NEW_IMPLICIT, Implicit::qlen(), Implicit::setChildren(), Implicit::setq(), and verbose.

Referenced by readFile().

void ImpFileManager::setVerbose int  v  ) 
 

Set verbose mode.

  • 0 - no output
  • 1 - standard output
  • 2 - light debug output

Definition at line 17 of file ImpFileManager.cpp.

References verbose.

bool ImpFileManager::writeFile const std::string &  name,
Implicit *&  surface
 

Write an implicit surface to file.

Write an implicit surface to file.

Parameters:
name File name (with or without extension)
surface Pointer to surface.
Returns:
True on success, false on failure.

Definition at line 287 of file ImpFileManager.cpp.

References surface, verbose, version, and writeImplicit().

bool ImpFileManager::writeFile const std::string &  name,
std::vector< Surface * > &  surfaces
 

Write a group of implicit surfaces to file.

Writes a set of implicits (a scene) to file.

Parameters:
name File name (with or without extension)
surfaces Vector of pointers to surfaces.
Returns:
True on success, false on failure.

Definition at line 326 of file ImpFileManager.cpp.

References verbose, version, and writeImplicit().

bool ImpFileManager::writeImplicit std::ofstream &  file,
Implicit *&  object,
std::string  tabs
 

Write an implicit object to file.

The format for an object is: name [params] { ... }

Parameters:
file File stream to use for writing.
object Pointer to object.
tabs A string for the tab.
Returns:
True if successful.

Definition at line 127 of file ImpFileManager.cpp.

References Implicit::getChildren(), Implicit::getq(), Surface::name(), Implicit::plen(), and Implicit::qlen().

Referenced by writeFile().


Member Data Documentation

const std::string ImpFileManager::suffix [private]
 

Implicit file suffix.

Definition at line 43 of file ImpFileManager.h.

int ImpFileManager::verbose [private]
 

Definition at line 45 of file ImpFileManager.h.

Referenced by readFile(), readImplicit(), setVerbose(), and writeFile().

const std::string ImpFileManager::version [private]
 

Version of this file manager.

Definition at line 42 of file ImpFileManager.h.

Referenced by readFile(), and writeFile().


The documentation for this class was generated from the following files:
Generated on Mon Jun 28 15:02:20 2004 for Advanced Surface Library by doxygen 1.3.4