IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
LogEntry.h
1#ifndef IPPL_LOGENTRY_H
2#define IPPL_LOGENTRY_H
3
4#include <chrono>
5#include <cstring>
6#include <map>
7#include <string>
8#include <vector>
9
10namespace ippl {
11
12 struct LogEntry {
13 std::string methodName;
14 std::map<std::string, std::string> parameters;
15 size_t usedSize;
16 size_t freeSize;
17 std::string memorySpace;
18 int rank;
19 std::chrono::time_point<std::chrono::high_resolution_clock> timestamp;
20
21 std::vector<char> serialize() const;
22 static LogEntry deserialize(const std::vector<char>& buffer, size_t offset = 0);
23 };
24
25 template <typename T>
26 void serializeBasicType(std::vector<char>& buffer, const T& value) {
27 size_t size = sizeof(T);
28 buffer.resize(buffer.size() + size);
29 std::memcpy(buffer.data() + buffer.size() - size, &value, size);
30 }
31
32 template <typename T>
33 T deserializeBasicType(const std::vector<char>& buffer, size_t& offset) {
34 T value;
35 std::memcpy(&value, buffer.data() + offset, sizeof(T));
36 offset += sizeof(T);
37 return value;
38 }
39
40} // namespace ippl
41
42#endif
Definition Archive.h:20
Definition LogEntry.h:12