BmnRoot
Loading...
Searching...
No Matches
ArchiveDescriptor.h
Go to the documentation of this file.
1// Copyright 2013 Jan de Cuveland <cmail@cuveland.de>
4#pragma once
5
6#include "System.h"
7
8#include <boost/serialization/access.hpp>
9#include <boost/serialization/version.hpp>
10#include <chrono>
11#include <string>
12
13namespace fles
14{
15
22
23template<class Base, class Derived, ArchiveType archive_type>
25
33{
34 public:
41 : archive_type_(archive_type)
42 {
43 time_created_ = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
46 }
47
49 ArchiveType archive_type() const { return archive_type_; }
50
52 std::time_t time_created() const { return time_created_; }
53
55 std::string hostname() const { return hostname_; }
56
58 std::string username() const { return username_; }
59
60 private:
63 template<class Base, class Derived, ArchiveType archive_type>
64 friend class InputArchive;
65 template<class Base, class Derived, ArchiveType archive_type>
66 friend class InputArchiveLoop;
67
69
70 template<class Archive>
71 void serialize(Archive& ar, const unsigned int version)
72 {
73 if (version > 0) {
74 ar & archive_type_;
75 } else {
76 archive_type_ = ArchiveType::TimesliceArchive;
77 };
78 ar & time_created_;
79 ar & hostname_;
80 ar & username_;
81 }
82
83 ArchiveType archive_type_;
84 std::time_t time_created_ = std::time_t();
85 std::string hostname_;
86 std::string username_;
87};
88
89} // namespace fles
90
91#pragma GCC diagnostic push
92#pragma GCC diagnostic ignored "-Wold-style-cast"
93BOOST_CLASS_VERSION(fles::ArchiveDescriptor, 1)
94#pragma GCC diagnostic pop
The ArchiveDescriptor class contains metadata on an archive.
std::string hostname() const
Retrieve the hostname of the machine creating the archive.
friend class boost::serialization::access
std::string username() const
Retrieve the hostname of the machine creating the archive.
ArchiveType archive_type() const
Retrieve the type of archive.
ArchiveDescriptor(ArchiveType archive_type)
Public constructor.
std::time_t time_created() const
Retrieve the time of creation of the archive.
Defines utility functions in the fles::system namespace.
std::string current_hostname()
Retrieve current host name.
std::string current_username()
Retrieve current user name.
Main FLES namespace.
ArchiveType
The archive type enum (e.g., timeslice, microslice)