MoveWork Class Reference

Inheritance diagram for MoveWork:

Inheritance graph
[legend]
Collaboration diagram for MoveWork:

Collaboration graph
[legend]
List of all members.

Detailed Description

MoveWork class is a job object submitted to WorkThread for processing; MoveWork performs file moving from source directory to destination directory, commonly used when completing a file.

MoveWork emits EVT_MOVE_OK when moving succeeds, or EVT_MOVE_FAILED if it fails.

Note:
Event constants are defined inside MoveWork class scope

MoveWork object should always be constructed into boost::shared_ptr

Definition at line 42 of file sharedfile.cpp.


Public Types

enum  MoveEvent { EVT_MOVE_OK, EVT_MOVE_FAILED }

Public Member Functions

 DECLARE_EVENT_TABLE (boost::shared_ptr< MoveWork >, int)
 MoveWork (const boost::filesystem::path &src, const boost::filesystem::path &dest)
 Constructor.
bool process ()
 Processes the moving.
boost::filesystem::path getSrc () const
 source location
boost::filesystem::path getDest () const
 destination location

Private Attributes

const boost::filesystem::path m_src
 Source path.
const boost::filesystem::path m_dest
 Destination path.

Member Enumeration Documentation

enum MoveWork::MoveEvent
 

Enumeration values:
EVT_MOVE_OK 
EVT_MOVE_FAILED 

Definition at line 48 of file sharedfile.cpp.


Constructor & Destructor Documentation

MoveWork::MoveWork const boost::filesystem::path &  src,
const boost::filesystem::path &  dest
[inline]
 

Constructor.

Parameters:
src Source location
dest Destination location

Definition at line 56 of file sharedfile.cpp.

References m_dest, and m_src.


Member Function Documentation

MoveWork::DECLARE_EVENT_TABLE boost::shared_ptr< MoveWork ,
int 
 

boost::filesystem::path MoveWork::getDest  )  const [inline]
 

destination location

Definition at line 98 of file sharedfile.cpp.

References m_dest.

boost::filesystem::path MoveWork::getSrc  )  const [inline]
 

source location

Definition at line 96 of file sharedfile.cpp.

References m_src.

bool MoveWork::process  )  [inline, virtual]
 

Processes the moving.

This may take some time.

When both source and destination are located on same partition, the file is simply renamed, which takes nearly no time. However, when the source and destination are located on different partitions, entire data needs to be copied. Furthermore, some implementations do not support renaming accross partitions, so we fall back to explicit copy + remove in those cases.

Upon successful completition, EVT_MOVE_OK is emitted. On failure, EVT_MOVE_FAILEd is emitted.

Implements ThreadWork.

Definition at line 74 of file sharedfile.cpp.

References EVT_MOVE_OK, logMsg(), m_dest, m_src, and ThreadWork::setComplete().

Here is the call graph for this function:


Member Data Documentation

const boost::filesystem::path MoveWork::m_dest [private]
 

Destination path.

Definition at line 101 of file sharedfile.cpp.

Referenced by getDest(), MoveWork(), and process().

const boost::filesystem::path MoveWork::m_src [private]
 

Source path.

Definition at line 100 of file sharedfile.cpp.

Referenced by getSrc(), MoveWork(), and process().


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