| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Thibaut Oprinsen | ||
| 3 | Mail : thibaut.oprinsen@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | #ifndef __STATDAEMONMANAGERIMPL_H__ | ||
| 7 | #define __STATDAEMONMANAGERIMPL_H__ | ||
| 8 | |||
| 9 | #include "StatSort.h" | ||
| 10 | #include "StatDaemonManager.h" | ||
| 11 | |||
| 12 | ///Constructor of StatDaemonManager | ||
| 13 | template<class _TBackend> | ||
| 14 | 1 | StatDaemonManager<_TBackend>::StatDaemonManager() | |
| 15 | 1 | :Daemon<_TBackend>() | |
| 16 | { | ||
| 17 | 1 | initializeStatDaemonManager(); | |
| 18 | 1 | } | |
| 19 | |||
| 20 | ///Destructor of StatDaemonManager | ||
| 21 | template<class _TBackend> | ||
| 22 | 1 | StatDaemonManager<_TBackend>::~StatDaemonManager(){ | |
| 23 | |||
| 24 | 1 | } | |
| 25 | |||
| 26 | ///Get the map of DaemonStat | ||
| 27 | /** @return map of DaemonStat | ||
| 28 | */ | ||
| 29 | template<class _TBackend> | ||
| 30 | 1 | const MapDaemonStat& StatDaemonManager<_TBackend>::getMapDaemonStat() const { | |
| 31 | 1 | return p_mapDaemonStat; | |
| 32 | } | ||
| 33 | |||
| 34 | ///Check if stats have been received | ||
| 35 | /** @return true if the stats have been received, false otherwise | ||
| 36 | */ | ||
| 37 | template<class _TBackend> | ||
| 38 | bool StatDaemonManager<_TBackend>::hasReceivedStats() const { | ||
| 39 | return !p_mapDaemonStat.empty(); | ||
| 40 | } | ||
| 41 | |||
| 42 | ///Get the count of stats received | ||
| 43 | /** @return number of stats received | ||
| 44 | */ | ||
| 45 | template<class _TBackend> | ||
| 46 | 163 | size_t StatDaemonManager<_TBackend>::getStatsCount() const { | |
| 47 | 163 | return p_mapDaemonStat.size(); | |
| 48 | } | ||
| 49 | |||
| 50 | ///Fill the StatInfo of the StatDaemonManager with the given DaemonStat | ||
| 51 | /** @param stat : DaemonStat to be filled | ||
| 52 | * @return true on success, false otherwise | ||
| 53 | */ | ||
| 54 | template<class _TBackend> | ||
| 55 | 2 | PUncastableBool StatDaemonManager<_TBackend>::fillStatInfo(const DaemonStat & stat) { | |
| 56 | 2 | p_mapDaemonStat[stat.getName()] = stat; | |
| 57 | 2 | return UNCASTABLE_TRUE; | |
| 58 | } | ||
| 59 | |||
| 60 | ///Initialize the StatDaemonManager | ||
| 61 | template<class _TBackend> | ||
| 62 | 1 | void StatDaemonManager<_TBackend>::initializeStatDaemonManager(){ | |
| 63 | |||
| 64 | 1 | } | |
| 65 | |||
| 66 | ///Process event | ||
| 67 | /** @return true | ||
| 68 | */ | ||
| 69 | template<class _TBackend> | ||
| 70 | bool StatDaemonManager<_TBackend>::processEvent(){ | ||
| 71 | // bool bResult = Daemon<_TBackend>::sendValue("SwarmTop", p_mapDaemonStat); | ||
| 72 | return true; | ||
| 73 | } | ||
| 74 | |||
| 75 | ///Method from BaseDaemon to add call methods | ||
| 76 | template<class _TBackend> | ||
| 77 | 1 | void StatDaemonManager<_TBackend>::addCallMethod(){ | |
| 78 | 1 | DaemonConfig & daemonConfig = Daemon<_TBackend>::getConfig(); | |
| 79 | 1 | BaseDaemon::getLog().getLogInfo() << "StatDaemonManager: Adding data callable method for stat sorting with nbBin=" << daemonConfig.getStatNbBin() << ", lowerBound=" << daemonConfig.getStatHistLowerBound() << ", upperBound=" << daemonConfig.getStatHistUpperBound() << std::endl; | |
| 80 | 1 | Daemon<_TBackend>::addDataCallableMethod(sortFillDaemonStat<_TBackend>, *this, daemonConfig.getStatNbBin(), daemonConfig.getStatHistLowerBound(), daemonConfig.getStatHistUpperBound()); | |
| 81 | 1 | } | |
| 82 | |||
| 83 | #endif | ||
| 84 |