File: StateFlags.h

package info (click to toggle)
drbd-utils 9.22.0-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,768 kB
  • sloc: ansic: 48,975; xml: 11,553; cpp: 9,843; sh: 4,568; makefile: 1,029; perl: 353; ruby: 43
file content (44 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (5)
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
#ifndef STATEFLAGS_H
#define	STATEFLAGS_H

#include <cstdint>

class StateFlags
{
  public:

    // MARK is used to indicate that sub-objects
    // of the marked object have warnings or alerts
    enum class state : uint16_t
    {
        NORM,
        MARK,
        WARN,
        ALERT
    };

    StateFlags() = default;
    StateFlags(const StateFlags& orig) = default;
    StateFlags& operator=(const StateFlags& orig) = default;
    StateFlags(StateFlags&& orig) = default;
    StateFlags& operator=(StateFlags&& orig) = default;
    virtual ~StateFlags() noexcept
    {
    }

    virtual bool has_mark_state() const;
    virtual bool has_warn_state() const;
    virtual bool has_alert_state() const;
    virtual void set_mark();
    virtual void set_warn();
    virtual void set_alert();
    virtual state get_state() const;
    virtual void clear_state_flags();
    virtual state update_state_flags() = 0;
    virtual state child_state_flags_changed() = 0;

  protected:
    state obj_state {StateFlags::state::ALERT};
};

#endif	/* STATEFLAGS_H */