FEDEM Model Database  R8.0
Source code of the FEDEM model database
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
FmResultStatusData Class Reference

A class to store a directory structure. More...

#include <FmResultStatusData.H>

Public Member Functions

 FmResultStatusData (const std::string &name="noname")
 
 FmResultStatusData (const FmResultStatusData &ref)
 
 ~FmResultStatusData ()
 
FmResultStatusData & operator= (const FmResultStatusData &ref)
 
bool operator== (const FmResultStatusData &ref) const
 
void clear ()
 
void copy (const FmResultStatusData *obj)
 
bool addFile (const std::string &filename)
 
void addFiles (const std::vector< std::string > &files)
 
bool removeFile (const std::string &filename)
 
void removeFiles (const std::vector< std::string > &files)
 
void removeFiles (const std::set< std::string > &files)
 
bool ignoreFile (const std::string &filename)
 
void ignoreFiles (const std::vector< std::string > &files)
 
size_t syncFromRDB (const std::string &rdbDir, const std::string &taskName, int taskVer, std::set< std::string > *obsoleteFiles=NULL)
 Fills this RSD with data from the specified rdbDir on disk. More...
 
const std::set< std::string > & getFileSet () const
 
FmResultStatusData * addSubTask (const std::string &name)
 
FmResultStatusData * getSubTask (const std::string &name, int ver=0) const
 
bool isSubTask (const std::string &name) const
 
bool setPath (const std::string &path)
 
void setTaskName (const std::string &taskName)
 
bool setTaskVer (int taskVer)
 
void incrementTaskVer ()
 
std::string getCurrentTaskDirName (bool fullPath=false, bool checkTask=false) const
 
const std::string & getPath () const
 
const std::string & getTaskName () const
 
bool isNamed () const
 
int getTaskVer () const
 
bool isEmpty (bool resultFilesOnly=false) const
 
void write (std::ostream &os) const
 
void read (std::istream &is)
 
bool hasFileNames (const std::string &filter="", bool recursive=true) const
 
bool getAllFileNames (std::set< std::string > &fileNames, const std::string &filter="", bool withPath=true, bool recursive=true) const
 
std::string getFileNames (const std::string &filter, bool withPath=true, bool recur=true) const
 
bool getFrsFiles (std::set< std::string > &frsFiles, const std::string &rdbResultGroup="", bool silence=false) const
 
void getAllDirNames (std::set< std::string > &dirNames) const
 

Static Public Member Functions

static int getTaskVer (const std::string &baseName, size_t *pos=NULL)
 
static bool splitRDBName (const std::string &baseName, std::string &taskName, int &taskVer)
 

Private Types

typedef std::map< std::string, FmResultStatusData * > FmTaskMap
 
typedef FmTaskMap::const_iterator FmTaskIter
 

Private Member Functions

bool newPath (const std::string &prefix, size_t lenP)
 
void processTokens (const std::vector< std::string > &tokens)
 
size_t syncDisk (const std::string &rdbDir, const std::string &taskName, int taskVer, const std::string &nameFilter, std::set< std::string > *obsoleteFiles)
 

Private Attributes

std::string myPath
 
std::string myTaskName
 
unsigned short int myTaskVer
 
std::set< std::string > myFiles
 
FmTaskMap mySubTasks
 

Friends

std::ostream & operator<< (std::ostream &os, const FmResultStatusData &field)
 
std::istream & operator>> (std::istream &is, FmResultStatusData &field)
 

Detailed Description

A class to store a directory structure.

Contains a recursive hierarcy of itself. The directory naming convension is based on

<taskname>_####

Member Typedef Documentation

◆ FmTaskIter

typedef FmTaskMap::const_iterator FmResultStatusData::FmTaskIter
private

◆ FmTaskMap

typedef std::map<std::string,FmResultStatusData*> FmResultStatusData::FmTaskMap
private

Constructor & Destructor Documentation

◆ FmResultStatusData() [1/2]

FmResultStatusData::FmResultStatusData ( const std::string &  name = "noname")
inline

◆ FmResultStatusData() [2/2]

FmResultStatusData::FmResultStatusData ( const FmResultStatusData &  ref)
inline

◆ ~FmResultStatusData()

FmResultStatusData::~FmResultStatusData ( )

Member Function Documentation

◆ addFile()

bool FmResultStatusData::addFile ( const std::string &  fileName)

Adds the file named fileName to the RSD data structure by chopping off the first directory name in the path, adding it as sub-task, and then adding the rest of the fileName to that sub-task in a recursive manner.

◆ addFiles()

void FmResultStatusData::addFiles ( const std::vector< std::string > &  files)

◆ addSubTask()

FmResultStatusData * FmResultStatusData::addSubTask ( const std::string &  name)

◆ clear()

void FmResultStatusData::clear ( )

Clears the contents of the RSD. Preserves the path, taskName and version though.

◆ copy()

void FmResultStatusData::copy ( const FmResultStatusData *  obj)

Copies information from obj to this RSD object. All original data in this object are lost.

◆ getAllDirNames()

void FmResultStatusData::getAllDirNames ( std::set< std::string > &  dirNames) const

◆ getAllFileNames()

bool FmResultStatusData::getAllFileNames ( std::set< std::string > &  fileNames,
const std::string &  filter = "",
bool  withPath = true,
bool  recursive = true 
) const

Returns a sorted set of all file names in the RSD.

◆ getCurrentTaskDirName()

std::string FmResultStatusData::getCurrentTaskDirName ( bool  fullPath = false,
bool  checkTask = false 
) const

Returns the string "taskName_####" - identifier for the current directory. The full path of the directory may optionally be prepended.

◆ getFileNames()

std::string FmResultStatusData::getFileNames ( const std::string &  filter,
bool  withPath = true,
bool  recur = true 
) const

Returns all file names in the RSD as a ";"-separated list

◆ getFileSet()

const std::set<std::string>& FmResultStatusData::getFileSet ( ) const
inline

◆ getFrsFiles()

bool FmResultStatusData::getFrsFiles ( std::set< std::string > &  frsFiles,
const std::string &  rdbResultGroup = "",
bool  silence = false 
) const

◆ getPath()

const std::string& FmResultStatusData::getPath ( ) const
inline

◆ getSubTask()

FmResultStatusData * FmResultStatusData::getSubTask ( const std::string &  name,
int  ver = 0 
) const

◆ getTaskName()

const std::string& FmResultStatusData::getTaskName ( ) const
inline

◆ getTaskVer() [1/2]

int FmResultStatusData::getTaskVer ( ) const
inline

◆ getTaskVer() [2/2]

int FmResultStatusData::getTaskVer ( const std::string &  baseName,
size_t *  pos = NULL 
)
static

◆ hasFileNames()

bool FmResultStatusData::hasFileNames ( const std::string &  filter = "",
bool  recursive = true 
) const

Checks if the RSD has any file names.

◆ ignoreFile()

bool FmResultStatusData::ignoreFile ( const std::string &  fileName)

Ignores the file with full path fileName by incrementing the task version of the sub RSD that normally should contain that file.

◆ ignoreFiles()

void FmResultStatusData::ignoreFiles ( const std::vector< std::string > &  files)

◆ incrementTaskVer()

void FmResultStatusData::incrementTaskVer ( )
inline

◆ isEmpty()

bool FmResultStatusData::isEmpty ( bool  resultFilesOnly = false) const

◆ isNamed()

bool FmResultStatusData::isNamed ( ) const
inline

◆ isSubTask()

bool FmResultStatusData::isSubTask ( const std::string &  name) const

◆ newPath()

bool FmResultStatusData::newPath ( const std::string &  prefix,
size_t  lenP 
)
private

Replaces the first lenP characters of the current path of this task and all its sub tasks by prefix.

◆ operator=()

FmResultStatusData & FmResultStatusData::operator= ( const FmResultStatusData &  ref)

◆ operator==()

bool FmResultStatusData::operator== ( const FmResultStatusData &  ref) const

◆ processTokens()

void FmResultStatusData::processTokens ( const std::vector< std::string > &  tokens)
private

◆ read()

void FmResultStatusData::read ( std::istream &  is)

◆ removeFile()

bool FmResultStatusData::removeFile ( const std::string &  fileName)

Removes the file with full path fileName from the task hierarchy.

◆ removeFiles() [1/2]

void FmResultStatusData::removeFiles ( const std::set< std::string > &  files)

◆ removeFiles() [2/2]

void FmResultStatusData::removeFiles ( const std::vector< std::string > &  files)

◆ setPath()

bool FmResultStatusData::setPath ( const std::string &  path)
inline

◆ setTaskName()

void FmResultStatusData::setTaskName ( const std::string &  taskName)
inline

◆ setTaskVer()

bool FmResultStatusData::setTaskVer ( int  taskVer)

◆ splitRDBName()

bool FmResultStatusData::splitRDBName ( const std::string &  baseName,
std::string &  taskName,
int &  taskVer 
)
static

◆ syncDisk()

size_t FmResultStatusData::syncDisk ( const std::string &  rdbDir,
const std::string &  taskName,
int  taskVer,
const std::string &  nameFilter,
std::set< std::string > *  obsoleteFiles 
)
private

◆ syncFromRDB()

size_t FmResultStatusData::syncFromRDB ( const std::string &  rdbDir,
const std::string &  taskName,
int  taskVer,
std::set< std::string > *  obsoleteFiles = NULL 
)

Fills this RSD with data from the specified rdbDir on disk.

Returns
Total number of files found

◆ write()

void FmResultStatusData::write ( std::ostream &  os) const

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const FmResultStatusData &  field 
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  is,
FmResultStatusData &  field 
)
friend

Member Data Documentation

◆ myFiles

std::set<std::string> FmResultStatusData::myFiles
private

◆ myPath

std::string FmResultStatusData::myPath
private

◆ mySubTasks

FmTaskMap FmResultStatusData::mySubTasks
private

◆ myTaskName

std::string FmResultStatusData::myTaskName
private

◆ myTaskVer

unsigned short int FmResultStatusData::myTaskVer
private

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