Stefan Schuermans commited on 2011-12-22 19:21:00
Showing 4 changed files, with 149 additions and 1 deletions.
| ... | ... |
@@ -0,0 +1,76 @@ |
| 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 <iostream> |
|
| 7 |
+#include <string> |
|
| 8 |
+ |
|
| 9 |
+#include "Directory.h" |
|
| 10 |
+#include "File.h" |
|
| 11 |
+#include "Mgrs.h" |
|
| 12 |
+#include "Module.h" |
|
| 13 |
+#include "OpConn.h" |
|
| 14 |
+#include "OpConnIf.h" |
|
| 15 |
+#include "OpMgr.h" |
|
| 16 |
+#include "OpPrinter.h" |
|
| 17 |
+#include "OpReqIf.h" |
|
| 18 |
+ |
|
| 19 |
+namespace Blinker {
|
|
| 20 |
+ |
|
| 21 |
+/** |
|
| 22 |
+ * @brief constructor |
|
| 23 |
+ * @param[in] mgrs managers |
|
| 24 |
+ * @param[in] dirBase base directory |
|
| 25 |
+ */ |
|
| 26 |
+OpPrinter::OpPrinter(Mgrs &mgrs, const Directory &dirBase): |
|
| 27 |
+ Module(mgrs, dirBase) |
|
| 28 |
+{
|
|
| 29 |
+ m_mgrs.m_opMgr.open("TODO", this);
|
|
| 30 |
+} |
|
| 31 |
+ |
|
| 32 |
+/// virtual destructor |
|
| 33 |
+OpPrinter::~OpPrinter() |
|
| 34 |
+{
|
|
| 35 |
+ m_mgrs.m_opMgr.close("TODO");
|
|
| 36 |
+} |
|
| 37 |
+ |
|
| 38 |
+/// check for update of configuration |
|
| 39 |
+void OpPrinter::updateConfig() |
|
| 40 |
+{
|
|
| 41 |
+ // nothing to do here for this module |
|
| 42 |
+} |
|
| 43 |
+ |
|
| 44 |
+/** |
|
| 45 |
+ * @brief check if accepting new operator connction is possible |
|
| 46 |
+ * @param[in] name operator interface name |
|
| 47 |
+ * @return if accepting new connection is possible |
|
| 48 |
+ */ |
|
| 49 |
+bool OpPrinter::acceptNewOpConn(const std::string &name) |
|
| 50 |
+{
|
|
| 51 |
+ return true; // accept all connections |
|
| 52 |
+ (void)name; // unused |
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+/** |
|
| 56 |
+ * @brief new operator connection |
|
| 57 |
+ * @param[in] name operator interface name |
|
| 58 |
+ * @param[in] pConn operator connection object |
|
| 59 |
+ */ |
|
| 60 |
+void OpPrinter::newOpConn(const std::string &name, OpConn *pConn) |
|
| 61 |
+{
|
|
| 62 |
+ std::cout << "new connection " << pConn << std::endl; |
|
| 63 |
+ (void)name; // unused |
|
| 64 |
+} |
|
| 65 |
+ |
|
| 66 |
+/** |
|
| 67 |
+ * @brief operator connection is closed |
|
| 68 |
+ * @param[in] pConn operator connection object |
|
| 69 |
+ */ |
|
| 70 |
+void OpPrinter::opConnClose(OpConn *pConn) |
|
| 71 |
+{
|
|
| 72 |
+ std::cout << "connection " << pConn << " closed" << std::endl; |
|
| 73 |
+} |
|
| 74 |
+ |
|
| 75 |
+} // namespace Blinker |
|
| 76 |
+ |
| ... | ... |
@@ -0,0 +1,70 @@ |
| 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 BLINKER_OPPRINTER_H |
|
| 7 |
+#define BLINKER_OPPRINTER_H |
|
| 8 |
+ |
|
| 9 |
+#include <string> |
|
| 10 |
+ |
|
| 11 |
+#include "Directory.h" |
|
| 12 |
+#include "File.h" |
|
| 13 |
+#include "Mgrs.h" |
|
| 14 |
+#include "Module.h" |
|
| 15 |
+#include "OpConn.h" |
|
| 16 |
+#include "OpConnIf.h" |
|
| 17 |
+#include "OpReqIf.h" |
|
| 18 |
+ |
|
| 19 |
+namespace Blinker {
|
|
| 20 |
+ |
|
| 21 |
+/// a operator connection printer |
|
| 22 |
+class OpPrinter: public Module, public OpReqIf |
|
| 23 |
+{
|
|
| 24 |
+public: |
|
| 25 |
+ /** |
|
| 26 |
+ * @brief constructor |
|
| 27 |
+ * @param[in] mgrs managers |
|
| 28 |
+ * @param[in] dirBase base directory |
|
| 29 |
+ */ |
|
| 30 |
+ OpPrinter(Mgrs &mgrs, const Directory &dirBase); |
|
| 31 |
+ |
|
| 32 |
+ /// virtual destructor |
|
| 33 |
+ virtual ~OpPrinter(); |
|
| 34 |
+ |
|
| 35 |
+private: |
|
| 36 |
+ /// copy constructor disabled |
|
| 37 |
+ OpPrinter(const OpPrinter &that); |
|
| 38 |
+ |
|
| 39 |
+ /// assignment operator disabled |
|
| 40 |
+ const OpPrinter & operator=(const OpPrinter &that); |
|
| 41 |
+ |
|
| 42 |
+public: |
|
| 43 |
+ /// check for update of configuration |
|
| 44 |
+ virtual void updateConfig(); |
|
| 45 |
+ |
|
| 46 |
+ /** |
|
| 47 |
+ * @brief check if accepting new operator connction is possible |
|
| 48 |
+ * @param[in] name operator interface name |
|
| 49 |
+ * @return if accepting new connection is possible |
|
| 50 |
+ */ |
|
| 51 |
+ virtual bool acceptNewOpConn(const std::string &name); |
|
| 52 |
+ |
|
| 53 |
+ /** |
|
| 54 |
+ * @brief new operator connection |
|
| 55 |
+ * @param[in] name operator interface name |
|
| 56 |
+ * @param[in] pConn operator connection object |
|
| 57 |
+ */ |
|
| 58 |
+ virtual void newOpConn(const std::string &name, OpConn *pConn); |
|
| 59 |
+ |
|
| 60 |
+ /** |
|
| 61 |
+ * @brief operator connection is closed |
|
| 62 |
+ * @param[in] pConn operator connection object |
|
| 63 |
+ */ |
|
| 64 |
+ virtual void opConnClose(OpConn *pConn); |
|
| 65 |
+}; // class OpPrinter |
|
| 66 |
+ |
|
| 67 |
+} // namespace Blinker |
|
| 68 |
+ |
|
| 69 |
+#endif // #ifndef BLINKER_OPPRINTER_H |
|
| 70 |
+ |
| ... | ... |
@@ -12,6 +12,7 @@ |
| 12 | 12 |
#include "Mgrs.h" |
| 13 | 13 |
#include "ModuleMgr.h" |
| 14 | 14 |
#include "ModuleMgr_impl.h" |
| 15 |
+#include "OpPrinter.h" |
|
| 15 | 16 |
#include "Output.h" |
| 16 | 17 |
#include "Player.h" |
| 17 | 18 |
#include "Printer.h" |
| ... | ... |
@@ -32,6 +33,7 @@ void run(const std::string &dirConfig) |
| 32 | 33 |
|
| 33 | 34 |
ModuleMgr<Canvas> canvases(mgrs, cfg.getSubdir("canvases"));
|
| 34 | 35 |
ModuleMgr<FlexiPix> flexipixes(mgrs, cfg.getSubdir("flexipixes"));
|
| 36 |
+ ModuleMgr<OpPrinter> opprinters(mgrs, cfg.getSubdir("opprinters"));
|
|
| 35 | 37 |
ModuleMgr<Output> outputs(mgrs, cfg.getSubdir("outputs"));
|
| 36 | 38 |
ModuleMgr<Player> players(mgrs, cfg.getSubdir("players"));
|
| 37 | 39 |
ModuleMgr<Printer> printers(mgrs, cfg.getSubdir("printers"));
|
| 38 | 40 |