TuttleOFX  1
sequenceParser::Sequence Class Reference

A sequence of numbered files. More...

#include <Sequence.hpp>

Inheritance diagram for sequenceParser::Sequence:
Collaboration diagram for sequenceParser::Sequence:

Public Types

enum  EPattern {
  ePatternNone = 0, ePatternStandard = 1, ePatternCStyle = ePatternStandard * 2, ePatternFrame = ePatternCStyle * 2,
  ePatternFrameNeg = ePatternFrame * 2, ePatternDefault = ePatternCStyle + ePatternStandard, ePatternAll = ePatternCStyle + ePatternStandard + ePatternFrameNeg
}

Public Member Functions

 Sequence ()
 Sequence (const boost::filesystem::path &directory, const std::string &prefix, const std::size_t padding, const std::string &suffix, const Time firstTime, const Time lastTime, const Time step=1, const EMaskOptions options=eMaskOptionsDefault, const bool strictPadding=false)
 Sequence (const boost::filesystem::path &directory, const std::string &pattern, const Time firstTime, const Time lastTime, const Time step, const EMaskOptions options=eMaskOptionsDefault, const EPattern accept=ePatternDefault)
 Sequence (const boost::filesystem::path &directory, const Time firstTime, const Time lastTime, const Time step, const EMaskOptions options=eMaskOptionsDefault, const EPattern accept=ePatternDefault)
 Sequence (const boost::filesystem::path &directory, const EMaskOptions options=eMaskOptionsDefault, const EPattern accept=ePatternDefault)
 Sequence (const Sequence &v)
 Sequence (const boost::filesystem::path &directory, const Sequence &v, const EMaskOptions &options)
 ~Sequence ()
Sequenceoperator= (const Sequence &other)
Sequenceclone () const
bool initFromPattern (const boost::filesystem::path &dir, const std::string &pattern, const Time firstTime, const Time lastTime, const Time step, const EMaskOptions options=eMaskOptionsDefault, const EPattern accept=ePatternDefault)
 Construct a sequence from a pattern and given informations.
bool initFromDetection (const std::string &pattern, const EPattern accept=ePatternDefault)
 Init from directory and pattern.
bool initFromDetection (const EPattern &accept=ePatternDefault)
 Init from full pattern.
void extractStep (const std::set< std::size_t > &steps)
 Find the biggest common step from a set of all steps.
void extractStep (const std::vector< Time > &times)
 Extract step from a sorted vector of time values.
void extractStep (const std::vector< detail::FileNumbers >::const_iterator &timesBegin, const std::vector< detail::FileNumbers >::const_iterator &timesEnd, const std::size_t i)
 Extract step from a sorted vector of time values.
std::size_t getPaddingFromStringNumber (const std::string &timeStr)
void extractPadding (const std::vector< std::string > &timesStr)
 extract the padding from a vector of frame numbers
void extractPadding (const std::vector< detail::FileNumbers >::const_iterator &timesBegin, const std::vector< detail::FileNumbers >::const_iterator &timesEnd, const std::size_t i)
void extractIsStrictPadding (const std::vector< std::string > &timesStr, const std::size_t padding)
 return if the padding is strict (at least one frame begins with a '0' padding character).
void extractIsStrictPadding (const std::vector< detail::FileNumbers > &times, const std::size_t i, const std::size_t padding)
std::string getAbsoluteFilenameAt (const Time time) const
std::string getFilenameAt (const Time time) const
std::string getFirstFilename () const
std::string getAbsoluteFirstFilename () const
std::string getAbsoluteLastFilename () const
char getPatternCharacter () const
std::string getStandardPattern () const
std::string getAbsoluteStandardPattern () const
std::string getCStylePattern () const
std::string getAbsoluteCStylePattern () const
std::pair< Time, TimegetRange () const
std::size_t getStep () const
Time getFirstTime () const
Time getLastTime () const
std::size_t getDuration () const
Time getNbFiles () const
std::size_t getPadding () const
bool isStrictPadding () const
bool hasMissingFile () const
std::size_t getNbMissingFiles () const
std::string getIdentification () const
 filename without frame number
std::string getPrefix () const
std::string getSuffix () const
bool isIn (const std::string &filename, Time &time, std::string &timeStr)
 Check if the filename is inside the sequence and return it's time value.
EPattern checkPattern (const std::string &pattern)
bool operator< (const Sequence &other) const
bool operator== (const Sequence &other) const
bool operator!= (const Sequence &other) const

Data Fields

std::string _prefix
 filename prefix
std::string _suffix
 filename suffix
bool _strictPadding
std::size_t _padding
 padding, no padding if 0, fixed padding otherwise
std::size_t _step
 step
Time _firstTime
 begin time
Time _lastTime
 end time
std::size_t _nbFiles
 number of frames

Static Public Attributes

static const char _fillCar = '0'
 Filling character.

Protected Member Functions

bool retrieveInfosFromPattern (const std::string &pattern, const EPattern &accept, std::string &prefix, std::string &suffix, std::size_t &padding, bool &strictPadding) const
 Partial initialization, using only pattern informations.
void clear ()

Private Member Functions

void init (const std::string &prefix, const std::size_t padding, const std::string &suffix, const Time firstTime, const Time lastTime, const Time step=1, const bool strictPadding=false)
 Construct a sequence from a pattern and given informations.
bool init (const std::string &pattern, const Time firstTime, const Time lastTime, const Time step, const EPattern accept=ePatternDefault)
 Construct a sequence from a pattern and given informations.
bool init (const Time firstTime, const Time lastTime, const Time step, const EPattern accept=ePatternDefault)
 Construct a sequence from a pattern and given informations.
std::ostream & getCout (std::ostream &os) const
std::vector
< boost::filesystem::path > 
getFiles () const

Detailed Description

A sequence of numbered files.

Definition at line 20 of file Sequence.hpp.


Member Enumeration Documentation

List all recognized pattern types.

Enumerator:
ePatternNone 
ePatternStandard 
ePatternCStyle 
ePatternFrame 
ePatternFrameNeg 
ePatternDefault 
ePatternAll 

Definition at line 27 of file Sequence.hpp.


Constructor & Destructor Documentation

sequenceParser::Sequence::Sequence ( ) [inline]

Definition at line 40 of file Sequence.hpp.

References clear().

Referenced by clone().

Here is the call graph for this function:

sequenceParser::Sequence::Sequence ( const boost::filesystem::path &  directory,
const std::string &  prefix,
const std::size_t  padding,
const std::string &  suffix,
const Time  firstTime,
const Time  lastTime,
const Time  step = 1,
const EMaskOptions  options = eMaskOptionsDefault,
const bool  strictPadding = false 
) [inline]

Definition at line 46 of file Sequence.hpp.

References init().

Here is the call graph for this function:

sequenceParser::Sequence::Sequence ( const boost::filesystem::path &  directory,
const std::string &  pattern,
const Time  firstTime,
const Time  lastTime,
const Time  step,
const EMaskOptions  options = eMaskOptionsDefault,
const EPattern  accept = ePatternDefault 
) [inline]

Definition at line 52 of file Sequence.hpp.

References init().

Here is the call graph for this function:

sequenceParser::Sequence::Sequence ( const boost::filesystem::path &  directory,
const Time  firstTime,
const Time  lastTime,
const Time  step,
const EMaskOptions  options = eMaskOptionsDefault,
const EPattern  accept = ePatternDefault 
) [inline]

Definition at line 58 of file Sequence.hpp.

References init().

Here is the call graph for this function:

sequenceParser::Sequence::Sequence ( const boost::filesystem::path &  directory,
const EMaskOptions  options = eMaskOptionsDefault,
const EPattern  accept = ePatternDefault 
)
Todo:
check if we put a pattern with full path: /home/foo/images/foo.####.jpg

Definition at line 60 of file Sequence.cpp.

References clear(), and initFromDetection().

Here is the call graph for this function:

sequenceParser::Sequence::Sequence ( const Sequence v) [inline]

Definition at line 69 of file Sequence.hpp.

References operator=().

Here is the call graph for this function:

sequenceParser::Sequence::Sequence ( const boost::filesystem::path &  directory,
const Sequence v,
const EMaskOptions options 
) [inline]

Definition at line 74 of file Sequence.hpp.

References sequenceParser::FileObject::_options, operator=(), and sequenceParser::FileObject::setDirectory().

Here is the call graph for this function:

sequenceParser::Sequence::~Sequence ( )

Definition at line 56 of file Sequence.cpp.


Member Function Documentation

void sequenceParser::Sequence::clear ( ) [inline, protected, virtual]

Reimplemented from sequenceParser::FileObject.

Definition at line 283 of file Sequence.hpp.

References _firstTime, _lastTime, _nbFiles, _padding, _prefix, _step, and _suffix.

Referenced by initFromDetection(), and Sequence().

Sequence* sequenceParser::Sequence::clone ( ) const [inline, virtual]

Implements sequenceParser::FileObject.

Definition at line 97 of file Sequence.hpp.

References Sequence().

Here is the call graph for this function:

void sequenceParser::Sequence::extractIsStrictPadding ( const std::vector< std::string > &  timesStr,
const std::size_t  padding 
)

return if the padding is strict (at least one frame begins with a '0' padding character).

Parameters:
[in]timesStrvector of frame numbers in string format
[in]paddingpreviously detected padding

Definition at line 361 of file Sequence.cpp.

References _strictPadding.

Referenced by initFromDetection().

void sequenceParser::Sequence::extractIsStrictPadding ( const std::vector< detail::FileNumbers > &  times,
const std::size_t  i,
const std::size_t  padding 
)

Definition at line 380 of file Sequence.cpp.

References _strictPadding, and sequenceParser::detail::FileNumbers::getString().

Here is the call graph for this function:

void sequenceParser::Sequence::extractPadding ( const std::vector< std::string > &  timesStr)

extract the padding from a vector of frame numbers

Parameters:
[in]timesStrvector of frame numbers in string format

Definition at line 306 of file Sequence.cpp.

References _padding, and getPaddingFromStringNumber().

Referenced by initFromDetection().

Here is the call graph for this function:

void sequenceParser::Sequence::extractPadding ( const std::vector< detail::FileNumbers >::const_iterator &  timesBegin,
const std::vector< detail::FileNumbers >::const_iterator &  timesEnd,
const std::size_t  i 
)

Definition at line 322 of file Sequence.cpp.

References _padding.

void sequenceParser::Sequence::extractStep ( const std::set< std::size_t > &  steps)

Find the biggest common step from a set of all steps.

Definition at line 238 of file Sequence.cpp.

References _step, and sequenceParser::greatestCommonDivisor().

Referenced by extractStep(), initFromDetection(), and sequenceParser::privateBuildSequence().

Here is the call graph for this function:

void sequenceParser::Sequence::extractStep ( const std::vector< Time > &  times)

Extract step from a sorted vector of time values.

Definition at line 256 of file Sequence.cpp.

References _step, and extractStep().

Here is the call graph for this function:

void sequenceParser::Sequence::extractStep ( const std::vector< detail::FileNumbers >::const_iterator &  timesBegin,
const std::vector< detail::FileNumbers >::const_iterator &  timesEnd,
const std::size_t  i 
)

Extract step from a sorted vector of time values.

Definition at line 274 of file Sequence.cpp.

References _step, and extractStep().

Here is the call graph for this function:

std::string Sequence::getAbsoluteCStylePattern ( ) const [inline]

Definition at line 83 of file Sequence.tcc.

std::string sequenceParser::Sequence::getAbsoluteFilenameAt ( const Time  time) const [inline]
std::string sequenceParser::Sequence::getAbsoluteFirstFilename ( ) const [inline]
std::string Sequence::getAbsoluteLastFilename ( ) const [inline]

Definition at line 49 of file Sequence.tcc.

std::string Sequence::getAbsoluteStandardPattern ( ) const [inline]

Definition at line 68 of file Sequence.tcc.

Referenced by operator<(), and sammvcp().

std::string Sequence::getCStylePattern ( ) const [inline]
Returns:
a string pattern using C Style

Definition at line 75 of file Sequence.tcc.

std::size_t Sequence::getDuration ( ) const [inline]

Definition at line 108 of file Sequence.tcc.

std::string Sequence::getFilenameAt ( const Time  time) const [inline]

Definition at line 28 of file Sequence.tcc.

std::vector< boost::filesystem::path > sequenceParser::Sequence::getFiles ( ) const [private, virtual]
Todo:
: can we remove this?

Implements sequenceParser::FileObject.

Definition at line 434 of file Sequence.cpp.

References getAbsoluteFilenameAt(), getFirstTime(), getLastTime(), and getStep().

Here is the call graph for this function:

std::string Sequence::getFirstFilename ( ) const [inline]

Definition at line 23 of file Sequence.tcc.

std::string Sequence::getIdentification ( ) const [inline]

filename without frame number

Definition at line 142 of file Sequence.tcc.

Time Sequence::getNbFiles ( ) const [inline]

Definition at line 113 of file Sequence.tcc.

Referenced by getCout().

std::size_t Sequence::getNbMissingFiles ( ) const [inline]

Definition at line 133 of file Sequence.tcc.

Referenced by getCout().

std::size_t Sequence::getPadding ( ) const [inline]

Definition at line 118 of file Sequence.tcc.

Referenced by BOOST_AUTO_TEST_CASE().

std::size_t sequenceParser::Sequence::getPaddingFromStringNumber ( const std::string &  timeStr)

Definition at line 289 of file Sequence.cpp.

Referenced by extractPadding().

char Sequence::getPatternCharacter ( ) const [inline]
Returns:
pattern character in standard style

Definition at line 56 of file Sequence.tcc.

std::string Sequence::getPrefix ( ) const [inline]

Definition at line 147 of file Sequence.tcc.

std::pair< Time, Time > Sequence::getRange ( ) const [inline]

Definition at line 88 of file Sequence.tcc.

std::string Sequence::getStandardPattern ( ) const [inline]
Returns:
a string pattern using standard style

Definition at line 63 of file Sequence.tcc.

Referenced by getCout().

std::size_t Sequence::getStep ( ) const [inline]

Definition at line 93 of file Sequence.tcc.

Referenced by BOOST_AUTO_TEST_CASE(), copy_sequence(), getCout(), getFiles(), and removeSequence().

std::string Sequence::getSuffix ( ) const [inline]

Definition at line 152 of file Sequence.tcc.

bool Sequence::hasMissingFile ( ) const [inline]

Definition at line 128 of file Sequence.tcc.

Referenced by getCout().

void sequenceParser::Sequence::init ( const std::string &  prefix,
const std::size_t  padding,
const std::string &  suffix,
const Time  firstTime,
const Time  lastTime,
const Time  step = 1,
const bool  strictPadding = false 
) [private]

Construct a sequence from a pattern and given informations.

Warning:
No check on your filesystem.
the directory must be set

Definition at line 160 of file Sequence.cpp.

References _firstTime, _lastTime, _nbFiles, _padding, _prefix, _step, _strictPadding, and _suffix.

Referenced by Sequence().

bool sequenceParser::Sequence::init ( const std::string &  pattern,
const Time  firstTime,
const Time  lastTime,
const Time  step,
const EPattern  accept = ePatternDefault 
) [private]

Construct a sequence from a pattern and given informations.

Warning:
No check on your filesystem.
the directory must be set

Definition at line 172 of file Sequence.cpp.

References _firstTime, _lastTime, _nbFiles, _padding, _prefix, _step, _strictPadding, _suffix, and retrieveInfosFromPattern().

Here is the call graph for this function:

bool sequenceParser::Sequence::init ( const Time  firstTime,
const Time  lastTime,
const Time  step,
const EPattern  accept = ePatternDefault 
) [inline, private]

Construct a sequence from a pattern and given informations.

Warning:
No check on your filesystem.
the directory must be set
bool sequenceParser::Sequence::initFromDetection ( const std::string &  pattern,
const EPattern  accept = ePatternDefault 
)
bool sequenceParser::Sequence::initFromDetection ( const EPattern accept = ePatternDefault) [inline]

Init from full pattern.

Warning:
search on your filesystem, to detect the range.
bool Sequence::initFromPattern ( const boost::filesystem::path &  dir,
const std::string &  pattern,
const Time  firstTime,
const Time  lastTime,
const Time  step,
const EMaskOptions  options = eMaskOptionsDefault,
const EPattern  accept = ePatternDefault 
) [inline]

Construct a sequence from a pattern and given informations.

Warning:
No check on your filesystem.
the directory must be set

Definition at line 7 of file Sequence.tcc.

References init().

Referenced by sammvcp().

Here is the call graph for this function:

bool sequenceParser::Sequence::isIn ( const std::string &  filename,
Time time,
std::string &  timeStr 
)

Check if the filename is inside the sequence and return it's time value.

Parameters:
[out]time,:the time extract from the filename (only if contained in the sequence)
Returns:
if the filename is contained inside the sequence

Definition at line 67 of file Sequence.cpp.

References _prefix, _suffix, and tuttle::min().

Referenced by initFromDetection().

Here is the call graph for this function:

bool Sequence::isStrictPadding ( ) const [inline]

Definition at line 123 of file Sequence.tcc.

bool sequenceParser::Sequence::operator!= ( const Sequence other) const [inline]

Definition at line 262 of file Sequence.hpp.

References operator==().

Here is the call graph for this function:

bool sequenceParser::Sequence::operator< ( const Sequence other) const [inline]

Definition at line 236 of file Sequence.hpp.

References getAbsoluteStandardPattern().

Here is the call graph for this function:

Sequence& sequenceParser::Sequence::operator= ( const Sequence other) [inline]

Definition at line 83 of file Sequence.hpp.

References _firstTime, _lastTime, _nbFiles, _padding, _prefix, _step, _strictPadding, and _suffix.

Referenced by Sequence().

bool sequenceParser::Sequence::operator== ( const Sequence other) const [inline]

Definition at line 241 of file Sequence.hpp.

References _firstTime, _lastTime, _nbFiles, _padding, _prefix, _step, and _suffix.

Referenced by operator!=().

bool sequenceParser::Sequence::retrieveInfosFromPattern ( const std::string &  filePattern,
const EPattern accept,
std::string &  prefix,
std::string &  suffix,
std::size_t &  padding,
bool &  strictPadding 
) const [protected]

Partial initialization, using only pattern informations.

This function creates a regex from the pattern, and init internal values.

Warning:
You don't have all informations like range, directory, etc.
Parameters:
[in]pattern
[in]accept
[out]prefix
[out]suffix
[out]padding
[out]strictPadding

Definition at line 120 of file Sequence.cpp.

References ePatternCStyle, ePatternFrame, ePatternFrameNeg, ePatternStandard, sequenceParser::regexPatternCStyle(), sequenceParser::regexPatternFrame(), sequenceParser::regexPatternFrameNeg(), and sequenceParser::regexPatternStandard().

Referenced by init(), and initFromDetection().

Here is the call graph for this function:


Field Documentation

const char sequenceParser::Sequence::_fillCar = '0' [static]

Filling character.

Definition at line 304 of file Sequence.hpp.

padding, no padding if 0, fixed padding otherwise

Definition at line 299 of file Sequence.hpp.

Referenced by clear(), extractPadding(), init(), initFromDetection(), operator=(), operator==(), and sequenceParser::privateBuildSequence().

step

Definition at line 300 of file Sequence.hpp.

Referenced by clear(), extractStep(), init(), operator=(), and operator==().


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