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

Monitors the filesystem and call the WsFsTreeUpdater::update() method accordignly. More...

#include <WsMonitor.h>

Inheritance diagram for WsMonitor:
Inheritance graph
Collaboration diagram for WsMonitor:
Collaboration graph

Public Member Functions

 WsMonitor (WsFsTreeUpdater *u, std::vector< path > v, unsigned int delay)
 Constructor. More...
 
 ~WsMonitor ()
 Destructor. More...
 
boost::thread * start ()
 Starts the monitoring process. More...
 

Private Member Functions

int startCallBack ()
 Starts monitoring the Files of the filesystemtree Should be started in a separated thread. More...
 
int startCallBackConfOnly ()
 Starts monitoring the config Files of the filesystemtree Should be started in a separated thread. More...
 
int startChecker ()
 Starts loop that will monitor the m_updated variable every m_delay and update the tree if changed occured. More...
 
int addDirectory (const path &p)
 
const char * eventName (const int &code)
 Matches an event code with it's name. More...
 
int signal (const std::string &filename, const int &code)
 Called when a change occurs on a file monitored. More...
 
int signalConf (const std::string &filename, const int &code)
 Called when a change occurs on a conf file monitored. More...
 

Private Attributes

std::vector< path > m_paths
 
WsFsTreeUpdaterm_updater
 pointer to the WsFsTreeUpdater class More...
 
bool m_updated
 Changed occured ? More...
 
unsigned int m_delay
 
FAMRequest * m_frp
 
FAMRequest * m_frp2
 
FAMConnection * m_fc
 
FAMConnection * m_fc2
 

Detailed Description

Monitors the filesystem and call the WsFsTreeUpdater::update() method accordignly.

Definition at line 31 of file WsMonitor.h.

Constructor & Destructor Documentation

WsMonitor::WsMonitor ( WsFsTreeUpdater u,
std::vector< path >  v,
unsigned int  delay 
)

Constructor.

Parameters
uthe WsFsTreeUpdater
vthe path to monitor
delaythe update delay

Definition at line 18 of file WsMonitor.cpp.

WsMonitor::~WsMonitor ( )

Destructor.

Definition at line 26 of file WsMonitor.cpp.

Member Function Documentation

int WsMonitor::addDirectory ( const path &  p)
private

TODO DELETE ??

const char * WsMonitor::eventName ( const int &  code)
private

Matches an event code with it's name.

Parameters
codethe event code
Returns
a char* containing the event name or unknown if no match found

Definition at line 47 of file WsMonitor.cpp.

int WsMonitor::signal ( const std::string &  filename,
const int &  code 
)
private

Called when a change occurs on a file monitored.

Sets the m_updated variable to true if event code is FamDeleted or FamCreated

Parameters
filenamethe path to the file changed
codethe event code
Returns
SUCCESS

Definition at line 205 of file WsMonitor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int WsMonitor::signalConf ( const std::string &  filename,
const int &  code 
)
private

Called when a change occurs on a conf file monitored.

Sets the m_updated variable to true if event code is FamDeleted or FamCreated

Parameters
filenamethe path to the conf file changed
codethe event code
Returns
SUCCESS

Definition at line 228 of file WsMonitor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

boost::thread * WsMonitor::start ( )
virtual

Starts the monitoring process.

Returns
the thread in which the monitoring is launched

Implements WsAbstractMonitor.

Definition at line 71 of file WsMonitor.cpp.

Here is the call graph for this function:

int WsMonitor::startCallBack ( )
private

Starts monitoring the Files of the filesystemtree Should be started in a separated thread.

Returns
FAILURE if failed, otherwise endless loop

Definition at line 95 of file WsMonitor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int WsMonitor::startCallBackConfOnly ( )
private

Starts monitoring the config Files of the filesystemtree Should be started in a separated thread.

Returns
FAILURE if failed, otherwise endless loop

Definition at line 148 of file WsMonitor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int WsMonitor::startChecker ( )
private

Starts loop that will monitor the m_updated variable every m_delay and update the tree if changed occured.

Returns
Nothing

Definition at line 80 of file WsMonitor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

unsigned int WsMonitor::m_delay
private

Definition at line 132 of file WsMonitor.h.

FAMConnection* WsMonitor::m_fc
private

Definition at line 136 of file WsMonitor.h.

FAMConnection* WsMonitor::m_fc2
private

Definition at line 137 of file WsMonitor.h.

FAMRequest* WsMonitor::m_frp
private

Definition at line 134 of file WsMonitor.h.

FAMRequest* WsMonitor::m_frp2
private

Definition at line 135 of file WsMonitor.h.

std::vector<path> WsMonitor::m_paths
private

paths to monitor

Definition at line 120 of file WsMonitor.h.

bool WsMonitor::m_updated
private

Changed occured ?

Definition at line 131 of file WsMonitor.h.

WsFsTreeUpdater* WsMonitor::m_updater
private

pointer to the WsFsTreeUpdater class

Definition at line 125 of file WsMonitor.h.


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