ANNA Suite  2020b
Multipurpose development suite for Telco applications
Cloneable.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_core_Cloneable_hpp
10 #define anna_core_Cloneable_hpp
11 
12 #include <typeinfo>
13 
14 #include <anna/core/functions.hpp>
17 
18 namespace anna {
19 
27 class Cloneable : public AutoPointer {
28 public:
32  virtual ~Cloneable() {;}
33 
38  virtual Cloneable* clone() const = 0;
39 
44  static const char* className() { return "Cloneable"; }
45 
46 protected:
51  Cloneable(const WhenFinished::_v whenFinished = WhenFinished::Ignore) : AutoPointer(whenFinished) {;}
52 
59  Cloneable(const Cloneable& other) : AutoPointer(WhenFinished::Delete) {;}
60 };
61 
72 #define anna_clone_final(Class) \
73  Class* clone () const { return new Class (*this); } \
74  friend class AutoPointer;
75 
86 #define anna_clone_default(Class) \
87  virtual Class* clone () const { return new Class (*this); } \
88  friend class AutoPointer;
89 
100 #define anna_clone_abstract(Class) \
101  virtual Class* clone () const = 0; \
102  friend class AutoPointer;
103 
104 }
105 
106 #endif
107 
108 
virtual ~Cloneable()
Definition: Cloneable.hpp:32
Definition: Cloneable.hpp:27
Definition: AutoPointer.hpp:23
Cloneable(const WhenFinished::_v whenFinished=WhenFinished::Ignore)
Definition: Cloneable.hpp:51
Definition: app.hpp:12
virtual Cloneable * clone() const =0
Definition: AutoPointer.hpp:29
static const char * className()
Definition: Cloneable.hpp:44
Cloneable(const Cloneable &other)
Definition: Cloneable.hpp:59
Definition: AutoPointer.hpp:31
_v
Definition: AutoPointer.hpp:30