PixelLightAPI  .
Public Member Functions | Protected Member Functions | Protected Attributes
PLCore::Element< AType > Class Template Reference

Element template. More...

#include <Element.h>

List of all members.

Public Member Functions

 Element (const String &sName="", ElementManager< AType > *pManager=nullptr)
 Constructor.
ElementManager< AType > * GetManager () const
 Returns the element manager using this element.
String GetName () const
 Returns the unique element name.
bool IsProtected () const
 Returns whether the element is protected or not.
void SetProtected (bool bProtected=false)
 Sets whether the element is protected or not.
int GetID () const
 Returns the ID of the element within the resource manager.
uint32 GetNumOfHandlers () const
 Returns the number of element handlers.
ElementHandler< AType > * GetHandler (uint32 nIndex) const
 Returns a element handler.
virtual bool Delete (bool bProtectedToo=false)
 Destroys the element.
virtual bool SetName (const String &sName)
 Sets the element name.
virtual Element< AType > & operator= (const Element< AType > &cSource)
 Copy operator.

Protected Member Functions

virtual ~Element ()
 Destructor.

Protected Attributes

ElementManager< AType > * m_pManager
String m_sName
bool m_bProtected
Array< ElementHandler< AType > * > m_lstHandlers

Detailed Description

template<class AType>
class PLCore::Element< AType >

Element template.


Constructor & Destructor Documentation

template<class AType>
PLCore::Element< AType >::Element ( const String sName = "",
ElementManager< AType > *  pManager = nullptr 
)

Constructor.

Parameters:
[in]sNameElement name to set
[in]pManagerElement manager using this element, can be a null pointer
template<class AType >
PLCore::Element< AType >::~Element ( ) [protected, virtual]

Destructor.

Reimplemented in PLPhysics::Element.


Member Function Documentation

template<class AType >
ElementManager< AType > * PLCore::Element< AType >::GetManager ( ) const

Returns the element manager using this element.

Returns:
Element manager using this element or a null pointer
template<class AType >
String PLCore::Element< AType >::GetName ( ) const

Returns the unique element name.

Returns:
Unique element name
Note:
  • Because within a element manager a element is managed using it's name, this element name MUST be unique!
template<class AType >
bool PLCore::Element< AType >::IsProtected ( ) const

Returns whether the element is protected or not.

Returns:
'true' if the element is protected, else 'false'
Note:
  • Protected element are only removed if their manager is cleared!
template<class AType >
void PLCore::Element< AType >::SetProtected ( bool  bProtected = false)

Sets whether the element is protected or not.

Parameters:
[in]bProtectedIs the element protected?
See also:
template<class AType >
int PLCore::Element< AType >::GetID ( ) const

Returns the ID of the element within the resource manager.

Returns:
ID of the element within the element manager, -1 if there was an error (maybe this element is not within a element manager)
Note:
  • The element ID isn't fixed, if you remove some elements from the manager it's possible that the element ID is changed!

Reimplemented in PLMesh::AnchorPoint, PLRenderer::AnimationEvent, and PLMesh::Joint.

template<class AType >
uint32 PLCore::Element< AType >::GetNumOfHandlers ( ) const

Returns the number of element handlers.

Returns:
The number of element handlers
Note:
  • The handlers will be informed if the element was lost
template<class AType >
ElementHandler< AType > * PLCore::Element< AType >::GetHandler ( uint32  nIndex) const

Returns a element handler.

Parameters:
[in]nIndexIndex of the element handler to return
Returns:
The requested element handler, a null pointer on error
template<class AType >
bool PLCore::Element< AType >::Delete ( bool  bProtectedToo = false) [virtual]

Destroys the element.

Parameters:
[in]bProtectedTooDo also destroy the element if it is protected?
Returns:
'true' if all went fine, else 'false' (maybe the element is protected?)
Note:
  • Whether the element is destroyed within this function or just added for instance to a kind of 'destruction list' is implementation dependent.

Reimplemented in PLScene::SceneNode.

template<class AType >
bool PLCore::Element< AType >::SetName ( const String sName) [virtual]

Sets the element name.

Sets the unique element name.

Parameters:
[in]sNameNew element name
Returns:
'true' if all went fine, else 'false' (maybe the name is already used)
See also:
Note:
  • Overload this function if it's for instance not allowed to change the name of the element

Reimplemented in PLScene::SceneNode.

template<class AType>
Element< AType > & PLCore::Element< AType >::operator= ( const Element< AType > &  cSource) [virtual]

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
This instance
Note:
  • Manager, handlers and name are not copied

Member Data Documentation

template<class AType>
ElementManager<AType>* PLCore::Element< AType >::m_pManager [protected]

Element manager, can be a null pointer

template<class AType>
String PLCore::Element< AType >::m_sName [protected]

Resource name

template<class AType>
bool PLCore::Element< AType >::m_bProtected [protected]

Is the element protected?

template<class AType>
Array<ElementHandler<AType>*> PLCore::Element< AType >::m_lstHandlers [protected]

Element handler list


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:24
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported