1 /*
2  *  Copyright (C) 2005-2021 Team Kodi (https://kodi.tv)
3  *
4  *  SPDX-License-Identifier: GPL-2.0-or-later
5  *  See LICENSE.md for more information.
6  */
7 
8 #pragma once
9 
10 #include <cstdint>
11 
12 namespace tvheadend
13 {
14 namespace entity
15 {
16 
17 /**
18  * Abstract entity. An entity can be dirty or clean and has a numeric ID.
19  */
20 class Entity
21 {
22 public:
Entity()23   Entity() : m_id(0), m_dirty(false){};
24   virtual ~Entity() = default;
25 
26   /**
27    * @return if the entity is dirty
28    */
IsDirty()29   virtual bool IsDirty() const { return m_dirty; }
30 
31   /**
32    * Marks the entity as dirty or not
33    * @param dirty
34    */
SetDirty(bool dirty)35   virtual void SetDirty(bool dirty) { m_dirty = dirty; }
36 
37   /**
38    * @return the entity ID
39    */
GetId()40   uint32_t GetId() const { return m_id; }
41 
42   /**
43    * Sets the entity ID
44    * @param id
45    */
SetId(uint32_t id)46   void SetId(uint32_t id) { m_id = id; }
47 
48 protected:
49   uint32_t m_id;
50 
51 private:
52   bool m_dirty;
53 };
54 
55 } // namespace entity
56 } // namespace tvheadend
57