The Original CHomP Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
chomp::homengin::cubitmap Class Reference

A bitmap buffer stored in the memory, not in a file. More...

#include <cubfiles.h>

Inheritance diagram for chomp::homengin::cubitmap:
chomp::homengin::cubfile

Public Member Functions

 cubitmap (const char *buffer, const int *sizes, int dim)
 The constructor. More...
 
int count () const
 How many cubes are there in the set? More...
 
bool bitmaptype () const
 Is this a bitmap type of set of cubes? More...
 
bool elementary () const
 Is this a set of elementary cubes, as opposed to full cubes? More...
 
int readcubes (chomp::homology::CubicalComplex &s) const
 Reads a set of cubical cells from the file. More...
 
int readcubes (chomp::homology::SetOfCubes &s) const
 Read a cubical set from the file. More...
 
int readcubes (int *&sizes, char *&bytes, int padding=0, bool power2=false) const
 Reads a bitmap from a file. More...
 
- Public Member Functions inherited from chomp::homengin::cubfile
 cubfile (const char *_filename)
 The default constructor. More...
 
virtual ~cubfile ()
 The destructor. More...
 
const char * filename () const
 What is the name of the associated disk file? More...
 
virtual int dim () const
 What is the dimension of the set of cubes? More...
 
virtual int count () const
 How many cubes are there in the set? More...
 
virtual bool bitmaptype () const
 Is this a bitmap type of set of cubes? More...
 
virtual bool elementary () const
 Is this a set of elementary cubes, as opposed to full cubes? More...
 
virtual bool spacewrapping () const
 Does this set include the definition of space wrapping? More...
 
virtual int * spacewrapping (int *table) const
 Fills in the space wrapping table if applicable. More...
 
virtual void setwrapping (const int *table, int count=0)
 Sets the space wrapping according to the given table. More...
 
virtual int boundingbox (int *mincoord, int *maxcoord) const
 Determines the bounding box of the set of cubes. More...
 
int volume (int chunk=0, bool power2=false) const
 Determine the volume of the bounding box of the set of cubes. More...
 
virtual int readcubes (chomp::homology::CubicalComplex &s) const
 Reads a set of cubical cells from the file. More...
 
virtual int readcubes (chomp::homology::SetOfCubes &s) const
 Reads a set of cubes from the file. More...
 
virtual int readcubes (int *&sizes, char *&bytes, int padding=0, bool power2=false) const
 Reads a bitmap from a file. More...
 

Static Public Member Functions

static const char * name ()
 The name of this type of a cubical set. More...
 
static std::ostream & describe (std::ostream &out)
 Describes this particular type of a set of cubes. More...
 
static bool compatible (const char *)
 Verifies if the file format is compatible with this cubfile type. More...
 
- Static Public Member Functions inherited from chomp::homengin::cubfile
static const char * name ()
 The name of this type of a cubical set. More...
 
static std::ostream & describe (std::ostream &out)
 Describes this particular type of a set of cubes. More...
 
static bool compatible (const char *filename)
 Verifies if the file format is compatible with this cubfile type. More...
 

Private Attributes

const char * buf
 The actual bitmap buffer. More...
 
int buflength
 The length of the buffer in bytes. More...
 

Additional Inherited Members

- Protected Attributes inherited from chomp::homengin::cubfile
std::string _filename
 The name of the corresponding disk file. More...
 
int _dim
 The dimension of the space, 0 if unknown. More...
 
int _count
 The number of cubes in the set, -1 if unknown. More...
 
std::vector< int > _min
 The minimal coordinates of the cubes' corners (bounding box). More...
 
std::vector< int > _max
 The maximal coordinates of the cubes' corners (bounding box). More...
 
std::vector< int > _wrapping
 The space wrapping information if any. More...
 

Detailed Description

A bitmap buffer stored in the memory, not in a file.

Definition at line 782 of file cubfiles.h.

Constructor & Destructor Documentation

◆ cubitmap()

chomp::homengin::cubitmap::cubitmap ( const char *  buffer,
const int *  sizes,
int  dim 
)
inline

The constructor.

Definition at line 842 of file cubfiles.h.

842 :
843 cubfile ("(memory)"), buf (buffer)
844{
845 _dim = dim;
846 _min. assign (_dim, 0);
847 _max. assign (sizes, sizes + _dim);
848 if (sizes [0] & 0x1F)
849 throw "The x-size of a bitmap must be a multiple of 32.";
850 buflength = sizes [0] >> 3;
851 for (int i = 1; i < _dim; ++ i)
852 buflength *= sizes [i];
853 if (buflength <= 0)
854 throw "Non-positive buffer size - something went wrong.";
855 return;
856} /* cubitmap::cubitmap */
std::vector< int > _min
The minimal coordinates of the cubes' corners (bounding box).
Definition: cubfiles.h:218
std::vector< int > _max
The maximal coordinates of the cubes' corners (bounding box).
Definition: cubfiles.h:221
cubfile(const char *_filename)
The default constructor.
Definition: cubfiles.h:230
virtual int dim() const
What is the dimension of the set of cubes?
Definition: cubfiles.h:84
int _dim
The dimension of the space, 0 if unknown.
Definition: cubfiles.h:212
const char * buf
The actual bitmap buffer.
Definition: cubfiles.h:833
int buflength
The length of the buffer in bytes.
Definition: cubfiles.h:836

References chomp::homengin::cubfile::_dim, chomp::homengin::cubfile::_max, chomp::homengin::cubfile::_min, buflength, and chomp::homengin::cubfile::dim().

Member Function Documentation

◆ bitmaptype()

bool chomp::homengin::cubitmap::bitmaptype ( ) const
inlinevirtual

Is this a bitmap type of set of cubes?

Reimplemented from chomp::homengin::cubfile.

Definition at line 792 of file cubfiles.h.

793 {
794 return true;
795 }

◆ compatible()

static bool chomp::homengin::cubitmap::compatible ( const char *  )
inlinestatic

Verifies if the file format is compatible with this cubfile type.

Definition at line 813 of file cubfiles.h.

814 {
815 return false;
816 }

◆ count()

int chomp::homengin::cubitmap::count ( ) const
virtual

How many cubes are there in the set?

Reimplemented from chomp::homengin::cubfile.

◆ describe()

static std::ostream & chomp::homengin::cubitmap::describe ( std::ostream &  out)
static

Describes this particular type of a set of cubes.

◆ elementary()

bool chomp::homengin::cubitmap::elementary ( ) const
inlinevirtual

Is this a set of elementary cubes, as opposed to full cubes?

Reimplemented from chomp::homengin::cubfile.

Definition at line 798 of file cubfiles.h.

799 {
800 return false;
801 }

◆ name()

static const char * chomp::homengin::cubitmap::name ( )
inlinestatic

The name of this type of a cubical set.

Definition at line 804 of file cubfiles.h.

805 {
806 return "bitmap buffer (memory)";
807 }

◆ readcubes() [1/3]

int chomp::homengin::cubitmap::readcubes ( chomp::homology::CubicalComplex s) const
inlinevirtual

Reads a set of cubical cells from the file.

Reimplemented from chomp::homengin::cubfile.

Definition at line 819 of file cubfiles.h.

820 {
821 throw "Trying to read a set of cells from a bitmap buffer.";
822 }

◆ readcubes() [2/3]

int chomp::homengin::cubitmap::readcubes ( chomp::homology::SetOfCubes s) const
virtual

Read a cubical set from the file.

Reimplemented from chomp::homengin::cubfile.

◆ readcubes() [3/3]

int chomp::homengin::cubitmap::readcubes ( int *&  sizes,
char *&  bytes,
int  padding = 0,
bool  power2 = false 
) const
virtual

Reads a bitmap from a file.

Reimplemented from chomp::homengin::cubfile.

Member Data Documentation

◆ buf

const char* chomp::homengin::cubitmap::buf
private

The actual bitmap buffer.

Definition at line 833 of file cubfiles.h.

◆ buflength

int chomp::homengin::cubitmap::buflength
private

The length of the buffer in bytes.

Definition at line 836 of file cubfiles.h.

Referenced by cubitmap().


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