Remoto - VFS: VFS_thread.h Source File
Remoto - VFS
VFS_thread.h
Go to the documentation of this file.
1 #ifndef VFS_THREAD_H
2 #define VFS_THREAD_H
3 
4 #include <QThread>
5 #include <QDomDocument>
6 
7 #include "VFS.h"
8 #include "VFS_node.h"
9 
10 class VFS_threadthread : public QThread
11 {
12  Q_OBJECT
13 
14  public:
15  explicit VFS_threadthread(VFS_node *p, QDomElement nodeConfig, QVariantMap env, bool printConfig);
17 
18  void run();
19 
20  QDomElement _nodeConfig;
21  QVariantMap _env;
22  bool _printConfig;
23 
25 
26  signals:
28  void creationFailed();
29 };
30 
31 class VFS_thread : public VFS_node
32 {
33  Q_OBJECT
34 
35  public:
36  Q_INVOKABLE explicit VFS_thread(QDomElement nodeConfig, QVariantMap env, bool printConfig=false);
37  virtual ~VFS_thread();
38 
39  static VFS_thread *fromConfig(QString configString, QVariantMap env=QVariantMap(), bool printConfig=false);
40 
41  virtual VFS_node *find(VFS_request *r);
42  virtual VFS_node *append(QString name, VFS_node *node, bool containerCheck=true, QString user="unknown");
43 
44  virtual VFS_node *mount();
45  virtual VFS_node *unmount();
46 
47  virtual bool isContainer();
48  static int threadcount();
49 
50  bool hasNode();
51 
52  protected:
55 
56  //virtual void metadata(VFS_request *r);
57 
58  private:
59  static int _threadcount;
60 
61  signals:
62 
63  public slots:
64  virtual void subtreeRequest(VFS_request *t);
65  virtual void executeRequest(VFS_request *t);
66 
67  void defunct();
68 
69  protected slots:
70  void setNode(VFS_node *node);
71 };
72 
73 #endif // VFS_THREAD_H
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143
friend class VFS_thread
Definition: VFS_node.h:147
The base class for all requests between nodes.
Definition: VFS_node.h:54
A thread interface for creating multithreaded applications.
Definition: VFS_thread.h:32
virtual void subtreeRequest(VFS_request *t)
Subclass implementation of VFS_node::subtreeRequest()
Definition: VFS_thread.cpp:299
static int _threadcount
The internal thread count, useful for debug and logging messages.
Definition: VFS_thread.h:59
virtual void executeRequest(VFS_request *t)
Execute the VFS_request.
Definition: VFS_thread.cpp:319
void defunct()
When a thread is complete, it will emit finished(), which will trigger this slot.
Definition: VFS_thread.cpp:117
virtual bool isContainer()
The container-ness of the thread node.
Definition: VFS_thread.cpp:231
virtual VFS_node * mount()
Mount the node, and mount the thread node if it exists.
Definition: VFS_thread.cpp:200
VFS_node * _node
The root VFS_node running in the new thread.
Definition: VFS_thread.h:54
static VFS_thread * fromConfig(QString configString, QVariantMap env=QVariantMap(), bool printConfig=false)
A convenience method for creating threads.
Definition: VFS_thread.cpp:68
virtual VFS_node * unmount()
Unmount the node and the thread node if it exists.
Definition: VFS_thread.cpp:214
static int threadcount()
Return the current thread count, mostly only useful for logging output.
Definition: VFS_thread.cpp:132
VFS_threadthread _thread
The subclassed QThread, which will provide the event loop and actually run the thread.
Definition: VFS_thread.h:53
bool hasNode()
When a thread is created, it must construct its root node to become operational.
Definition: VFS_thread.cpp:248
virtual ~VFS_thread()
VFS_thread destructor.
Definition: VFS_thread.cpp:91
virtual VFS_node * append(QString name, VFS_node *node, bool containerCheck=true, QString user="unknown")
A dummy entry used to warn a developer of illegal use.
Definition: VFS_thread.cpp:178
void setNode(VFS_node *node)
Once the node is created in the new thread, this VFS_thread will keep a reference to it.
Definition: VFS_thread.cpp:147
virtual VFS_node * find(VFS_request *r)
Subclass implementation of VFS_node::find(), which is the path lookup mechanism.
Definition: VFS_thread.cpp:283
A subclass of QThread, which provides an event loop in a different thread.
Definition: VFS_thread.h:11
void run()
Run the QThread event loop.
Definition: VFS_thread.cpp:380
void nodeCreated(VFS_node *node)
Once the _node has been created, this signals back to the owning VFS_thread of its existence.
VFS_node * _node
The root VFS_node running in the new thread.
Definition: VFS_thread.h:24
QVariantMap _env
The environment.
Definition: VFS_thread.h:21
VFS_threadthread(VFS_node *p, QDomElement nodeConfig, QVariantMap env, bool printConfig)
Definition: VFS_thread.cpp:344
QDomElement _nodeConfig
XML config node.
Definition: VFS_thread.h:20
void creationFailed()
If _node creation was not possible, this signal is emitted.
bool _printConfig
A debug setting, used to make sure contexts are correct.
Definition: VFS_thread.h:22