manager.hpp
Go to the documentation of this file.
00001 //
00002 // manager.hpp
00003 //
00004 
00005 #ifndef MANAGER_HPP
00006 #define MANAGER_HPP
00007 
00008 #include "BasicDatatypes.hpp"
00009 #include "tools/SickThread.hpp"
00010 #include "tools/BasicDataBuffer.hpp"
00011 #include "devices/BasicDevice.hpp"
00012 #include "application/BasicApplication.hpp"
00013 #include <vector>       // for std::vector
00014 
00015 //
00016 // The Manager.
00017 //
00018 class Manager
00019 {
00020 public:
00022         Manager();
00023 
00025         ~Manager();
00026         
00027         bool addApplication(Sourcetype appType, std::string appName, UINT16 wantedId = 0xFFFF);
00028         bool addApplication(application::BasicApplication* app, UINT16 wantedId = 0xFFFF);
00029         bool addAndRunDevice(Sourcetype deviceType, std::string deviceName, UINT16 wantedId = 0xFFFF);
00030         bool addAndRunDevice(devices::BasicDevice* device, std::string deviceName, UINT16 wantedId = 0xFFFF);
00031         bool importApplications();
00032         bool runAllDevices();
00033         void stopAllDevices();
00034         void setDeviceData(BasicData* data);    // Datenquelle: Hier laden die Devices ihre Daten ab
00035         devices::BasicDevice* getDeviceById(UINT32 id);
00036         devices::BasicDevice* getFirstDeviceByType(Sourcetype type);
00037 
00038 private:
00039         bool m_beVerbose;
00040         UINT16 getNextSourceId();
00041         UINT16 m_nextSourceId;          // Die als naechstes verwendete ID
00042 
00043         // Die Devices
00044         typedef std::vector<devices::BasicDevice*> DeviceList;
00045         DeviceList m_deviceList;
00046         
00047         // The applications
00048         typedef std::vector<application::BasicApplication*> ApplicationList;
00049         ApplicationList m_appList;
00050         
00051         // The buffer of the source
00052         BasicDataBuffer m_sourceBuffer;
00053         void sourceThreadFunction(bool& endThread, UINT16& waitTimeMs);         // Die Verteiler-Funktion
00054         SickThread<Manager, &Manager::sourceThreadFunction> m_sourceThread;     // Der Verteiler-Thread
00055         Mutex m_sourceBufferMutex;                                                                                              // Zugriffsschutz des Source-Buffers
00056 };
00057 
00058 
00059 #endif  // #ifndef MANAGER_HPP


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Thu Jun 6 2019 21:02:36