-
Notifications
You must be signed in to change notification settings - Fork 1
/
booking.h
62 lines (50 loc) · 1.69 KB
/
booking.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef BOOKING_H
#define BOOKING_H
#include "rocksentity.h"
#include "usuario.h"
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/date_time/gregorian/greg_serialize.hpp>
#include <memory>
namespace cxxdoor {
class Booking : public RocksEntity {
friend boost::serialization::access;
friend std::ostream &operator<<(std::ostream &os, const Booking &c);
public:
Booking();
Booking(Booking &&other) noexcept:
RocksEntity(std::move(other)),
usuario(nullptr), to(other.to), from(other.from) {
usuario = other.usuario;
other.usuario = nullptr;
}
virtual ~Booking() = default;
template<class Archive>
void serialize(Archive &ar, const unsigned int /* version */) {
ar & boost::serialization::base_object<RocksEntity>(*this) &
usuario & from & to;
}
bool operator<(const Booking &rhs) const;
bool operator>(const Booking &rhs) const;
bool operator<=(const Booking &rhs) const;
bool operator>=(const Booking &rhs) const;
bool operator==(const Booking &rhs) const;
bool operator!=(const Booking &rhs) const;
private:
std::shared_ptr<Usuario> usuario;
boost::gregorian::date from;
boost::gregorian::date to;
// RocksEntity interface
public:
folly::dynamic get_json() const override;
std::shared_ptr<Usuario> getUsuario() const;
void setUsuario(const std::shared_ptr<Usuario> &value);
boost::gregorian::date getFrom() const;
void setFrom(const boost::gregorian::date &value);
boost::gregorian::date getTo() const;
void setTo(const boost::gregorian::date &value);
};
}
#endif // BOOKING_H