29 #include "../common.hpp"
30 #include "../types/config.hpp"
31 #include "../plugin.hpp"
36 namespace swarm {
namespace log {
42 typedef double data_type[NumData];
46 event_record(
const int b,
const double t,
const double* d)
47 : bodid1(b), bodid2(-1), time(t)
49 for(
int i=0;i<NumData;++i) data[i] = d[i];
53 event_record(
const int b1,
const int b2,
const double t,
const double* d)
54 : bodid1(b1), bodid2(b2), time(t)
56 for(
int i=0;i<NumData;++i) data[i] = d[i];
69 typedef std::vector<double> data_type;
76 : bodid1(b), bodid2(-1), time(t), data(d.size())
78 for(
int i=0;i<data.size();++i) data[i] = d[i];
82 event_record(
const int b1,
const int b2,
const double t,
const data_type& d)
83 : bodid1(b1), bodid2(b2), time(t), data(d.size())
85 for(
int i=0;i<data.size();++i) data[i] = d[i];
90 {
return data.size(); }
97 typedef std::vector<double> data_type;
103 : bodid1(b), bodid2(-1), time(t)
108 : bodid1(b1), bodid2(b2), time(t)
126 static const int max_num_doubles_per_event = 2;
129 std::vector<int> event_codes_to_log;
130 typedef std::vector<event_record_type> event_log_one_system_type;
131 typedef std::vector<event_log_one_system_type> event_log_one_code_type;
132 std::vector<event_log_one_code_type> event_log;
144 event_log_one_code_type& get_event_log_all_systems(
const int i)
145 {
return event_log[i]; }
148 const event_log_one_code_type& get_event_log_all_systems(
const int i)
const
149 {
return event_log[i]; }
152 event_log_one_system_type& get_event_log(
const int i,
const int sys)
153 {
return event_log[i][sys]; }
156 const event_log_one_system_type& get_event_log(
const int i,
const int sys)
const
157 {
return event_log[i][sys]; }
160 int get_event_type(
const int i)
const
162 if((i>=0) && (i<event_codes_to_log.size()))
163 return event_codes_to_log[i];
171 for(
int i=0;i<event_log.size();++i)
173 for(
int sys=0;sys<event_log[i].size();++sys)
175 event_log[i][sys].clear();
185 virtual void process(
const char *log_data,
size_t length);