Gorgon Game Engine
basic_Storage< A_ > Class Template Reference

This class stores animations as a part of itself so that it can be moved around as a value rather than a reference. More...

Inheritance diagram for basic_Storage< A_ >:
[legend]

Public Member Functions

 basic_Storage ()=default
 Empty constructor. More...
 
 basic_Storage (A_ &anim, bool owner=false)
 Filling constructor. More...
 
 basic_Storage (basic_Storage &&other)
 Move constructor. More...
 
 basic_Storage (const basic_Storage &)=delete
 Copy constructor is disabled for ownership reasons. More...
 
virtual A_::AnimationType & CreateAnimation (bool create=true) const override
 This function creates a new animation from the stored animation provider. More...
 
virtual A_::AnimationType & CreateAnimation (ControllerBase &timer) const override
 This function creates a new animation from the stored animation provider. More...
 
A_ & GetAnimation () const
 Returns the animation stored in the object. More...
 
bool HasAnimation () const
 Check if this storage has an animation. More...
 
bool IsOwner () const
 Whether the stored animation is owned by this container. More...
 
virtual auto MoveOutProvider () -> decltype(*this) override
 This function moves this animation provider into a new provider. More...
 
A_ & operator* () const
 Alias for GetAnimation. More...
 
A_ * operator-> () const
 Alias for GetAnimation. More...
 
basic_Storageoperator= (basic_Storage &&other)
 Move assignment. More...
 
basic_Storageoperator= (const basic_Storage &)=delete
 Copy assignment. More...
 
A_ * Release ()
 Removes the animation from the storage without destroying it. More...
 
void Remove ()
 Removes the animation stored in the container, if the container owns the animation, it will be destroyed. More...
 
void SetAnimation (A_ &&value)
 Sets the animation stored in this container. More...
 
void SetAnimation (A_ &value, bool owner=false)
 Sets the animation stored in this container. More...
 
- Public Member Functions inherited from Provider
virtual ~Provider ()
 Virtual destructor. More...
 

Additional Inherited Members

- Public Types inherited from Provider
using AnimationType = Base
 

Detailed Description

template<class A_>
class Gorgon::Animation::basic_Storage< A_ >

This class stores animations as a part of itself so that it can be moved around as a value rather than a reference.

Constructor & Destructor Documentation

◆ basic_Storage() [1/4]

basic_Storage ( )
default

Empty constructor.

◆ basic_Storage() [2/4]

basic_Storage ( A_ &  anim,
bool  owner = false 
)

Filling constructor.

◆ basic_Storage() [3/4]

basic_Storage ( const basic_Storage< A_ > &  )
delete

Copy constructor is disabled for ownership reasons.

◆ basic_Storage() [4/4]

basic_Storage ( basic_Storage< A_ > &&  other)

Move constructor.

Member Function Documentation

◆ CreateAnimation() [1/2]

virtual A_::AnimationType& CreateAnimation ( bool  create = true) const
overridevirtual

This function creates a new animation from the stored animation provider.

If there is no animation provider stored, it will throw std::runtime_error

Implements Provider.

◆ CreateAnimation() [2/2]

virtual A_::AnimationType& CreateAnimation ( ControllerBase timer) const
overridevirtual

This function creates a new animation from the stored animation provider.

If there is no animation provider stored, it will throw std::runtime_error

Implements Provider.

◆ GetAnimation()

A_& GetAnimation ( ) const

Returns the animation stored in the object.

If there is no animation provider stored, it will throw std::runtime_error

◆ HasAnimation()

bool HasAnimation ( ) const

Check if this storage has an animation.

◆ IsOwner()

bool IsOwner ( ) const

Whether the stored animation is owned by this container.

◆ MoveOutProvider()

virtual auto MoveOutProvider ( ) -> decltype(*this)
overridevirtual

This function moves this animation provider into a new provider.

Ownership of this new object belongs to the caller and this object could be destroyed safely.

Implements Provider.

References basic_Storage< A_ >::basic_Storage().

◆ operator*()

A_& operator* ( ) const

Alias for GetAnimation.

References basic_Storage< A_ >::GetAnimation().

◆ operator->()

A_* operator-> ( ) const

Alias for GetAnimation.

References basic_Storage< A_ >::GetAnimation().

◆ operator=() [1/2]

basic_Storage& operator= ( basic_Storage< A_ > &&  other)

Move assignment.

References basic_Storage< A_ >::Remove().

◆ operator=() [2/2]

basic_Storage& operator= ( const basic_Storage< A_ > &  )
delete

Copy assignment.

◆ Release()

A_* Release ( )

Removes the animation from the storage without destroying it.

References basic_Storage< A_ >::Remove().

◆ Remove()

void Remove ( )

Removes the animation stored in the container, if the container owns the animation, it will be destroyed.

Use Release to release resource without destroying it

◆ SetAnimation() [1/2]

void SetAnimation ( A_ &&  value)

Sets the animation stored in this container.

References basic_Storage< A_ >::Remove().

◆ SetAnimation() [2/2]

void SetAnimation ( A_ &  value,
bool  owner = false 
)

Sets the animation stored in this container.

References basic_Storage< A_ >::Remove().


The documentation for this class was generated from the following file: