Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

Class «util::Stack<Type,Alloc>»

Stack.

Parameters:
Type — data type of default stack element.
Alloc = Allocator — heap memory allocator class.

public: Stack(Operation type, int32 count);

Constructor.

Parameters:
type — type of this stack.
count — count of buffer elements.

public: Stack(Operation type, int32 count, const Type illegal);

Constructor.

Parameters:
type — type of this stack.
count — count of buffer elements.
illegal — illegal value.

public: virtual ~Stack();

Destructor.

public: virtual Type illegal() const;

Returns illegal element which will be returned as error value.

Returns:
illegal element.

public: virtual void illegal(const Type value);

Sets illegal element which will be returned as error value.

Parameters:
value — illegal value.

public: virtual bool isConstructed() const;

Tests if this object has been constructed.

Returns:
true if object has been constructed successfully.

public: virtual bool isEmpty() const;

Tests if this collection has elements.

Returns:
true if this collection does not contain any elements.

public: virtual bool isIllegal(const Type& value) const;

Tests if given value is an illegal.

Parameters:
value — testing value.
true — if value is an illegal.

public: static bool isObject(const Type* obj);

Tests if given object has been constructed object.

Parameters:
obj — pointer to object.

Returns:
true if object has been constructed successfully.

public: virtual int32 length() const;

Returns a number of elements in this container.

Returns:
number of elements.

public: void operator delete(void* ptr);

Operator delete.

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

public: void* operator new(size_t size);

Operator new.

Parameters:
size — number of bytes to allocate.

Returns:
allocated memory address or a null pointer.

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

Operator new.

Parameters:
size — unused.
ptr — pointer to reserved memory area

Returns:
given pointer.

public: virtual const Type* tos();

Returns an initial top of stack.

Returns:
a memory address to top of this stack when object was built.

protected: static Type alloc(size_t size);

Allocates memory.

Parameters:
size — number of bytes to allocate.

Returns:
allocated memory address or a null pointer.

protected: static void free(void* ptr);

Frees an allocated memory.

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

protected: virtual void setConstruct(bool flag);

Sets the object constructed flag.

Parameters:
flag — constructed flag.

Back to class list