Main Page · Modules · All Classes · Class Hierarchy
MADataCollector.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ 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  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include "types/MABehaviorTypes.hpp"
25 #include "MACollectedData.hpp"
26 
27 #include <MCDefs.hpp>
28 #include <MCThreadLocalData.hpp>
29 
30 class MCBinaryData;
31 class MADataCollector;
32 
38 namespace MA
39 {
41 extern MCThreadLocalData<MADataCollector> DataCollector;
42 }
43 
48 {
50 
51 public:
54  ~MADataCollector();
55 
61  void Clear();
62 
77  void AddJobTriggers(const std::string& name, const MA::BehaviorStateEvent& start_trigger,
78  const MA::BehaviorStateEvent& finish_trigger,
79  const MA::BehaviorStateEvent& fail_trigger,
80  const MC::StringList& collected_types);
81 
90  void StopActiveJobToCollectAType(const std::string& job_name, const std::string& type_name);
91 
104  void AddCustomDataToActiveJob(const std::string& job_name, const std::string& data_name,
105  const MCBinaryData& data_value);
106 
115  void AddCustomTypeToCurrentCycle(const std::string& custom_type,
116  const MCBinaryData& data);
117 
126  void UpdateJobs();
127 
137  int GetActiveCollectionID(const std::string& collection_name);
138 
146  bool IsAnyJobFinished() const;
147 
155  bool AreAllFinishedJobsCompressed() const;
156 
162  void CompressAllFinishedJobs();
163 
173  MCBinaryData* GetAFinishedJob() const;
174 
175 private:
178 };
179 
Binary data class.
Data collector.
#define MC_DISABLE_COPY(class_name)
Helper macro to disable the copy constructor and assignment operator of a class (object copying) ...
Definition: MCDefs.hpp:604
A wrapper class to cover boost::thread_specific_ptr/folly::ThreadLocal API on certain targets...
int CollectionID
Latest collection ID.