This class implements the platform independent base class for all resource managers which can be specialized for specific applications.
More...
#include <ResourceManager.h>
|
typedef std::vector< uint8_t > | Buffer |
| Definition of a vector holding 8 bit values.
|
|
typedef ObjectRef< Buffer > | BufferRef |
| Definition of an object reference holding a buffer.
|
|
|
void | addFrameResolution (const unsigned int id, const FrameRef &frame) |
| Adds a new frame resolution of/for a specified resource frame.
|
|
void | addData (const unsigned int id, const BufferRef &buffer) |
| Adds a new data/buffer resource.
|
|
void | addData (const unsigned int id, Buffer &&buffer) |
| Adds a new data/buffer resource (moves the buffer into this manager).
|
|
FrameRef | frame (const unsigned int id, const unsigned int width=0u, const unsigned int height=0u, const bool downscaleIfNecessary=true) |
| Returns a specific resource frame.
|
|
FrameRef | frame (const unsigned int id, const double scaleFactor) |
| Returns a specific resource frame for a specified screen scaling factor.
|
|
BufferRef | data (const unsigned int id) |
| Returns a specified resource buffer (any kind of arbitrary resource data which is not a frame/image).
|
|
void | release () |
| Releases the entire resources of this manager.
|
|
|
typedef std::unordered_map< unsigned int, FrameRefs > | FrameMap |
| Definition of a map mapping resource ids to frames with individual resolutions.
|
|
typedef std::unordered_map< unsigned int, BufferRef > | BufferMap |
| Definition of a map mapping resource ids to buffer objects.
|
|
This class implements the platform independent base class for all resource managers which can be specialized for specific applications.
Application specific resource manager should be implemented as singletons and should be derived from this base class.
◆ Buffer
Definition of a vector holding 8 bit values.
◆ BufferMap
Definition of a map mapping resource ids to buffer objects.
◆ BufferRef
Definition of an object reference holding a buffer.
◆ FrameMap
Definition of a map mapping resource ids to frames with individual resolutions.
◆ ResourceManager()
Ocean::Platform::ResourceManager::ResourceManager |
( |
| ) |
|
|
protected |
The protected default constructor.
◆ ~ResourceManager()
virtual Ocean::Platform::ResourceManager::~ResourceManager |
( |
| ) |
|
|
protectedvirtual |
Destructs the resource manager.
◆ addData() [1/2]
void Ocean::Platform::ResourceManager::addData |
( |
const unsigned int |
id, |
|
|
Buffer && |
buffer |
|
) |
| |
Adds a new data/buffer resource (moves the buffer into this manager).
- Parameters
-
id | The application-wide unique id of the resource |
buffer | The buffer of the resource to be moved |
◆ addData() [2/2]
void Ocean::Platform::ResourceManager::addData |
( |
const unsigned int |
id, |
|
|
const BufferRef & |
buffer |
|
) |
| |
Adds a new data/buffer resource.
- Parameters
-
id | The application-wide unique id of the resource |
buffer | The buffer of the resource |
◆ addFrameResolution()
void Ocean::Platform::ResourceManager::addFrameResolution |
( |
const unsigned int |
id, |
|
|
const FrameRef & |
frame |
|
) |
| |
Adds a new frame resolution of/for a specified resource frame.
Beware: The first resolution of a unique resource frame is expected to be the native resolution for screens without any explicit DPI scaling.
- Parameters
-
id | The application-wide unique id of the resource frame for which a frame with specific resolution will be registered |
frame | The frame representing one specific resolution of the specified resource frame |
◆ data()
BufferRef Ocean::Platform::ResourceManager::data |
( |
const unsigned int |
id | ) |
|
Returns a specified resource buffer (any kind of arbitrary resource data which is not a frame/image).
- Parameters
-
id | The application-wide unique id of the requested resource data |
- Returns
- The requested data, if any
◆ frame() [1/2]
FrameRef Ocean::Platform::ResourceManager::frame |
( |
const unsigned int |
id, |
|
|
const double |
scaleFactor |
|
) |
| |
Returns a specific resource frame for a specified screen scaling factor.
The provided factor is the relation between the current screen scaling and a native scaling.
I.e., The resulting frame for a scaling of 2 has twice of the dimension as the frame for a scaling of 1.
- Parameters
-
id | The application-wide unique id of the requested resource frame |
scaleFactor | The screen scaling factor for which the frame with matching resolution is determined, with range (0, infinity) |
- Returns
- The requested frame, if any
◆ frame() [2/2]
FrameRef Ocean::Platform::ResourceManager::frame |
( |
const unsigned int |
id, |
|
|
const unsigned int |
width = 0u , |
|
|
const unsigned int |
height = 0u , |
|
|
const bool |
downscaleIfNecessary = true |
|
) |
| |
Returns a specific resource frame.
This function allows to specified the dimension of the resulting frame.
- Parameters
-
id | The application-wide unique id of the requested resource frame |
width | Optional width of the resulting frame in pixel, with range [1u, infinity), 0 to return the frame with native resolution |
height | Optional height of the resulting frame in pixel, with range [1u, infinity), 0 to return the frame with native resolution |
downscaleIfNecessary | True, to return a frame exactly with the specified frame dimension, otherwise the next larger frame will be returned |
- Returns
- The specified frame, if any
◆ interpolatedFrame()
FrameRef Ocean::Platform::ResourceManager::interpolatedFrame |
( |
const unsigned int |
id, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height |
|
) |
| |
|
protected |
Returns the interpolated frame of a specified resource frame.
If the specified frame dimension is larger than the dimension of the largest native frame, the largest native frame will be returned.
- Parameters
-
id | The id of the resource frame for which the interpolated frame will be returned |
width | The width of the resulting interpolated frame in pixel, with range [1, infinity) |
height | The height of the resulting interpolated frame in pixel, with range [1, infinity) |
- Returns
- The resulting interpolated frame, or the largest available native frame if the largest native frame is smaller than the requested one
◆ largestFrame()
static FrameRef Ocean::Platform::ResourceManager::largestFrame |
( |
const FrameRefs & |
frames | ) |
|
|
staticprotected |
Returns the largest frame from a set of given frames.
- Parameters
-
frames | The set of given frames, at least one |
- Returns
- The largest frame from the specified set
◆ release()
void Ocean::Platform::ResourceManager::release |
( |
| ) |
|
Releases the entire resources of this manager.
◆ bufferMap_
BufferMap Ocean::Platform::ResourceManager::bufferMap_ |
|
protected |
The map of resource buffers.
◆ interpolatedFrames_
FrameMap Ocean::Platform::ResourceManager::interpolatedFrames_ |
|
protected |
The frame map of the interpolated frames.
◆ lock_
Lock Ocean::Platform::ResourceManager::lock_ |
|
protected |
◆ nativeFrames_
FrameMap Ocean::Platform::ResourceManager::nativeFrames_ |
|
protected |
The frame map of the native resource frames.
The documentation for this class was generated from the following file: