PixelLightAPI  .
Public Types | Public Member Functions
PLCore::Chunk Class Reference

Chunk of data - one may also call it BLOB (binary large object) More...

#include <Chunk.h>

Inheritance diagram for PLCore::Chunk:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ESemantic { Unknown = 0, Position = 1, Rotation = 2, Scale = 3 }
 Semantic. More...
enum  EElementType {
  Int8 = 0, Int16 = 1, Int32 = 2, UInt8 = 3,
  UInt16 = 4, UInt32 = 5, Float = 6, Double = 7
}
 Element type. More...

Public Member Functions

PLCORE_API Chunk ()
 Constructor.
virtual PLCORE_API ~Chunk ()
 Destructor.
ESemantic GetSemantic () const
 Returns the semantic.
void SetSemantic (ESemantic nSemantic)
 Sets the semantic.
PLCORE_API bool Allocate (EElementType nElementType, uint32 nNumOfComponentsPerElement, uint32 nNumOfElements)
 Allocates the chunk.
uint8 * GetData ()
 Returns the chunk data.
const uint8 * GetData () const
 Returns the chunk data.
uint8 * GetElementComponentData (uint32 nElement, uint32 nComponent)
 Returns the chunk element component data.
const uint8 * GetElementComponentData (uint32 nElement, uint32 nComponent) const
 Returns the chunk element component data.
PLCORE_API void Clear ()
 Clears the chunk.
EElementType GetElementType () const
 Returns the element type.
uint32 GetNumOfComponentsPerElement () const
 Returns the number of components per element.
uint32 GetNumOfElements () const
 Returns the number of elements.
PLCORE_API uint32 GetNumOfBytesPerElementComponent () const
 Returns the number of bytes per component of an element.
uint32 GetNumOfBytesPerElement () const
 Returns the number of bytes per element.
uint32 GetTotalNumOfBytes () const
 Returns the total number of bytes of the chunk data.
uint32 GetTotalNumOfComponents () const
 Returns the total number of components (all elements summed up) within the chunk.
virtual PLCORE_API bool Unload () override
 Unloads the loadable.
virtual PLCORE_API String GetLoadableTypeName () const override
 Returns the loadable type name.

Detailed Description

Chunk of data - one may also call it BLOB (binary large object)

Remarks:
This class encapsulates a chunk of data in a quite primitive way. The semantic of the chunk data can be provided, but it's no requirement. A chunk consists of a bunch of elements, were each element consists of at least one component and all components of all elements have the same data type. A chunk can for example be used to store keyframed positions for animation purposes.

Member Enumeration Documentation

Semantic.

Enumerator:
Unknown 

Unknown

Position 

Position

Rotation 

Rotation

Scale 

Scale

Element type.

Enumerator:
Int8 

Int8

Int16 

Int16

Int32 

Int32

UInt8 

UInt8

UInt16 

UInt16

UInt32 

UInt32

Float 

Float

Double 

Double


Constructor & Destructor Documentation

PLCORE_API PLCore::Chunk::Chunk ( )
virtual PLCORE_API PLCore::Chunk::~Chunk ( ) [virtual]

Destructor.


Member Function Documentation

Returns the semantic.

Returns:
The semantic
void PLCore::Chunk::SetSemantic ( ESemantic  nSemantic) [inline]

Sets the semantic.

Parameters:
[in]nSemanticThe semantic
PLCORE_API bool PLCore::Chunk::Allocate ( EElementType  nElementType,
uint32  nNumOfComponentsPerElement,
uint32  nNumOfElements 
)

Allocates the chunk.

Parameters:
[in]nElementTypeThe element type
[in]nNumOfComponentsPerElementThe number of components per element
[in]nNumOfElementsThe number of elements
Returns:
'true' if all went fine, else 'false'
uint8 * PLCore::Chunk::GetData ( ) [inline]

Returns the chunk data.

Returns:
The chunk data, can be a null pointer - do NOT delete this memory!
const uint8 * PLCore::Chunk::GetData ( ) const [inline]

Returns the chunk data.

Returns:
The chunk data, can be a null pointer - do NOT delete this memory!
uint8 * PLCore::Chunk::GetElementComponentData ( uint32  nElement,
uint32  nComponent 
) [inline]

Returns the chunk element component data.

Parameters:
[in]nElementElement index to return the component data from (0 - GetNumOfElements()-1), must be valid!
[in]nComponentIndex of the element component to data from (0 - GetNumOfComponentsPerElement()-1), must be valid!
Returns:
The chunk element component data, can be a null pointer - do NOT delete this memory!
const uint8 * PLCore::Chunk::GetElementComponentData ( uint32  nElement,
uint32  nComponent 
) const [inline]

Returns the chunk element component data.

Parameters:
[in]nElementElement index to return the component data from (0 - GetNumOfElements()-1), must be valid!
[in]nComponentIndex of the element component to data from (0 - GetNumOfComponentsPerElement()-1), must be valid!
Returns:
The chunk element component data, can be a null pointer - do NOT delete this memory!
PLCORE_API void PLCore::Chunk::Clear ( )

Clears the chunk.

Returns the element type.

Returns:
The element type

Returns the number of components per element.

Returns:
The number of components per element
uint32 PLCore::Chunk::GetNumOfElements ( ) const [inline]

Returns the number of elements.

Returns:
The number of elements

Returns the number of bytes per component of an element.

Returns:
The number of bytes per component of an element
uint32 PLCore::Chunk::GetNumOfBytesPerElement ( ) const [inline]

Returns the number of bytes per element.

Returns:
The number of bytes per element
uint32 PLCore::Chunk::GetTotalNumOfBytes ( ) const [inline]

Returns the total number of bytes of the chunk data.

Returns:
The total number of bytes of the chunk data
uint32 PLCore::Chunk::GetTotalNumOfComponents ( ) const [inline]

Returns the total number of components (all elements summed up) within the chunk.

Returns:
The total number of components within the chunk
virtual PLCORE_API bool PLCore::Chunk::Unload ( ) [override, virtual]

Unloads the loadable.

Returns:
'true' if all went fine, else 'false'

Reimplemented from PLCore::Loadable.

virtual PLCORE_API String PLCore::Chunk::GetLoadableTypeName ( ) const [override, virtual]

Returns the loadable type name.

Returns:
The loadable type name

Reimplemented from PLCore::Loadable.


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:28
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported