7 #ifndef NUKLEI_MEMBER_CLONE_PTR_H
8 #define NUKLEI_MEMBER_CLONE_PTR_H
23 if (p.isDefined()) ptr_ = p->clone();
27 if (p.isDefined()) ptr_ = p->clone();
32 void assertConsistency()
const
35 if (isDefined()) get().assertConsistency();
39 T& operator* () {
return get(); }
40 const T& operator* ()
const {
return get(); }
42 T* operator-> () {
return &get(); }
43 const T* operator-> ()
const {
return &get(); }
45 bool isDefined()
const {
return ptr_.get() != NULL; }
52 void set(
const T& element) { ptr_ = element.clone(); }
54 void clear() { ptr_.reset(); }
57 NUKLEI_UNIQUE_PTR<T> ptr_;
59 friend class NUKLEI_SERIALIZATION_FRIEND_CLASSNAME;
60 template<
class Archive>
61 void serialize(Archive &ar,
const unsigned int version)
63 ar & NUKLEI_SERIALIZATION_NVP(ptr_);