TuttleOFX
1
|
A sequence of numbered files. More...
#include <Sequence.hpp>
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 () | |
Sequence & | operator= (const Sequence &other) |
Sequence * | clone () 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 > ×) |
Extract step from a sorted vector of time values. | |
void | extractStep (const std::vector< detail::FileNumbers >::const_iterator ×Begin, const std::vector< detail::FileNumbers >::const_iterator ×End, 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 > ×Str) |
extract the padding from a vector of frame numbers | |
void | extractPadding (const std::vector< detail::FileNumbers >::const_iterator ×Begin, const std::vector< detail::FileNumbers >::const_iterator ×End, const std::size_t i) |
void | extractIsStrictPadding (const std::vector< std::string > ×Str, 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 > ×, 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, Time > | getRange () 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 |
A sequence of numbered files.
Definition at line 20 of file Sequence.hpp.
List all recognized pattern types.
ePatternNone | |
ePatternStandard | |
ePatternCStyle | |
ePatternFrame | |
ePatternFrameNeg | |
ePatternDefault | |
ePatternAll |
Definition at line 27 of file Sequence.hpp.
sequenceParser::Sequence::Sequence | ( | ) | [inline] |
Definition at line 40 of file Sequence.hpp.
References clear().
Referenced by clone().
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().
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().
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().
sequenceParser::Sequence::Sequence | ( | const boost::filesystem::path & | directory, |
const EMaskOptions | options = eMaskOptionsDefault , |
||
const EPattern | accept = ePatternDefault |
||
) |
Definition at line 60 of file Sequence.cpp.
References clear(), and initFromDetection().
sequenceParser::Sequence::Sequence | ( | const Sequence & | v | ) | [inline] |
Definition at line 69 of file Sequence.hpp.
References operator=().
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().
sequenceParser::Sequence::~Sequence | ( | ) |
Definition at line 56 of file Sequence.cpp.
Sequence::EPattern sequenceParser::Sequence::checkPattern | ( | const std::string & | pattern | ) |
Definition at line 89 of file Sequence.cpp.
References sequenceParser::FileObject::_options, sequenceParser::eMaskOptionsNegativeIndexes, ePatternCStyle, ePatternFrame, ePatternFrameNeg, ePatternNone, ePatternStandard, sequenceParser::regexPatternCStyle(), sequenceParser::regexPatternFrame(), sequenceParser::regexPatternFrameNeg(), and sequenceParser::regexPatternStandard().
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().
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).
[in] | timesStr | vector of frame numbers in string format |
[in] | padding | previously 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().
void sequenceParser::Sequence::extractPadding | ( | const std::vector< std::string > & | timesStr | ) |
extract the padding from a vector of frame numbers
[in] | timesStr | vector of frame numbers in string format |
Definition at line 306 of file Sequence.cpp.
References _padding, and getPaddingFromStringNumber().
Referenced by initFromDetection().
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().
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().
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().
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::ostream & sequenceParser::Sequence::getCout | ( | std::ostream & | os | ) | const [private, virtual] |
Implements sequenceParser::FileObject.
Definition at line 399 of file Sequence.cpp.
References sequenceParser::FileObject::_directory, sequenceParser::FileObject::_kColorError, sequenceParser::FileObject::_kColorSequence, sequenceParser::FileObject::_kColorStd, getFirstTime(), getLastTime(), getNbFiles(), getNbMissingFiles(), getStandardPattern(), getStep(), hasMissingFile(), NAME_WIDTH, NAME_WIDTH_WITH_DIR, PROPERTIES_WIDTH, sequenceParser::FileObject::showAbsolutePath(), sequenceParser::FileObject::showProperties(), and sequenceParser::FileObject::showRelativePath().
std::string Sequence::getCStylePattern | ( | ) | const [inline] |
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] |
Implements sequenceParser::FileObject.
Definition at line 434 of file Sequence.cpp.
References getAbsoluteFilenameAt(), getFirstTime(), getLastTime(), and getStep().
std::string Sequence::getFirstFilename | ( | ) | const [inline] |
Definition at line 23 of file Sequence.tcc.
Time sequenceParser::Sequence::getFirstTime | ( | ) | const [inline] |
std::string Sequence::getIdentification | ( | ) | const [inline] |
filename without frame number
Definition at line 142 of file Sequence.tcc.
Time sequenceParser::Sequence::getLastTime | ( | ) | const [inline] |
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] |
Definition at line 56 of file Sequence.tcc.
std::string Sequence::getPrefix | ( | ) | const [inline] |
Definition at line 147 of file Sequence.tcc.
Definition at line 88 of file Sequence.tcc.
std::string Sequence::getStandardPattern | ( | ) | const [inline] |
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.
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.
Definition at line 172 of file Sequence.cpp.
References _firstTime, _lastTime, _nbFiles, _padding, _prefix, _step, _strictPadding, _suffix, and retrieveInfosFromPattern().
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.
bool sequenceParser::Sequence::initFromDetection | ( | const std::string & | pattern, |
const EPattern | accept = ePatternDefault |
||
) |
Init from directory and pattern.
Definition at line 184 of file Sequence.cpp.
References sequenceParser::FileObject::_directory, _firstTime, _lastTime, _nbFiles, _padding, _prefix, _strictPadding, _suffix, clear(), extractIsStrictPadding(), extractPadding(), extractStep(), isIn(), retrieveInfosFromPattern(), and sequenceParser::FileObject::setDirectoryFromPath().
Referenced by tuttle::plugin::ReaderPlugin::changedParam(), tuttle::plugin::WriterPlugin::changedParam(), main(), tuttle::plugin::ReaderPlugin::ReaderPlugin(), sammvcp(), Sequence(), and tuttle::plugin::WriterPlugin::WriterPlugin().
bool sequenceParser::Sequence::initFromDetection | ( | const EPattern & | accept = ePatternDefault | ) | [inline] |
Init from full pattern.
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.
Definition at line 7 of file Sequence.tcc.
References init().
Referenced by sammvcp().
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.
[out] | time,: | the time extract from the filename (only if contained in the sequence) |
Definition at line 67 of file Sequence.cpp.
References _prefix, _suffix, and tuttle::min().
Referenced by initFromDetection().
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==().
bool sequenceParser::Sequence::operator< | ( | const Sequence & | other | ) | const [inline] |
Definition at line 236 of file Sequence.hpp.
References getAbsoluteStandardPattern().
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.
[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().
const char sequenceParser::Sequence::_fillCar = '0' [static] |
Filling character.
Definition at line 304 of file Sequence.hpp.
begin time
Definition at line 301 of file Sequence.hpp.
Referenced by clear(), init(), initFromDetection(), operator=(), operator==(), and sequenceParser::privateBuildSequence().
end time
Definition at line 302 of file Sequence.hpp.
Referenced by clear(), init(), initFromDetection(), operator=(), operator==(), and sequenceParser::privateBuildSequence().
std::size_t sequenceParser::Sequence::_nbFiles |
number of frames
Definition at line 303 of file Sequence.hpp.
Referenced by clear(), init(), initFromDetection(), operator=(), operator==(), and sequenceParser::privateBuildSequence().
std::size_t sequenceParser::Sequence::_padding |
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().
std::string sequenceParser::Sequence::_prefix |
filename prefix
Definition at line 296 of file Sequence.hpp.
Referenced by clear(), init(), initFromDetection(), isIn(), operator=(), operator==(), and sequenceParser::privateBuildSequence().
std::size_t sequenceParser::Sequence::_step |
step
Definition at line 300 of file Sequence.hpp.
Referenced by clear(), extractStep(), init(), operator=(), and operator==().
Definition at line 298 of file Sequence.hpp.
Referenced by extractIsStrictPadding(), init(), initFromDetection(), operator=(), and sequenceParser::privateBuildSequence().
std::string sequenceParser::Sequence::_suffix |
filename suffix
Definition at line 297 of file Sequence.hpp.
Referenced by clear(), init(), initFromDetection(), isIn(), operator=(), operator==(), and sequenceParser::privateBuildSequence().