Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

Class «eoos::lib::UniquePointer<T,D,A>»

Unique pointer.

public: UniquePointer();

Constructor of an empty unique object.

public: explicit UniquePointer(T* pointer);

Constructor.

Parameters:
pointer — A pointer to get ownership.

public: UniquePointer(UniquePointer&& obj) noexcept;

Move constructor.

Parameters:
obj — Right reference to a source object.

public: virtual ~UniquePointer();

Destructor.

public: virtual T* get() const;

Returns pointer to the managed object.

Returns:
Pointer to the managed object or NULLPTR if no object managed.

public: virtual int32_t getCount() const;

Returns amount of smart objects for the managed object.

Returns:
Amount of smart objects manage the same object, if no managed object, 0 is returned.

public: virtual bool_t isConstructed() const;

Tests if this object has been constructed.

Returns:
True if object has been constructed successfully.

public: static bool_t isConstructed(api::Object* obj);

Tests if an object has been constructed.

Parameters:
obj — Object to be tested.

Returns:
True if object has been constructed successfully.

public: virtual bool_t isNull() const;

Tests if this smart object does not manage any object.

Returns:
true if no object managed.

public: virtual bool_t isUnique() const;

Tests if this smart object is only one manages an object.

Returns:
true if this smart object is one, otherwise false.

public: operator bool_t() const;

Casts to boolean data type comparing if the stored pointer does not equal to null.

Returns:
Comparation the stored pointer does not equal to null.

public: static void operator delete(void* ptr);

Operator delete.

Parameters:
ptr — An address of allocated memory block or a null pointer.

public: static void operator delete(void*, void*);

Operator delete.

public: static void* operator new(size_t size);

Operator new.

Parameters:
size — A number of bytes to allocate.

Returns:
Allocated memory address or a null pointer.

public: static void* operator new(size_t, void* ptr);

Operator new.

Parameters:
ptr — A pointer to reserved memory area.

Returns:
The given pointer.

public: T& operator*() const;

Returns the result of dereferencing the stored pointer.

Returns:
The dereferenced stored pointer.

public: T* operator->() const;

Returns the stored pointer.

Returns:
The stored pointer or NULLPTR if no pointer stored.

public: Object& operator=(Object const& obj);

Copy assignment operator.

Parameters:
obj — Reference to a source object.

Returns:
Reference to this object.

public: Object& operator=(Object&& obj) & noexcept;

Move assignment operator.

Parameters:
obj — Right reference to a source object.

Returns:
Reference to this object.

public: UniquePointer& operator=(UniquePointer&& obj) & noexcept;

Move assignment operator.

Parameters:
obj — Right reference to a source object.

Returns:
Reference to this object.

public: T& operator[](uint32_t index) const;

Returns an element of the stored array.

Parameters:
index — An element index.

Returns:
An element.

public: T* release();

Releases ownership of the managed object.

Returns:
Released raw pointer.

public: virtual void reset();

Releases the managed object.

public: virtual void reset(T* ptr);

Replaces the managed object with a given object.

Parameters:
ptr — An object to replace the managed object.

public: void swap(UniquePointer& obj);

Swaps this managed object with an object managed by given smart object.

Parameters:
obj — A smart object to swap managed objects.

Back to class list