Public Member Functions

FIFE::SoundClipManager Class Reference

#include <soundclipmanager.h>

Inheritance diagram for FIFE::SoundClipManager:
Inheritance graph
[legend]
Collaboration diagram for FIFE::SoundClipManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SoundClipManager ()
virtual ~SoundClipManager ()
virtual SoundClipPtr create (IResourceLoader *loader=0)
virtual SoundClipPtr create (const std::string &name, IResourceLoader *loader=0)
virtual SoundClipPtr load (const std::string &name, IResourceLoader *loader=0)
virtual SoundClipPtr add (SoundClip *res)
virtual bool exists (const std::string &name)
virtual bool exists (ResourceHandle handle)
virtual void reload (const std::string &name)
virtual void reload (ResourceHandle handle)
virtual void reloadAll ()
virtual void loadUnreferenced ()
virtual void free (const std::string &name)
virtual void free (ResourceHandle handle)
virtual void freeAll ()
virtual void freeUnreferenced ()
virtual void remove (SoundClipPtr &resource)
virtual void remove (const std::string &name)
virtual void remove (ResourceHandle handle)
virtual void removeAll ()
virtual void removeUnreferenced ()
virtual SoundClipPtr get (const std::string &name)
virtual SoundClipPtr get (ResourceHandle handle)
virtual ResourceHandle getResourceHandle (const std::string &name)

Detailed Description

SoundClipManager

An interface for managing images.

See also:
IResource
IResourceLoader
IResourceManager

Definition at line 54 of file soundclipmanager.h.


Constructor & Destructor Documentation

FIFE::SoundClipManager::SoundClipManager (  )  [inline]

Default constructor.

Definition at line 59 of file soundclipmanager.h.

FIFE::SoundClipManager::~SoundClipManager (  )  [virtual]

Destructor.

Definition at line 39 of file soundclipmanager.cpp.


Member Function Documentation

SoundClipPtr FIFE::SoundClipManager::add ( SoundClip res  )  [virtual]

Add an Image to the manager

This function will create a SoundClipPtr and add the SoundClip to the manager. The manager assumes ownership of the SoundClip so DO NOT delete it.

Parameters:
res A pointer to the SoundClip
Returns:
A SoundClipPtr to the added resource
See also:
SoundClip

Definition at line 126 of file soundclipmanager.cpp.

References exists().

Referenced by create().

Here is the caller graph for this function:

SoundClipPtr FIFE::SoundClipManager::create ( IResourceLoader *  loader = 0  )  [virtual]

Creates a blank SoundClip but does not load it immediately

Parameters:
loader A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions.
Returns:
An SoundClipPtr to the newly created SoundClip
See also:
SoundClip
OggLoader
IResourceLoader

Definition at line 88 of file soundclipmanager.cpp.

References add().

Referenced by load().

Here is the caller graph for this function:

SoundClipPtr FIFE::SoundClipManager::create ( const std::string &  name,
IResourceLoader *  loader = 0 
) [virtual]

Creates a blank SoundClip but does not load it immediately

Parameters:
name The resource name. Typically a filename.
loader A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions.
Returns:
An SoundClipPtr to the newly created SoundClip
See also:
SoundClip
OggLoader
IResourceLoader

Definition at line 93 of file soundclipmanager.cpp.

References add(), and exists().

bool FIFE::SoundClipManager::exists ( const std::string &  name  )  [virtual]

Checks to see if a SoundClip exists

This function will search the manager for SoundClips that match the parameter

Parameters:
name The name of the SoundClip
Returns:
True if the SoundClip exists. False otherwise.

Definition at line 145 of file soundclipmanager.cpp.

Referenced by add(), and create().

Here is the caller graph for this function:

bool FIFE::SoundClipManager::exists ( ResourceHandle  handle  )  [virtual]

Checks to see if an SoundClip exists

This function will search the manager for SoundClips that match the parameter

Parameters:
handle The handle of the SoundClip
Returns:
True if the SoundClip exists. False otherwise.

Definition at line 154 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::free ( ResourceHandle  handle  )  [virtual]

Frees a SoundClip from memory

The SoundClip is not deleted but it's data is freed. This calls the SoundClip::free() function and it is up to the resource to properly free it's memory. The manager keeps a reference to the SoundClip in case its required in the future.

Parameters:
handle The handle of the SoundClip
See also:
SoundClip

Definition at line 231 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::free ( const std::string &  name  )  [virtual]

Frees a SoundClip from memory

The SoundClip is not deleted but it's data is freed. This calls the SoundClip::free() function and it is up to the resource to properly free it's memory. The manager keeps a reference to the SoundClip in case its required in the future.

Parameters:
name The name of the SoundClip
See also:
SoundClip

Definition at line 218 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::freeAll (  )  [virtual]

Frees all SoundClips

This calls the SoundClip::free() function for every Image the manager is managing. It does not remove them from the manager.

See also:
SoundClip

Definition at line 243 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::freeUnreferenced (  )  [virtual]

Frees all unreferenced SoundClip

This calls the SoundClip::free() function for SoundClips that have no external references to them. It does not remove them from the manager.

See also:
SoundClip

Definition at line 259 of file soundclipmanager.cpp.

SoundClipPtr FIFE::SoundClipManager::get ( const std::string &  name  )  [virtual]

Gets a shared pointer to the SoundClip

If the SoundClip is not defined it will attempt to create and load the SoundClip based on the name (it assumes the name is a filename)

Parameters:
name The name of the SoundClip
Returns:
An SoundClipPtr to the SoundClip

Definition at line 363 of file soundclipmanager.cpp.

References load().

SoundClipPtr FIFE::SoundClipManager::get ( ResourceHandle  handle  )  [virtual]

Gets a shared pointer to the SoundClip

If the resource is not defined it returns an empty (or invalid) SoundClipPtr and makes an entry in the log.

Parameters:
handle The handle of the resource
Returns:
A SoundClipPtr to the resource
Todo:
This should throw an exception instead of an empty SoundClipPtr

Definition at line 379 of file soundclipmanager.cpp.

ResourceHandle FIFE::SoundClipManager::getResourceHandle ( const std::string &  name  )  [virtual]

Gets a SoundClip handle by name

Returns the SoundClip handle associated with the name

Parameters:
name The name of the SoundClip
Returns:
0 if the resource name is invalid

Definition at line 394 of file soundclipmanager.cpp.

SoundClipPtr FIFE::SoundClipManager::load ( const std::string &  name,
IResourceLoader *  loader = 0 
) [virtual]

Creates a blank resource and loads it from disk

This function will create the SoundClip if necessary and load the clip from disk. If the SoundClip is not defined it will call SoundClipManager::create() before loading.

Parameters:
name The resource name. Typically a filename.
loader A pointer to the custom resource loader. The default is NULL. If this parameter is present the resource will use the loader to load instead of the default built in functions.
Returns:
A SoundClipPtr to the loaded SoundClip
See also:
SoundClip
OggLoader
IResourceLoader

Definition at line 103 of file soundclipmanager.cpp.

References create().

Referenced by get().

Here is the caller graph for this function:

void FIFE::SoundClipManager::loadUnreferenced (  )  [virtual]

Loads all unreferenced SoundClips

All SoundClips that have no external references will be loaded into memory.

Definition at line 204 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::reload ( ResourceHandle  handle  )  [virtual]

Reloads a resource

This function will reload a SoundClip if it is managed by the manager. If not it creates an entry in the log specifying that the SoundClip could not be found. It will load the SoundClip if it is not already loaded.

Parameters:
handle The handle of the resource

Definition at line 177 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::reload ( const std::string &  name  )  [virtual]

Reloads a SoundClip

This function will reload a SoundClip if it is managed by the manager. If not it creates an entry in the log specifying that the SoundClip could not be found. It will load the SoundClip if it is not already loaded.

Parameters:
name The name of the resource

Definition at line 163 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::reloadAll (  )  [virtual]

Reloads all SoundClips

This function will reload all SoundClips managed by the manager. It will load a SoundClip if it is not already loaded.

Todo:
It might be beneficial to supply a parameter to only reload resources that are already loaded

Definition at line 192 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::remove ( ResourceHandle  handle  )  [virtual]

Removes a SoundClip from the manager

This removes all references to the SoundClip from the manager. It does not however guarantee that the resource's destructor is called. If the client has any left over references to the resource it will not be freed.

Parameters:
handle The handle of the SoundClip
See also:
SoundClip

Definition at line 313 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::remove ( const std::string &  name  )  [virtual]

Removes an SoundClip from the manager

This removes all references to the SoundClip from the manager. It does not however guarantee that the resource's destructor is called. If the client has any left over references to the resource it will not be freed.

Parameters:
name The name of the SoundClip
See also:
SoundClip

Definition at line 291 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::remove ( SoundClipPtr resource  )  [virtual]

Removes a SoundClip from the manager

This removes all references to the SoundClip from the manager. It does not however guarantee that the resource's destructor is called. If the client has any left over references to the resource it will not be freed.

Parameters:
resource A SoundClipPtr to the image to be removed from the manager
Note:
This is useful if you want to remove ownership of a resource from the manager
See also:
SoundClip

Definition at line 274 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::removeAll (  )  [virtual]

Removes all SoundClips from the manager

This effectively removes all references to all SoundClips from the manager. If there are left over shared pointers to any resources they will not be deleted.

See also:
SoundClip

Definition at line 336 of file soundclipmanager.cpp.

void FIFE::SoundClipManager::removeUnreferenced (  )  [virtual]

Removes all unreferenced SoundClips

This effectively removes all SoundClips that dont have an external reference. The resources will be deleted.

See also:
SoundClip

Definition at line 348 of file soundclipmanager.cpp.


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