Image Component Library (ICL)
Public Member Functions | Static Public Attributes | List of all members
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 >

Public Member Functions

 FilenameGenerator ()
 Null constructor. More...
 
 ~FilenameGenerator ()
 Destructor. More...
 
 FilenameGenerator (const std::string &pattern, int maxFiles=-1)
 generate a new filename list with given maxFiles More...
 
 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 More...
 
std::string next ()
 returns the next file from the list More...
 
std::string showNext () const
 returns the next file without incrementing the internal counter (preview of next filename) More...
 
int filesLeft () const
 returns the number of files left (-1) if the FileList's length is infinite More...
 
void reset ()
 must be called if if files left is < 0 More...
 
std::vector< std::string > getList ()
 returns a list of all files (only if the count if files if finite) More...
 
void show ()
 shows all files to if( the filelist is finite, the 10 first files are show); More...
 
- Public Member Functions inherited from icl::utils::ShallowCopyable< FilenameGeneratorImpl, FilenameGeneratorImplDelOp >
bool isNull () const
 returns wheter the objects implementation holds a null pointer More...
 

Static Public Attributes

static const int INFINITE_FILE_COUNT
 

Additional Inherited Members

- Public Types inherited from icl::utils::ShallowCopyable< FilenameGeneratorImpl, FilenameGeneratorImplDelOp >
typedef ShallowCopyable< FilenameGeneratorImpl, FilenameGeneratorImplDelOp > ParentSC
 
- Protected Member Functions inherited from icl::utils::ShallowCopyable< FilenameGeneratorImpl, FilenameGeneratorImplDelOp >
 ShallowCopyable (FilenameGeneratorImpl *t=0)
 create a the implementation with a given T* value More...
 
- Protected Attributes inherited from icl::utils::ShallowCopyable< FilenameGeneratorImpl, FilenameGeneratorImplDelOp >
SmartPtrBase< FilenameGeneratorImpl, FilenameGeneratorImplDelOp > impl
 shared pointer for the classes implementation More...
 

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

◆ FilenameGenerator() [1/3]

icl::io::FilenameGenerator::FilenameGenerator ( )

Null constructor.

◆ ~FilenameGenerator()

icl::io::FilenameGenerator::~FilenameGenerator ( )

Destructor.

◆ FilenameGenerator() [2/3]

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, ... }

◆ FilenameGenerator() [3/3]

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

◆ filesLeft()

int icl::io::FilenameGenerator::filesLeft ( ) const

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

◆ getList()

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

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

◆ next()

std::string icl::io::FilenameGenerator::next ( )

returns the next file from the list

◆ reset()

void icl::io::FilenameGenerator::reset ( )

must be called if if files left is < 0

◆ show()

void icl::io::FilenameGenerator::show ( )

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

◆ showNext()

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

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

Member Data Documentation

◆ INFINITE_FILE_COUNT

const int icl::io::FilenameGenerator::INFINITE_FILE_COUNT
static

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