ANNA Suite  2020b
Multipurpose development suite for Telco applications
Object.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_dbos_Object_hpp
10 #define anna_dbos_Object_hpp
11 
13 
15 
16 #include <anna/dbos/Loader.hpp>
17 
18 namespace anna {
19 
20 namespace dbos {
21 
22 class Creator;
23 
35 class Object {
36 public:
41  Index getIndex() const { return a_index; }
42 
49  bool isStored() const { return a_isStored; }
50 
51 protected:
55  Object() : a_index(0), a_isStored(false) {;}
56 
64  virtual void initialize(Loader& loader) noexcept(false) = 0;
65 
71  virtual void create(Creator& creator) noexcept(false) {;}
72 
77  virtual void destroy() {;}
78 
89  virtual bool hasChanges(Loader& loader) noexcept(false) {
90  return true;
91  }
92 
97  virtual bool enableUpdate() const { return true; }
98 
99 private:
100  Index a_index;
101  bool a_isStored;
102 
103  void setIndex(const Index index) { a_index = index; }
104 
105  friend class StorageArea;
106 };
107 
108 
109 }
110 }
111 
112 #endif
U64 Index
Definition: defines.hpp:18
Definition: Object.hpp:35
Object()
Definition: Object.hpp:55
Index getIndex() const
Definition: Object.hpp:41
virtual void initialize(Loader &loader) noexcept(false)=0
Definition: Creator.hpp:22
virtual void destroy()
Definition: Object.hpp:77
virtual void create(Creator &creator) noexcept(false)
Definition: Object.hpp:71
Definition: Loader.hpp:28
virtual bool enableUpdate() const
Definition: Object.hpp:97
Definition: app.hpp:12
bool isStored() const
Definition: Object.hpp:49
Definition: StorageArea.hpp:58
virtual bool hasChanges(Loader &loader) noexcept(false)
Definition: Object.hpp:89