DirectoryScanner Class Reference

List of all members.

Detailed Description

Helper class to extract the names, frame numbers, and timestamps of all the conforming files in a directory.

Filenames are expected to look like: [prefix]'-'[integer frame number]'-'[string device id]'-'[floating point timestamp w/microsecond precision].[fileextension]

If the standard file naming practices of the datacollection modules change, this should also change. It may be sensible to place the timestamp after the prefix.

Definition at line 55 of file DirectoryLoader.H.

Public Member Functions

 DirectoryScanner (std::string path, std::string pattern1, std::string pattern2)
 Standard way to call: DirectoryScanner(path,device id,extension).
 DirectoryScanner (std::string path)
 DirectoryScanner ()
void setPath (std::string path)
std::vector< FileEntrygetSortedFileList ()
 Output function.
void addPattern (const std::string &val)
 Add another pattern for the filter to check-- filterfunc uses strstr to locate the pattern.
void openDirectory ()
 Do the actual work by calling scandir, using the filter function.

Private Member Functions

int filterfunc (const struct dirent *entry)
 Comparison function for scandir.

Private Attributes

std::string m_path
std::vector< std::string > m_patterns
std::vector< FileEntrym_files


Constructor & Destructor Documentation

DirectoryScanner ( std::string  path,
std::string  pattern1,
std::string  pattern2 
) [inline]

Standard way to call: DirectoryScanner(path,device id,extension).

Definition at line 60 of file DirectoryLoader.H.

References DirectoryScanner::m_path, and DirectoryScanner::m_patterns.

DirectoryScanner ( std::string  path  )  [inline, explicit]

Definition at line 66 of file DirectoryLoader.H.

References DirectoryScanner::m_path.

DirectoryScanner (  )  [inline]

Definition at line 70 of file DirectoryLoader.H.


Member Function Documentation

void setPath ( std::string  path  )  [inline]

Definition at line 72 of file DirectoryLoader.H.

References DirectoryScanner::m_path.

Referenced by WURDEPlaybackCamera::init(), and WURDEPlaybackCamera::setDirectory().

std::vector<FileEntry> getSortedFileList (  )  [inline]

Output function.

Definition at line 77 of file DirectoryLoader.H.

References DirectoryScanner::m_files.

Referenced by WURDEPlaybackCamera::init().

void addPattern ( const std::string &  val  )  [inline]

Add another pattern for the filter to check-- filterfunc uses strstr to locate the pattern.

Definition at line 85 of file DirectoryLoader.H.

References DirectoryScanner::m_patterns.

Referenced by WURDEPlaybackCamera::addPattern(), and WURDEPlaybackCamera::init().

void openDirectory (  )  [inline]

Do the actual work by calling scandir, using the filter function.

Definition at line 93 of file DirectoryLoader.H.

References FileEntry::filename, WURDE::g_logdebug, WURDE::g_logerror, WURDE::g_logwarn, FileEntry::index, DirectoryScanner::m_files, DirectoryScanner::m_path, DirectoryScanner::m_patterns, Time::setSeconds(), Time::setUSeconds(), and FileEntry::timestamp.

Referenced by WURDEPlaybackCamera::init().

int filterfunc ( const struct dirent *  entry  )  [inline, private]

Comparison function for scandir.

Definition at line 174 of file DirectoryLoader.H.

References DirectoryScanner::m_patterns.


Member Data Documentation

std::string m_path [private]

Definition at line 170 of file DirectoryLoader.H.

Referenced by DirectoryScanner::DirectoryScanner(), DirectoryScanner::openDirectory(), and DirectoryScanner::setPath().

std::vector<std::string> m_patterns [private]

Definition at line 182 of file DirectoryLoader.H.

Referenced by DirectoryScanner::addPattern(), DirectoryScanner::DirectoryScanner(), DirectoryScanner::filterfunc(), and DirectoryScanner::openDirectory().

std::vector<FileEntry> m_files [private]

Definition at line 183 of file DirectoryLoader.H.

Referenced by DirectoryScanner::getSortedFileList(), and DirectoryScanner::openDirectory().


The documentation for this class was generated from the following file:
Generated on Thu Feb 1 15:31:56 2007 for WURDE by  doxygen 1.5.1