MPEG CDVA Experimentation Model (CXM)  1.0
Compact Descriptors for Visual Analisys
Public Member Functions | Static Public Member Functions
mpeg7cdva::FileManager Class Reference

Helper class to manage lists of file names. More...

#include <FileManager.h>

Public Member Functions

 FileManager (const char *annotationpathname, int level=0)
 Read the list of images from the given annotation file. More...
 
virtual ~FileManager ()
 
std::string getDatasetPath () const
 Get the dataset base directory. More...
 
std::string getDatasetName () const
 Get the dataset name. More...
 
std::string getDatasetPathName () const
 Get the dataset full pathname. More...
 
void setWorkspaceDir (const char *workdir)
 Set the workspace directory. More...
 
std::string getWorkspaceDir () const
 Get the workspace directory. More...
 
size_t getDatasetSize () const
 Get the dataset size. More...
 
std::string replaceExt (const std::string &imageName, const char *ext) const
 Convert a pathname into a pathname with the given extension. More...
 
std::string getQueryName (size_t i, bool absolutePathname=true) const
 Get the first image name found at the i-th position in the annotation file. More...
 
std::string getReferenceName (size_t i, bool absolutePathname=true) const
 Get the second image name found at the i-th position in the annotation file. More...
 
int countNames (size_t i) const
 Count how many pathnames are contained in the i-th line. More...
 

Static Public Member Functions

static std::string replacePath (const std::string &imageName, const char *newpath)
 Convert a pathname into a pathname with the given new path. More...
 

Detailed Description

Helper class to manage lists of file names.

Author
Massimo Balestri
Date
2012

Constructor & Destructor Documentation

◆ FileManager()

mpeg7cdva::FileManager::FileManager ( const char *  annotationpathname,
int  level = 0 
)

Read the list of images from the given annotation file.

Parameters
annotationpathnamethe pathname of the annotation text file containing the list of images.
levelthe recursion level (to avoid infinite loops); must be zero when called the first time.

◆ ~FileManager()

virtual mpeg7cdva::FileManager::~FileManager ( )
virtual

Member Function Documentation

◆ countNames()

int mpeg7cdva::FileManager::countNames ( size_t  i) const

Count how many pathnames are contained in the i-th line.

Parameters
ithe index of the image in the annotation file.
Returns
the number of pathnames found.

◆ getDatasetName()

std::string mpeg7cdva::FileManager::getDatasetName ( ) const

Get the dataset name.

Returns
the dataset name

◆ getDatasetPath()

std::string mpeg7cdva::FileManager::getDatasetPath ( ) const

Get the dataset base directory.

Returns
the dataset path

◆ getDatasetPathName()

std::string mpeg7cdva::FileManager::getDatasetPathName ( ) const

Get the dataset full pathname.

Returns
the dataset pathname

◆ getDatasetSize()

size_t mpeg7cdva::FileManager::getDatasetSize ( ) const

Get the dataset size.

Returns
the number of lines read from the filename.

◆ getQueryName()

std::string mpeg7cdva::FileManager::getQueryName ( size_t  i,
bool  absolutePathname = true 
) const

Get the first image name found at the i-th position in the annotation file.

The image name is provided as an absolute pathname.

Parameters
ithe index of the image in the annotation file.
absolutePathnameif true, the absolute pathname of the file is returned; otherwise, the relative pathname is returned.
Returns
the relative or absolute pathname of the image.

◆ getReferenceName()

std::string mpeg7cdva::FileManager::getReferenceName ( size_t  i,
bool  absolutePathname = true 
) const

Get the second image name found at the i-th position in the annotation file.

The image name is provided as an absolute pathname.

Parameters
ithe index of the image in the annotation file.
absolutePathnameif true, the absolute pathname of the file is returned; otherwise, the relative pathname is returned.
Returns
the relative or absolute pathname of the image.

◆ getWorkspaceDir()

std::string mpeg7cdva::FileManager::getWorkspaceDir ( ) const

Get the workspace directory.

This is the directory where output files will be stored.

Returns
the workspace directory

◆ replaceExt()

std::string mpeg7cdva::FileManager::replaceExt ( const std::string &  imageName,
const char *  ext 
) const

Convert a pathname into a pathname with the given extension.

Parameters
imageNamethe original image/video name;
extnew extension;
Returns
the modified pathname.

◆ replacePath()

static std::string mpeg7cdva::FileManager::replacePath ( const std::string &  imageName,
const char *  newpath 
)
static

Convert a pathname into a pathname with the given new path.

Parameters
imageNamethe original image name;
newpaththe new path;
Returns
the modified pathname.

◆ setWorkspaceDir()

void mpeg7cdva::FileManager::setWorkspaceDir ( const char *  workdir)

Set the workspace directory.

This is the directory where output files will be stored.

Parameters
workdirthe workspace directory

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