9 #ifndef __MEOWPP_UTILITY_POINTER_H__
10 #define __MEOWPP_UTILITY_POINTER_H__
32 template<
typename Type>
47 RealPointer(Type* arg_address,
54 counter(arg_counter) {}
72 void Attach(RealPointer* arg_ptr2) {
79 if (ptr_->counter == 0) {
107 ptr_(new RealPointer(arg_address, arg_type, arg_auto_delete, 1)) {}
118 return ptr_->auto_delete;
125 return ptr_->address;
131 operator Type*()
const {
156 (*this) = *
dynamic_cast<Pointer const*
>(another_pointer);
161 return (ptr_->address ==
162 dynamic_cast<Pointer const*>(another_pointer)->ptr_->address);
165 #ifdef MEOWPP_UTILITY_POINTER_TESTING
166 friend class PointerTest;
167 #endif // MEOWPP_UTILLITY_POINTER_TESTING
173 #endif // __MEOWPP_UTILITY_POINTER_H__
A pointer points to the template Type.
Type * address() const
Gets the address it points to.
Object * CopyFrom(Object const *another_pointer)
Copies data from another object.
Pointer()
Default constructor, let the pointer points to NULL.
PointerType
Types of pointer.
Pointer & operator=(Pointer const &b)
Points to another instance of Pointer.
bool Equals(Object const *another_pointer)
Type * operator->() const
Gets the pointer points to the body.
Pointer(Pointer const &arg_ptr)
Copy constructor.
Contains a base class for most of all the classes in meowpp.
Object * Copy() const
Creates a copy of itself and return the pointer to it.
Pointer(Type *arg_address, PointerType arg_type, bool arg_auto_delete)
Constructor with gived address to point.
bool auto_delete() const
Gets whether it will delete the address automatically or not.