creaImageIO::TreeHandlerImageAdder Class Reference
[Model]

Object which can add images files to a TreeHandler. Is able to parse (recursively) a part of a filesystem to look for known images and load their attributes in order to add the images to a Tree (submission via a TreeHandler::AddBranch). More...

#include <creaImageIOTreeHandlerImageAdder.h>

Collaboration diagram for creaImageIO::TreeHandlerImageAdder:

Collaboration graph
[legend]

List of all members.

Public Types

typedef
boost::signal< void(Progress &)> 
ProgressSignalType
typedef
ProgressSignalType::slot_function_type 
ProgressCallbackType

Public Member Functions

 TreeHandlerImageAdder (TreeHandler *tree)
 Ctor.
 ~TreeHandlerImageAdder ()
 Dtor.
void SetTreeHandler (TreeHandler *tree)
 Sets the TreeHandler.
void SetTimestampHandler (TimestampDatabaseHandler *tdh)
 Sets the TimestampDatabaseHandler.
void SetSynchronizer (Synchronizer *s)
 Sets the synchronizer.
void SetCurrentDatabase (std::string cur)
 Sets the synchronizer.
const ProgressGetProgress () const
void ConnectProgressObserver (ProgressCallbackType callback)
bool IsHandledFile (const std::string &filename)
 Returns if the file can be read or not.
void AddFiles (const std::vector< std::string > &filename)
 Adds a list of files to the TreeHandler.
void AddDirectory (const std::string &directory, bool recurse)
 (Recursively) adds the files of a directory to the TreeHandler
void RemoveFile (tree::Node *node)
 Removes a file from the databases.
void RemoveFiles (const std::vector< tree::Node * > &nodes)
 Removes files from the databases.
std::string Synchronize (bool repair, bool checkAttributes)
 Synchronizes the DB and disk by repeating the operations the user has done and returns a report.
void CheckSyncDirectory (const std::string &dirpath, bool recursive, bool repair, bool checkAttributes, std::vector< std::string > &i_ignorefiles, std::vector< std::string > &attsModified, std::vector< std::string > &newfiles)
 Recursively checks if the directory is synchronized and optionally the state of the attributes.
void CopyFiles (const std::vector< std::string > &filenames, const std::string directory)
 Copies the files indicated in the vector and updates all databases.
void FindNode (tree::Node *parent, int level, const std::string &searchParam, const std::string &searchVal, tree::Node *&node)
 Finds the node that matches the specified parameters.
void FindNodePartial (tree::Node *parent, int level, const std::string &searchParam, const std::string &searchVal, tree::Node *&node)
 Finds the nodes that partially match the searchVal.
void CheckAttributes (bool repair, std::string &file, std::vector< std::string > &attsModified)
 Checks the attributes of the database against the ones in disk.
void DeleteDriveFromMainDB (const std::string &drive)
 Deletes the drive with the given name (use for all databases except maintenance and timestamp).
void DeleteDriveFromOtherDB (const std::string &drive)
 Deletes the drive with the given name (use for maintenance and timestamp databases).
void EditField (tree::Node *node, const std::string &name, const std::string &key, const std::string &val)
 Edits the given field and sets the new parameters.
void GetAttributes (const std::vector< std::string > &params, const std::string &filename, std::vector< std::string > &results)
 Returns the demanded attributes for the given file.

Private Member Functions

void AddFile (const std::string &filename)
void AddDirectoryRecursor (const std::string &directory, bool recurse, const std::string &addKey)
 Recursive method which does the main job for AddDirectory.

Private Attributes

TreeHandlermTreeHandler
TimestampDatabaseHandlermTimestampHandler
SynchronizermSynchronizer
ImageReader mReader
std::string mCurrentDB
Progress mProgress
ProgressSignalType mProgressSignal

Classes

class  Progress


Detailed Description

Object which can add images files to a TreeHandler. Is able to parse (recursively) a part of a filesystem to look for known images and load their attributes in order to add the images to a Tree (submission via a TreeHandler::AddBranch).

Definition at line 25 of file creaImageIOTreeHandlerImageAdder.h.


Member Typedef Documentation

typedef boost::signal<void (Progress&)> creaImageIO::TreeHandlerImageAdder::ProgressSignalType

Definition at line 89 of file creaImageIOTreeHandlerImageAdder.h.

typedef ProgressSignalType::slot_function_type creaImageIO::TreeHandlerImageAdder::ProgressCallbackType

Definition at line 90 of file creaImageIOTreeHandlerImageAdder.h.


Constructor & Destructor Documentation

creaImageIO::TreeHandlerImageAdder::TreeHandlerImageAdder ( TreeHandler tree  ) 

Ctor.

creaImageIO::TreeHandlerImageAdder::~TreeHandlerImageAdder (  ) 

Dtor.


Member Function Documentation

void creaImageIO::TreeHandlerImageAdder::SetTreeHandler ( TreeHandler tree  )  [inline]

Sets the TreeHandler.

Definition at line 35 of file creaImageIOTreeHandlerImageAdder.h.

References mTreeHandler.

00035 { mTreeHandler = tree;}

void creaImageIO::TreeHandlerImageAdder::SetTimestampHandler ( TimestampDatabaseHandler tdh  )  [inline]

Sets the TimestampDatabaseHandler.

Definition at line 37 of file creaImageIOTreeHandlerImageAdder.h.

References mTimestampHandler.

00037 { mTimestampHandler = tdh;}

void creaImageIO::TreeHandlerImageAdder::SetSynchronizer ( Synchronizer s  )  [inline]

Sets the synchronizer.

Definition at line 39 of file creaImageIOTreeHandlerImageAdder.h.

References mSynchronizer.

00039 {mSynchronizer=s;}

void creaImageIO::TreeHandlerImageAdder::SetCurrentDatabase ( std::string  cur  )  [inline]

Sets the synchronizer.

Definition at line 41 of file creaImageIOTreeHandlerImageAdder.h.

References mCurrentDB.

00041 {mCurrentDB=cur;}

const Progress& creaImageIO::TreeHandlerImageAdder::GetProgress (  )  const [inline]

Definition at line 85 of file creaImageIOTreeHandlerImageAdder.h.

References mProgress.

00085 { return mProgress; }

void creaImageIO::TreeHandlerImageAdder::ConnectProgressObserver ( ProgressCallbackType  callback  ) 

Adds the function f to the list of functions to call when the addition progresses. f is of type ProgressCallbackType which is: void (*ProgressCallbackType)(Progress&) To pass a member function 'f' of an instance 'c' of a class 'C' as callback you have to 'bind' it, i.e. call: ConnectProgressObserver ( boost::bind( &C::f , c, _1 ) );

bool creaImageIO::TreeHandlerImageAdder::IsHandledFile ( const std::string &  filename  ) 

Returns if the file can be read or not.

void creaImageIO::TreeHandlerImageAdder::AddFiles ( const std::vector< std::string > &  filename  ) 

Adds a list of files to the TreeHandler.

void creaImageIO::TreeHandlerImageAdder::AddDirectory ( const std::string &  directory,
bool  recurse 
)

(Recursively) adds the files of a directory to the TreeHandler

void creaImageIO::TreeHandlerImageAdder::RemoveFile ( tree::Node node  ) 

Removes a file from the databases.

void creaImageIO::TreeHandlerImageAdder::RemoveFiles ( const std::vector< tree::Node * > &  nodes  ) 

Removes files from the databases.

std::string creaImageIO::TreeHandlerImageAdder::Synchronize ( bool  repair,
bool  checkAttributes 
)

Synchronizes the DB and disk by repeating the operations the user has done and returns a report.

void creaImageIO::TreeHandlerImageAdder::CheckSyncDirectory ( const std::string &  dirpath,
bool  recursive,
bool  repair,
bool  checkAttributes,
std::vector< std::string > &  i_ignorefiles,
std::vector< std::string > &  attsModified,
std::vector< std::string > &  newfiles 
)

Recursively checks if the directory is synchronized and optionally the state of the attributes.

void creaImageIO::TreeHandlerImageAdder::CopyFiles ( const std::vector< std::string > &  filenames,
const std::string  directory 
)

Copies the files indicated in the vector and updates all databases.

void creaImageIO::TreeHandlerImageAdder::FindNode ( tree::Node parent,
int  level,
const std::string &  searchParam,
const std::string &  searchVal,
tree::Node *&  node 
)

Finds the node that matches the specified parameters.

void creaImageIO::TreeHandlerImageAdder::FindNodePartial ( tree::Node parent,
int  level,
const std::string &  searchParam,
const std::string &  searchVal,
tree::Node *&  node 
)

Finds the nodes that partially match the searchVal.

void creaImageIO::TreeHandlerImageAdder::CheckAttributes ( bool  repair,
std::string &  file,
std::vector< std::string > &  attsModified 
)

Checks the attributes of the database against the ones in disk.

void creaImageIO::TreeHandlerImageAdder::DeleteDriveFromMainDB ( const std::string &  drive  ) 

Deletes the drive with the given name (use for all databases except maintenance and timestamp).

void creaImageIO::TreeHandlerImageAdder::DeleteDriveFromOtherDB ( const std::string &  drive  ) 

Deletes the drive with the given name (use for maintenance and timestamp databases).

void creaImageIO::TreeHandlerImageAdder::EditField ( tree::Node node,
const std::string &  name,
const std::string &  key,
const std::string &  val 
)

Edits the given field and sets the new parameters.

void creaImageIO::TreeHandlerImageAdder::GetAttributes ( const std::vector< std::string > &  params,
const std::string &  filename,
std::vector< std::string > &  results 
)

Returns the demanded attributes for the given file.

void creaImageIO::TreeHandlerImageAdder::AddFile ( const std::string &  filename  )  [private]

Adds a single file to the TreeHandler WITHOUT** testing wether it is handled or not hence you have to call IsHandledFile before using AddFile!

void creaImageIO::TreeHandlerImageAdder::AddDirectoryRecursor ( const std::string &  directory,
bool  recurse,
const std::string &  addKey 
) [private]

Recursive method which does the main job for AddDirectory.


Member Data Documentation

TreeHandler* creaImageIO::TreeHandlerImageAdder::mTreeHandler [private]

Definition at line 167 of file creaImageIOTreeHandlerImageAdder.h.

Referenced by SetTreeHandler().

TimestampDatabaseHandler* creaImageIO::TreeHandlerImageAdder::mTimestampHandler [private]

Definition at line 168 of file creaImageIOTreeHandlerImageAdder.h.

Referenced by SetTimestampHandler().

Synchronizer* creaImageIO::TreeHandlerImageAdder::mSynchronizer [private]

Definition at line 169 of file creaImageIOTreeHandlerImageAdder.h.

Referenced by SetSynchronizer().

ImageReader creaImageIO::TreeHandlerImageAdder::mReader [private]

Definition at line 170 of file creaImageIOTreeHandlerImageAdder.h.

std::string creaImageIO::TreeHandlerImageAdder::mCurrentDB [private]

Definition at line 171 of file creaImageIOTreeHandlerImageAdder.h.

Referenced by SetCurrentDatabase().

Progress creaImageIO::TreeHandlerImageAdder::mProgress [private]

Definition at line 173 of file creaImageIOTreeHandlerImageAdder.h.

Referenced by GetProgress().

ProgressSignalType creaImageIO::TreeHandlerImageAdder::mProgressSignal [private]

Definition at line 174 of file creaImageIOTreeHandlerImageAdder.h.


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 10:50:01 2009 for CreaImageIO by  doxygen 1.5.3