1#ifndef DISCRETEINPUTS_H
2#define DISCRETEINPUTS_H
18 bool operator<(
const EcalTP &other)
const {
return tp > other.tp; }
19 void fill(
int _tid,
float _tp) {
23 void writeToFile(FILE *file)
const {
24 fwrite(&tid,
sizeof(uint32_t), 1, file);
25 fwrite(&tp,
sizeof(uint32_t), 1, file);
27 void readFromFile(FILE *file) {
28 fread(&tid,
sizeof(uint32_t), 1, file);
29 fread(&tp,
sizeof(uint32_t), 1, file);
34void writeManyToFile(
const std::vector<T> &objs, FILE *file) {
35 uint32_t number = objs.size();
36 fwrite(&number, 4, 1, file);
37 for (uint32_t i = 0; i < number; ++i) objs[i].writeToFile(file);
41void readManyFromFile(std::vector<T> &objs, FILE *file) {
43 fread(&number, 4, 1, file);
45 for (uint32_t i = 0; i < number; ++i) objs[i].readFromFile(file);