Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
WsFileSystemTree Class Reference

Represents the file structure on disk. More...

#include <WsFileSystemTree.h>

Inheritance diagram for WsFileSystemTree:
Inheritance graph
Collaboration diagram for WsFileSystemTree:
Collaboration graph

Public Member Functions

 WsFileSystemTree (const std::string &p, bool m=false)
 Constructor for the FileSystemTree object. More...
 
 ~WsFileSystemTree ()
 
int start ()
 crawls the diretory and sorts the children. It is called by WsDirectoryCrawler::start() More...
 
NodePtr getRoot ()
 returns the root of the WsFileSystemTree More...
 
NodePtr eatPath (const std::string &p)
 
int getUseCount ()
 returns the number of users that are using this fileSystemTree version More...
 
void incrementUseCount ()
 increments the number of uses of the tree by 1 More...
 
void decrementUseCount ()
 decrements the numbers of uses by one More...
 
const boost::filesystem::path & getRootPath () const
 returns the boost::filesystem::path to the base directory where documents are stored More...
 
std::vector
< boost::filesystem::path > & 
getMonitorPaths ()
 returns the std::vector containing the boost::filesystem::path that should be monitored by the WsUpdater Class More...
 
const std::string & getStamp ()
 returns the Tree unique stamp More...
 
int insertNode (NodePtr newNode)
 inserts the node in the tree The node is inserted on the right place on the tree depending on it's path The node is not created in the filesystem. If the node path is incorrect, the node is not inserted and FAILURE is returned. Otherwise SUCCESS is returned More...
 

Protected Attributes

std::string m_p
 
bool m_isLoaded
 

Private Member Functions

int applyFile (const boost::filesystem::path &filePath)
 this method is called by browse when the boost::filesystem::path is a file More...
 
int applyDirectory (const boost::filesystem::path &dirPath)
 this method is called by browse when the boost::filesystem::path is a folder More...
 
void beginChild (const boost::filesystem::path &p)
 this method is called before browsing a subdirectory More...
 
void endChild (const boost::filesystem::path &p)
 this method is called when finished browsing the subdir More...
 
void createStamp ()
 creates unique stamp for the tree More...
 

Private Attributes

boost::filesystem::path m_rootPath
 
boost::mutex m_lMutex
 
std::vector
< boost::filesystem::path > 
m_monitorPaths
 
std::string m_stamp
 
int m_useCount
 
bool m_monitor
 
NodePtr m_root
 
NodePtr m_current
 

Detailed Description

Represents the file structure on disk.

Definition at line 36 of file WsFileSystemTree.h.

Constructor & Destructor Documentation

WsFileSystemTree::WsFileSystemTree ( const std::string &  p,
bool  m = false 
)

Constructor for the FileSystemTree object.

Parameters
pthe root path of the directory (rootPath)
mmonitor or not the filesystemtree using Gamin ?

Definition at line 24 of file WsFileSystemTree.cpp.

WsFileSystemTree::~WsFileSystemTree ( )

Definition at line 32 of file WsFileSystemTree.cpp.

Member Function Documentation

int WsFileSystemTree::applyDirectory ( const boost::filesystem::path &  dirPath)
privatevirtual

this method is called by browse when the boost::filesystem::path is a folder

creates the node for a directory

Implements WsDirectoryCrawler.

Definition at line 85 of file WsFileSystemTree.cpp.

Here is the call graph for this function:

int WsFileSystemTree::applyFile ( const boost::filesystem::path &  filePath)
privatevirtual

this method is called by browse when the boost::filesystem::path is a file

creates the node for a file

Implements WsDirectoryCrawler.

Definition at line 55 of file WsFileSystemTree.cpp.

void WsFileSystemTree::beginChild ( const boost::filesystem::path &  p)
privatevirtual

this method is called before browsing a subdirectory

Implements WsDirectoryCrawler.

Definition at line 118 of file WsFileSystemTree.cpp.

void WsFileSystemTree::createStamp ( )
private

creates unique stamp for the tree

Definition at line 234 of file WsFileSystemTree.cpp.

Here is the caller graph for this function:

void WsFileSystemTree::decrementUseCount ( )

decrements the numbers of uses by one

Definition at line 208 of file WsFileSystemTree.cpp.

NodePtr WsFileSystemTree::eatPath ( const std::string &  p)

Deprecated:
replace with WsAbractNode::eatPath()

Definition at line 143 of file WsFileSystemTree.cpp.

Here is the caller graph for this function:

void WsFileSystemTree::endChild ( const boost::filesystem::path &  p)
privatevirtual

this method is called when finished browsing the subdir

Implements WsDirectoryCrawler.

Definition at line 123 of file WsFileSystemTree.cpp.

vector< path > & WsFileSystemTree::getMonitorPaths ( )

returns the std::vector containing the boost::filesystem::path that should be monitored by the WsUpdater Class

Definition at line 224 of file WsFileSystemTree.cpp.

Here is the caller graph for this function:

NodePtr WsFileSystemTree::getRoot ( )

returns the root of the WsFileSystemTree

Returns
NodePtr corresponding to the Root of the FileSystemTree

Definition at line 133 of file WsFileSystemTree.cpp.

const path & WsFileSystemTree::getRootPath ( ) const

returns the boost::filesystem::path to the base directory where documents are stored

Returns
SUCCESS or FAILURE

Definition at line 80 of file WsFileSystemTree.cpp.

const string & WsFileSystemTree::getStamp ( )

returns the Tree unique stamp

Definition at line 229 of file WsFileSystemTree.cpp.

int WsFileSystemTree::getUseCount ( )

returns the number of users that are using this fileSystemTree version

Definition at line 164 of file WsFileSystemTree.cpp.

void WsFileSystemTree::incrementUseCount ( )

increments the number of uses of the tree by 1

Definition at line 193 of file WsFileSystemTree.cpp.

int WsFileSystemTree::insertNode ( NodePtr  newNode)

inserts the node in the tree The node is inserted on the right place on the tree depending on it's path The node is not created in the filesystem. If the node path is incorrect, the node is not inserted and FAILURE is returned. Otherwise SUCCESS is returned

Definition at line 169 of file WsFileSystemTree.cpp.

Here is the call graph for this function:

int WsFileSystemTree::start ( )

crawls the diretory and sorts the children. It is called by WsDirectoryCrawler::start()

Returns
success status

Definition at line 39 of file WsFileSystemTree.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

NodePtr WsFileSystemTree::m_current
private

Current Node, used when building the tree to insert at the correct position

Definition at line 168 of file WsFileSystemTree.h.

bool WsDirectoryCrawler::m_isLoaded
protectedinherited

Boolean set to true if the WsDirectoryCrawler::start method has been called and completed successfully

Definition at line 83 of file WsDirectoryCrawler.h.

boost::mutex WsFileSystemTree::m_lMutex
private

Definition at line 138 of file WsFileSystemTree.h.

bool WsFileSystemTree::m_monitor
private

Definition at line 158 of file WsFileSystemTree.h.

std::vector<boost::filesystem::path> WsFileSystemTree::m_monitorPaths
private

Monitored paths by gamin

Definition at line 143 of file WsFileSystemTree.h.

std::string WsDirectoryCrawler::m_p
protectedinherited

the boost::filesystem::path of the directory to crawl

Definition at line 58 of file WsDirectoryCrawler.h.

NodePtr WsFileSystemTree::m_root
private

Root Node

Definition at line 163 of file WsFileSystemTree.h.

boost::filesystem::path WsFileSystemTree::m_rootPath
private

The rootPath (the path of the root folder

Definition at line 136 of file WsFileSystemTree.h.

std::string WsFileSystemTree::m_stamp
private

WsFileSystemTree stamp

Definition at line 148 of file WsFileSystemTree.h.

int WsFileSystemTree::m_useCount
private

Number of process using the tree (currently 1 because no multithreading in fsdaemon

Definition at line 153 of file WsFileSystemTree.h.


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