Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Attributes
icl::io::FilenameGenerator Class Reference

Utility class for generating a stream of filenames. More...

#include <FilenameGenerator.h>

Inheritance diagram for icl::io::FilenameGenerator:
icl::utils::ShallowCopyable< FilenameGeneratorImpl, FilenameGeneratorImplDelOp >

List of all members.

Public Member Functions

 FilenameGenerator ()
 Null constructor.
 ~FilenameGenerator ()
 Destructor.
 FilenameGenerator (const std::string &pattern, int maxFiles=-1)
 generate a new filename list with given maxFiles
 FilenameGenerator (const std::string &prefix, const std::string &postfix, int objectStart, int objectEnd, int imageStart, int imageEnd)
 generate a filename list with given prefix,postfix and object/image index range
std::string next ()
 returns the next file from the list
std::string showNext () const
 returns the next file without incrementing the internal counter (preview of next filename)
int filesLeft () const
 returns the number of files left (-1) if the FileList's length is infinite
void reset ()
 must be called if if files left is < 0
std::vector< std::string > getList ()
 returns a list of all files (only if the count if files if finite)
void show ()
 shows all files to if( the filelist is finite, the 10 first files are show);

Static Public Attributes

static const int INFINITE_FILE_COUNT

Detailed Description

Utility class for generating a stream of filenames.

This list can have a finite or an infinite size. The class provides functions to get the next filename (which inplicitly increases the internal counter), to get the count of remaining filenames and to reset the internal counter to first value.
The FilenameGenerator class extends the ShallowCopyable class interface to provide cheap-copies using reference counting.


Constructor & Destructor Documentation

Null constructor.

Destructor.

icl::io::FilenameGenerator::FilenameGenerator ( const std::string &  pattern,
int  maxFiles = -1 
)

generate a new filename list with given maxFiles

if the maxFile count is reached, the filegenerator is resetted internally and will produce start counting from the beginning on again. If maxFiles is -1, there is no stop criterion example:

          pattern = image_#.ppm 
          maxFiles = 10
          list = { image_0.ppm, image_1.ppm, ..., image_10.ppm }
          pattern = image_##.ppm
          maxFiles = 10
          list = { image_00.ppm, image_01.ppm, ..., image_10.ppm }
          pattern = image_#####.ppm.gz
          maxFiles = -1
          list = { image_00000.ppm.gz, image_00001.ppm.gz, ... }
          
icl::io::FilenameGenerator::FilenameGenerator ( const std::string &  prefix,
const std::string &  postfix,
int  objectStart,
int  objectEnd,
int  imageStart,
int  imageEnd 
)

generate a filename list with given prefix,postfix and object/image index range

example:

          prefix = "image_"
          postfix = ".ppm"
          objectStart = 0
          objectEnd = 5
          imageStart = 10
          imageEnd = 20
          list = { image_0__10.ppm, image_0__11.ppm, ..., image_0__20.ppm,
                   image_1__10.ppm, image_1__11.ppm, ..., image_1__20.ppm,
                   ...
                   image_5__10.ppm, image_5__11.ppm, ..., image_5__20.ppm }
          

Member Function Documentation

returns the number of files left (-1) if the FileList's length is infinite

std::vector<std::string> icl::io::FilenameGenerator::getList ( )

returns a list of all files (only if the count if files if finite)

returns the next file from the list

must be called if if files left is < 0

shows all files to if( the filelist is finite, the 10 first files are show);

std::string icl::io::FilenameGenerator::showNext ( ) const

returns the next file without incrementing the internal counter (preview of next filename)


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines