source: Plugins/dynamicResources/Monitor.h @ 31

Revision 31, 2.0 KB checked in by art, 12 years ago (diff)

dynamicResourceManagment Plugin added.

TODO: change file association list of resources. This is required
by the drm plugin to be able to reload the resource as soon as one of
the associated file changes.

Line 
1/***************************************************************************
2 *                                                                         *
3 *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
4 *       mailto: <tevs@mpi-sb.mpg.de>                                      *
5 *                                                                         *
6 *   This program is free software; you can redistribute it and/or modify  *
7 *   it under the terms of the GNU General Public License as published by  *
8 *   the Free Software Foundation; either version 2 of the License, or     *
9 *   (at your option) any later version.                                   *
10 *                                                                         *
11 ***************************************************************************/
12
13
14#ifndef _NR_MONITOR_TASK_H_
15#define _NR_MONITOR_TASK_H_
16
17
18//----------------------------------------------------------------------------------
19// Includes
20//----------------------------------------------------------------------------------
21#include <nrEngine/nrEngine.h>
22using namespace nrEngine;
23
24
25#if NR_PLATFORM == NR_PLATFORM_LINUX
26        #include "inotify.h"
27        #include "inotify-syscalls.h"
28        #define USE_INOTIFY
29#endif
30
31
32/**
33 * This class does monitor all loaded resources and will notify the
34 * resource loader if file has changed, so that the file could be reloaded.
35 **/
36class Monitor : public ITask
37{
38        public:
39
40                //! Create monitoring instance
41                Monitor(Engine*);
42               
43                //! Release the instance
44                ~Monitor();
45               
46                //! Calls when the task is finished
47                Result stopTask();     
48               
49                //! Initialize the task, cause ti was added to the kernel
50                Result onAddTask();
51               
52                //! Update the task
53                Result updateTask();
54
55
56        private:
57       
58                //! Engine pointer
59                Engine* mRoot;
60               
61                // We are using inotify interface
62                #ifdef USE_INOTIFY
63               
64                //! file descriptor
65                int mFileDescriptor;
66               
67                //! Initialize inotify interface
68                Result initInotify();
69               
70                #endif
71};
72
73
74#endif
Note: See TracBrowser for help on using the repository browser.