Irregularity.h 2.2 KB
Newer Older
Matteo's avatar
update  
Matteo committed
1
2
3
4
5
6
7
8
9
10
#ifndef IRREGULARITY_H
#define IRREGULARITY_H
#include <boost/uuid/uuid.hpp>
#include <nlohmann/json.hpp>
#include "enums.h"

using std::string;
using json = nlohmann::json;

/**
Matteo's avatar
Matteo committed
11
 * @class Irregularity
Matteo's avatar
update  
Matteo committed
12
13
14
 * @brief an irregularity of the tape detected by the system
 * 
 */
Matteo's avatar
Matteo committed
15
16
class Irregularity {
private:
Matteo's avatar
update  
Matteo committed
17
18
19
    boost::uuids::uuid id;
    Source source;
    string time_label;
Matteo's avatar
Matteo committed
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
    std::optional<IrregularityType> type;
    std::optional<string> image_URI;
    std::optional<string> audio_URI;
public:
    Irregularity(const Irregularity& other);
    Irregularity(Irregularity&& other) noexcept;
    Irregularity(Source source, string time_label);
    Irregularity(Source source, string time_label, IrregularityType type);
    ~Irregularity() = default;
    /**
     * @brief Convert the Irregularity to a JSON object
     * 
     * @return json 
     */
    json to_JSON() const;
    /**
     * @brief Create an Irregularity object from a JSON object
     * 
     * @param j the JSON object
     * @return Irregularity 
     */
    static Irregularity from_JSON(const json& j);
    /**
     * @brief Get the source object
     * 
     * @return Source 
     */
    Source get_source() const;
    /**
     * @brief Get the time label object
     * 
     * @return string 
     */
    string get_time_label() const;
    /**
     * @brief Get the type object
     * 
     * @return IrregularityType 
     */
    std::optional<IrregularityType> get_type() const;
    /**
     * @brief Get the id object
     * 
     * @return boost::uuids::uuid 
     */
    boost::uuids::uuid get_id() const;
    /**
     * @brief Get the audio URI object
     * 
     * @return std::optional<string> 
     */
    std::optional<string> get_audio_URI() const;
    /**
     * @brief Get the image URI object
     * 
     * @return std::optional<string> 
     */
    std::optional<string> get_image_URI() const;
    /**
     * @brief Set the audio URI object
     * 
     * @param audio_URI 
     * @return Irregularity& 
     */
    Irregularity& set_audio_URI(string audio_URI);
    /**
     * @brief Set the image URI object
     * 
     * @param image_URI 
     * @return Irregularity& 
     */
    Irregularity& set_image_URI(string image_URI);
Matteo's avatar
update  
Matteo committed
92
93
94
};

#endif // IRREGULARITY_H