Gorgon Game Engine
basic_Instance< A_ > Class Template Reference

This class allows storing an animation instance regarless of its underlying type as a value. More...

Inheritance diagram for basic_Instance< A_ >:
[legend]

Public Member Functions

 basic_Instance ()=default
 Empty constructor. More...
 
 basic_Instance (A_ &instance, bool owner=true)
 Filling constructor. More...
 
 basic_Instance (basic_Instance &&other)
 Move constructor. More...
 
 basic_Instance (const basic_Instance &)=delete
 Copy constructor is disabled for ownership reasons. More...
 
A_ & GetAnimation () const
 Returns the animation stored in the object. More...
 
bool HasAnimation () const
 Check if this instance has an animation. More...
 
bool IsOwner () const
 Whether the stored animation is owned by this container. More...
 
A_ & operator* () const
 Alias for GetAnimation. More...
 
A_ * operator-> () const
 Alias for GetAnimation. More...
 
basic_Instanceoperator= (A_ &instance)
 Move assignment, owns the assigned object as CreateAnimation returns objects that needs to be owned. More...
 
basic_Instanceoperator= (basic_Instance &&other)
 Move assignment. More...
 
basic_Instanceoperator= (const basic_Instance &)=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, bool owner=true)
 Sets the animation stored in this container. More...
 
- Public Member Functions inherited from Base
 Base (bool create=false)
 This constructor creates a new controller depending on the create parameter. More...
 
 Base (const Base &base)
 Copies the animation. More...
 
 Base (ControllerBase &controller)
 Sets the controller for this animation to the given controller. More...
 
virtual void DeleteAnimation () const
 Deletes this animation. More...
 
virtual ControllerBaseGetController () const
 Returns the controller of this animation. More...
 
virtual int GetDuration () const =0
 Returns the duration of the animation if it is a known apriori. More...
 
virtual bool HasController () const
 Returns whether this animation has a controller. More...
 
virtual bool Progress (unsigned &leftover)=0
 This function should progress the animation. More...
 
virtual void RemoveController ()
 Removes the controller of this animation. More...
 
virtual void SetController (ControllerBase &controller)
 Sets the controller to the given controller. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Base
virtual ~Base ()
 Virtual destructor. More...
 
- Protected Attributes inherited from Base
ControllerBasecontroller
 Controller of this animation. More...
 

Detailed Description

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

This class allows storing an animation instance regarless of its underlying type as a value.

The contained animation can be destroyed along with the instance itself. Destruction process uses DeleteAnimation so that shared animations will not be destroyed.

Constructor & Destructor Documentation

◆ basic_Instance() [1/4]

basic_Instance ( )
default

Empty constructor.

◆ basic_Instance() [2/4]

basic_Instance ( A_ &  instance,
bool  owner = true 
)

Filling constructor.

◆ basic_Instance() [3/4]

basic_Instance ( const basic_Instance< A_ > &  )
delete

Copy constructor is disabled for ownership reasons.

◆ basic_Instance() [4/4]

basic_Instance ( basic_Instance< A_ > &&  other)

Move constructor.

Member Function Documentation

◆ 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 instance has an animation.

◆ IsOwner()

bool IsOwner ( ) const

Whether the stored animation is owned by this container.

◆ operator*()

A_& operator* ( ) const

Alias for GetAnimation.

References basic_Instance< A_ >::GetAnimation().

◆ operator->()

A_* operator-> ( ) const

Alias for GetAnimation.

References basic_Instance< A_ >::GetAnimation().

◆ operator=() [1/3]

basic_Instance& operator= ( A_ &  instance)

Move assignment, owns the assigned object as CreateAnimation returns objects that needs to be owned.

References basic_Instance< A_ >::Remove().

◆ operator=() [2/3]

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

Move assignment.

References basic_Instance< A_ >::Remove().

◆ operator=() [3/3]

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

Copy assignment.

◆ Release()

A_* Release ( )

Removes the animation from the storage without destroying it.

References basic_Instance< 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()

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

Sets the animation stored in this container.

References basic_Instance< A_ >::Remove().


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