implemented base class for modules minor whitespace fixes
Stefan Schuermans

Stefan Schuermans commited on 2011-10-24 19:31:39
Showing 6 changed files, with 116 additions and 14 deletions.

... ...
@@ -0,0 +1,33 @@
1
+/* Blinker
2
+   Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org>
3
+   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
4
+   a blinkenarea.org project */
5
+
6
+#include "CallMgr.h"
7
+#include "Directory.h"
8
+#include "Module.h"
9
+#include "StreamMgr.h"
10
+
11
+namespace Blinker {
12
+
13
+/**
14
+ * @brief constructor
15
+ * @param[in] callMgr callback manager
16
+ * @param[in] streamMgr stream manager
17
+ * @param[in] dirBase base directory
18
+ */
19
+Module::Module(CallMgr &callMgr, StreamMgr &streamMgr,
20
+               const Directory &dirBase):
21
+  m_callMgr(callMgr),
22
+  m_streamMgr(streamMgr),
23
+  m_dirBase(dirBase)
24
+{
25
+}
26
+
27
+/// virtual destructor
28
+Module::~Module()
29
+{
30
+}
31
+
32
+} // namespace Blinker
33
+
... ...
@@ -0,0 +1,50 @@
1
+/* Blinker
2
+   Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org>
3
+   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
4
+   a blinkenarea.org project */
5
+
6
+#ifndef MODULE_H
7
+#define MODULE_H
8
+
9
+#include "CallMgr.h"
10
+#include "Directory.h"
11
+#include "StreamMgr.h"
12
+
13
+namespace Blinker {
14
+
15
+/// base class for modules
16
+class Module
17
+{
18
+public:
19
+  /**
20
+   * @brief constructor
21
+   * @param[in] callMgr callback manager
22
+   * @param[in] streamMgr stream manager
23
+   * @param[in] dirBase base directory
24
+   */
25
+  Module(CallMgr &callMgr, StreamMgr &streamMgr, const Directory &dirBase);
26
+
27
+  /// virtual destructor
28
+  virtual ~Module();
29
+
30
+private:
31
+  /// copy constructor disabled
32
+  Module(const Module & that);
33
+
34
+  /// assignment operator disabled
35
+  const Module & operator=(const Module &that);
36
+
37
+public:
38
+  /// check for update of configuration
39
+  virtual void updateConfig() = 0;
40
+
41
+protected:
42
+  CallMgr   &m_callMgr;   ///< callback manager
43
+  StreamMgr &m_streamMgr; ///< stream manager
44
+  Directory m_dirBase;    ///< base directory
45
+}; // class Module
46
+
47
+} // namespace Blinker
48
+
49
+#endif // #ifndef MODULE_H
50
+
... ...
@@ -12,6 +12,7 @@
12 12
 #include "CallMgr.h"
13 13
 #include "Directory.h"
14 14
 #include "File.h"
15
+#include "Module.h"
15 16
 #include "Player.h"
16 17
 #include "SettingFile.h"
17 18
 #include "StreamMgr.h"
... ...
@@ -28,9 +29,7 @@ namespace Blinker {
28 29
  */
29 30
 Player::Player(CallMgr &callMgr, StreamMgr &streamMgr,
30 31
                const Directory &dirBase):
31
-  m_callMgr(callMgr),
32
-  m_streamMgr(streamMgr),
33
-  m_dirBase(dirBase),
32
+  Module(callMgr, streamMgr, dirBase),
34 33
   m_fileOutStream(dirBase.getFile("outstream")),
35 34
   m_dirPlaylist(dirBase.getSubdir("playlist")),
36 35
   m_pOutStream(NULL),
... ...
@@ -59,6 +58,12 @@ Player::~Player()
59 58
   m_streamMgr.unrefStream(m_nameOutStream);
60 59
 }
61 60
 
61
+/// check for update of configuration
62
+void Player::updateConfig()
63
+{
64
+  // TODO
65
+}
66
+
62 67
 /// callback when requsted time reached
63 68
 void Player::timeCall()
64 69
 {
... ...
@@ -14,6 +14,7 @@
14 14
 #include "CallMgr.h"
15 15
 #include "Directory.h"
16 16
 #include "File.h"
17
+#include "Module.h"
17 18
 #include "SettingFile.h"
18 19
 #include "StreamMgr.h"
19 20
 #include "Time.h"
... ...
@@ -22,7 +23,7 @@
22 23
 namespace Blinker {
23 24
 
24 25
 /// a movie player
25
-class Player: public TimeCallee
26
+class Player: public Module, public TimeCallee
26 27
 {
27 28
 protected:
28 29
   /// playlist entry
... ...
@@ -58,6 +59,9 @@ private:
58 59
   const Player & operator=(const Player &that);
59 60
 
60 61
 public:
62
+  /// check for update of configuration
63
+  virtual void updateConfig();
64
+
61 65
   /// callback when requsted time reached
62 66
   virtual void timeCall();
63 67
 
... ...
@@ -69,9 +73,6 @@ protected:
69 73
   void showFrame();
70 74
 
71 75
 protected:
72
-  CallMgr                  &m_callMgr;      ///< callback manager
73
-  StreamMgr                &m_streamMgr;    ///< stream manager
74
-  Directory                m_dirBase;       ///< base directory
75 76
   SettingFile              m_fileOutStream; ///< output stream name file
76 77
   Directory                m_dirPlaylist;   ///< playlist directory
77 78
   std::string              m_nameOutStream; ///< name of output stream
... ...
@@ -9,8 +9,10 @@
9 9
 
10 10
 #include <BlinkenLib/BlinkenFrame.h>
11 11
 
12
+#include "CallMgr.h"
12 13
 #include "Directory.h"
13 14
 #include "File.h"
15
+#include "Module.h"
14 16
 #include "Printer.h"
15 17
 #include "SettingFile.h"
16 18
 #include "StreamMgr.h"
... ...
@@ -20,12 +22,13 @@ namespace Blinker {
20 22
 
21 23
 /**
22 24
  * @brief constructor
25
+ * @param[in] callMgr callback manager
23 26
  * @param[in] streamMgr stream manager
24 27
  * @param[in] dirBase base directory
25 28
  */
26
-Printer::Printer(StreamMgr &streamMgr, const Directory &dirBase):
27
-  m_streamMgr(streamMgr),
28
-  m_dirBase(dirBase),
29
+Printer::Printer(CallMgr &callMgr, StreamMgr &streamMgr,
30
+                 const Directory &dirBase):
31
+  Module(callMgr, streamMgr, dirBase),
29 32
   m_fileInStream(dirBase.getFile("instream")),
30 33
   m_pInStream(NULL)
31 34
 {
... ...
@@ -50,6 +53,12 @@ Printer::~Printer()
50 53
   m_streamMgr.unrefStream(m_nameInStream);
51 54
 }
52 55
 
56
+/// check for update of configuration
57
+void Printer::updateConfig()
58
+{
59
+  // TODO
60
+}
61
+
53 62
 /**
54 63
  * @brief set current frame
55 64
  * @param[in] pFrame current frame
... ...
@@ -10,8 +10,10 @@
10 10
 
11 11
 #include <BlinkenLib/BlinkenFrame.h>
12 12
 
13
+#include "CallMgr.h"
13 14
 #include "Directory.h"
14 15
 #include "File.h"
16
+#include "Module.h"
15 17
 #include "SettingFile.h"
16 18
 #include "StreamMgr.h"
17 19
 #include "StreamRecv.h"
... ...
@@ -19,15 +21,16 @@
19 21
 namespace Blinker {
20 22
 
21 23
 /// a stream printer
22
-class Printer: public StreamRecv
24
+class Printer: public Module, public StreamRecv
23 25
 {
24 26
 public:
25 27
   /**
26 28
    * @brief constructor
29
+   * @param[in] callMgr callback manager
27 30
    * @param[in] streamMgr stream manager
28 31
    * @param[in] dirBase base directory
29 32
    */
30
-  Printer(StreamMgr &streamMgr, const Directory &dirBase);
33
+  Printer(CallMgr &callMgr, StreamMgr &streamMgr, const Directory &dirBase);
31 34
 
32 35
   /// virtual destructor
33 36
   virtual ~Printer();
... ...
@@ -40,6 +43,9 @@ private:
40 43
   const Printer & operator=(const Printer &that);
41 44
 
42 45
 public:
46
+  /// check for update of configuration
47
+  virtual void updateConfig();
48
+
43 49
   /**
44 50
    * @brief set current frame
45 51
    * @param[in] pFrame current frame
... ...
@@ -50,8 +56,6 @@ public:
50 56
   virtual void setNoFrame();
51 57
 
52 58
 protected:
53
-  StreamMgr                &m_streamMgr;   ///< stream manager
54
-  Directory                m_dirBase;      ///< base directory
55 59
   SettingFile              m_fileInStream; ///< input stream name file
56 60
   std::string              m_nameInStream; ///< name of input stream
57 61
   Stream                   *m_pInStream;   ///< input stream
58 62