34#ifndef _CAPD_HOMENGIN_CUBFILES_H_
35#define _CAPD_HOMENGIN_CUBFILES_H_
84 virtual int dim ()
const
88 throw "Undefined dimension of a set of cubes.";
96 throw "Undefined number of cubes in a set.";
102 throw "Undefined bitmapness of a set of cubes.";
108 throw "Undefined type of a set of cubes.";
127 throw "Unknown space wrapping of a set of cubes.";
148 std::copy (
_min. begin (),
_min. end (),
151 std::copy (
_max. begin (),
_max. end (),
155 throw "Undefined bounding box of a set of cubes.";
163 int volume (
int chunk = 0,
bool power2 =
false)
const;
168 return "unknown set of cubes";
174 out <<
"This is an unknown set of cubes.";
187 throw "Unable to read a set of cells.";
193 throw "Unable to read a set of cubes.";
201 virtual int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
202 bool power2 =
false)
const
204 throw "Unable to read a bitmap set of cubes.";
231 _dim (0), _count (-1), _min (), _max (), _wrapping ()
267 cubtypelist::iterator it = find (
cubtypes. begin (),
276 virtual const char *
name ()
const = 0;
279 virtual std::ostream &
describe (std::ostream &out)
const = 0;
301template <
class cubfileT>
320 return cubfileT::name ();
326 return cubfileT::describe (out);
332 return cubfileT::compatible (filename);
338 return new cubfileT (filename);
389 return "text list of cubes";
405 int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
406 bool power2 =
false)
const;
471 return "text list of cubical cells";
486 throw "Trying to read cubical cells as a set of full cubes.";
490 int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
491 bool power2 =
false)
const
493 throw "Trying to read cubical cells as a bitmap.";
556 return "text bitcodes";
572 int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
573 bool power2 =
false)
const;
625 return "windows bitmap";
637 throw "Trying to read a set of cells from a Win BMP file.";
644 int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
645 bool power2 =
false)
const;
734 return "multi-dimensional bitmap";
746 throw "Trying to read a set of cells from a BMD file.";
753 int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
754 bool power2 =
false)
const;
786 cubitmap (
const char *buffer,
const int *sizes,
int dim);
806 return "bitmap buffer (memory)";
821 throw "Trying to read a set of cells from a bitmap buffer.";
828 int readcubes (
int *&sizes,
char *&bytes,
int padding = 0,
829 bool power2 =
false)
const;
843 cubfile (
"(memory)"), buf (buffer)
848 if (sizes [0] & 0x1F)
849 throw "The x-size of a bitmap must be a multiple of 32.";
851 for (
int i = 1; i <
_dim; ++ i)
854 throw "Non-positive buffer size - something went wrong.";
This file contains the definition of a class which can be used to parse the command line of a program...
void analyze() const
Analyzes the file to determine the number of cubes and the scope of their coordinates.
int dim() const
What is the dimension of the set of cubes?
bool bitmaptype() const
Is this a bitmap type of set of cubes?
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
int readcubes(chomp::homology::SetOfCubes &s) const
Reads a cubical set from the file.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
static cubfile_traits< bitcodefile > t
Add this type of a cubical set to the list.
int count() const
How many cubes are there in the set?
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
static const char * name()
The name of this type of a cubical set.
bitcodefile(const char *filename)
The constructor.
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
Marian Mrozek's BMD binary file as a set of full cubes.
bmdfile(const char *filename)
The constructor.
int readcubes(chomp::homology::SetOfCubes &s) const
Read a cubical set from the file.
int count() const
How many cubes are there in the set?
bmdheader header
The header of the file.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
static const char * name()
The name of this type of a cubical set.
static cubfile_traits< bmdfile > t
Add this type of a cubical set to the list.
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
bool bitmaptype() const
Is this a bitmap type of set of cubes?
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
Text list of cubical cells.
void analyze() const
Analyzes the file to determine the number of cubes and the scope of their coordinates.
int boundingbox(int *mincoord, int *maxcoord) const
Determines the bounding box of the set of cubical cells.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
bool bitmaptype() const
Is this a bitmap type of set of cubes?
int count() const
How many cubes are there in the set?
int readcubes(chomp::homology::SetOfCubes &s) const
Reads a cubical set from the file.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
int dim() const
What is the dimension of the set of cubes?
static const char * name()
The name of this type of a cubical set.
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
static cubfile_traits< cellistfile > t
Add this type of a cubical set to the list.
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
cellistfile(const char *filename)
The constructor.
This class defines some common properties of the corresponding classes which define various types of ...
cubfile * newcubfile(const char *filename) const
Creates a new cubfile object of the desired type.
std::ostream & describe(std::ostream &out) const
Describe the given type of cubical sets.
const char * name() const
The name of the corresponding cubical set.
cubfile_traits()
The default constructor.
bool compatible(const char *filename) const
Verifies if the file format is compatible with this cubfile type.
~cubfile_traits()
The destructor.
An abstract class that is inherited by all the cubical sets.
virtual ~cubfile()
The destructor.
std::vector< int > _wrapping
The space wrapping information if any.
virtual void setwrapping(const int *table, int count=0)
Sets the space wrapping according to the given table.
int _count
The number of cubes in the set, -1 if unknown.
std::vector< int > _min
The minimal coordinates of the cubes' corners (bounding box).
int volume(int chunk=0, bool power2=false) const
Determine the volume of the bounding box of the set of cubes.
virtual int readcubes(chomp::homology::SetOfCubes &s) const
Reads a set of cubes from the file.
virtual bool bitmaptype() const
Is this a bitmap type of set of cubes?
std::vector< int > _max
The maximal coordinates of the cubes' corners (bounding box).
virtual int count() const
How many cubes are there in the set?
virtual int * spacewrapping(int *table) const
Fills in the space wrapping table if applicable.
virtual bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
virtual int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
cubfile(const char *_filename)
The default constructor.
virtual bool spacewrapping() const
Does this set include the definition of space wrapping?
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
virtual int dim() const
What is the dimension of the set of cubes?
std::string _filename
The name of the corresponding disk file.
virtual int boundingbox(int *mincoord, int *maxcoord) const
Determines the bounding box of the set of cubes.
virtual int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
static const char * name()
The name of this type of a cubical set.
const char * filename() const
What is the name of the associated disk file?
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int _dim
The dimension of the space, 0 if unknown.
A bitmap buffer stored in the memory, not in a file.
cubitmap(const char *buffer, const int *sizes, int dim)
The constructor.
const char * buf
The actual bitmap buffer.
static const char * name()
The name of this type of a cubical set.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
int buflength
The length of the buffer in bytes.
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
static bool compatible(const char *)
Verifies if the file format is compatible with this cubfile type.
int readcubes(chomp::homology::SetOfCubes &s) const
Read a cubical set from the file.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
bool bitmaptype() const
Is this a bitmap type of set of cubes?
int count() const
How many cubes are there in the set?
int boundingbox(int *mincoord, int *maxcoord) const
Determines the bounding box of the set of cubes.
static const char * name()
The name of this type of a cubical set.
int count() const
How many cubes are there in the set?
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
cublistfile(const char *filename)
The constructor.
void analyze() const
Analyzes the file to determine the number of cubes and the scope of their coordinates.
int dim() const
What is the dimension of the set of cubes?
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int readcubes(chomp::homology::SetOfCubes &s) const
Reads a cubical set from the file.
bool bitmaptype() const
Is this a bitmap type of set of cubes?
static cubfile_traits< cublistfile > t
Add this type of a cubical set to the list.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
A class that holds pointers to the traits of all the cubical file types.
virtual const char * name() const =0
The name of the set of cubes.
virtual std::ostream & describe(std::ostream &out) const =0
Describe the given type of cubical sets.
std::vector< const cubtype * > cubtypelist
The type of a list of engines.
virtual bool compatible(const char *filename) const =0
Verifies if the file format is compatible with this cubfile type.
static cubtypelist cubtypes
A list of all the engines that have been defined so far.
virtual cubfile * newcubfile(const char *filename) const =0
Creates a new cubfile object of the desired type.
virtual ~cubtype()
The destructor: Remove the cubical file traits from the list.
cubtype()
The constructor: Add the cubical file traits to the list.
static std::ostream & showlist(std::ostream &out, const cubtype::cubtypelist &types=cubtype::cubtypes)
Shows a list of available cubical set types with descriptions.
static cubfile * newfile(const char *filename, const cubtype::cubtypelist &types=cubtype::cubtypes)
Creates an appropriate cubical set corresponding to the given file.
Windows bitmap as a set of full cubes.
bool elementary() const
Is this a set of elementary cubes, as opposed to full cubes?
bool bitmaptype() const
Is this a bitmap type of set of cubes?
int boundingbox(int *mincoord, int *maxcoord) const
Determine the bounding box of the set of cubes.
static const char * name()
The name of this type of a cubical set.
int readcubes(chomp::homology::CubicalComplex &s) const
Reads a set of cubical cells from the file.
static cubfile_traits< winbmpfile > t
Add this type of a cubical set to the list.
winbmpfile(const char *filename)
The constructor.
int readcubes(chomp::homology::SetOfCubes &s) const
Read a cubical set from the file.
int readcubes(int *&sizes, char *&bytes, int padding=0, bool power2=false) const
Reads a bitmap from a file.
static bool compatible(const char *filename)
Verifies if the file format is compatible with this cubfile type.
int count() const
How many cubes are there in the set?
static std::ostream & describe(std::ostream &out)
Describes this particular type of a set of cubes.
The class that defines a geometric complex - a set of cells (cubes, simplices, etc).
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
std::ostream & operator<<(std::ostream &out, const algstruct< euclidom > &s)
Outputs the structure to the output stream in a human-readable form.
This namespace contains the entire CHomP library interface.
This file contains some useful functions related to the text input/output procedures.
This file defines a simple data structure which can be used to measure time used by the program (or s...