VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | Properties
VisimBox.Resources.AbstractResMan< T > Class Template Reference

Abstract resource manager, used as a base for all resource manager types. More...

Inheritance diagram for VisimBox.Resources.AbstractResMan< T >:

List of all members.

## Public Member Functions
| AbstractResMan ()
virtual void | Dispose ()
virtual void | Add (string key, T value)
| Adds new key/value if the key is not already used (no duplicities allowed)
virtual void | Remove (string key)
| Removes item with specified key and DISPOSES it!
virtual string | Rename (string key, string newkey, bool uniquename=true)
| Renames key to new value.
virtual void | PerformCleanup ()
| Performs cleanup of the resources. Should be called periodically or after big changes.
virtual string[] | GetAllKeys ()
| Returns string array with all keys.
virtual IEnumerator < KeyValuePair< string, T > > | GetEnumerator ()
| Returns Enumerator from the resources collection.
virtual void | ClearAll ()
| Goes through the whole list and removes all items.
virtual T | Load (string filename)
| Returns data with associated filename from cache or loads them.
virtual T | Load (string key, string filename)
| Returns data with associated filename from cache or loads them.
bool | Contains (string index)
| Returns true, if manager already contains value with specified index.
string | GetUniqueName (string name)
| Returns unique name based on the name (adds numbers to the end)
virtual void | ResourceDisposing (IResource resource)
| Callback for resource disposing - just before releasing itself from memory resource will call all it's consumers to notify them it will be no longer valid.
virtual bool | ResourceReplaced (IResource original, IResource newresource)
| Resource was replaced by another resource. Consumers can decide to keep new resource instead or hold to original value. If consumers wants to hold new resource instead, it should change it's pointers and return true, references in resources will be automatically updated. If false, consumer is not interested in new resource - depending on the nature of replace it may then get ResourceDisposing callback.
## Protected Attributes
Dictionary< string, T > | resources
bool | disposing = false
## Properties
virtual T | this[string index]`[get, set]`

## Detailed Description

### template<T>
class VisimBox::Resources::AbstractResMan< T >

Abstract resource manager, used as a base for all resource manager types.

Type Constraints

  T | : | IResource |

## Member Function Documentation

template<T >

VisimBox.Resources.AbstractResMan< T >.AbstractResMan | ( |  | ) |

template<T >

virtual void VisimBox.Resources.AbstractResMan< T >.Add | ( | string | key,
|  | T | value
| ) |  | `[virtual]`

Adds new key/value if the key is not already used (no duplicities allowed)

Parameters:

  key | key
  value | value

template<T >

virtual void VisimBox.Resources.AbstractResMan< T >.ClearAll | ( |  | ) | `[virtual]`

Goes through the whole list and removes all items.

template<T >

bool VisimBox.Resources.AbstractResMan< T >.Contains | ( | string | index | ) |

Returns true, if manager already contains value with specified index.

Parameters:

  index |

Returns:

template<T >

virtual void VisimBox.Resources.AbstractResMan< T >.Dispose | ( |  | ) | `[virtual]`

template<T >

virtual string [] VisimBox.Resources.AbstractResMan< T >.GetAllKeys | ( |  | ) | `[virtual]`

Returns string array with all keys.

Returns:

template<T >

virtual IEnumerator<KeyValuePair<string, T> > VisimBox.Resources.AbstractResMan< T >.GetEnumerator | ( |  | ) | `[virtual]`

Returns Enumerator from the resources collection.

Returns:

template<T >

string VisimBox.Resources.AbstractResMan< T >.GetUniqueName | ( | string | name | ) |

Returns unique name based on the name (adds numbers to the end)

Parameters:

  name | Base string

Returns:
  Unique name not contained in the manager

template<T >

virtual T VisimBox.Resources.AbstractResMan< T >.Load | ( | string | filename | ) | `[virtual]`

Returns data with associated filename from cache or loads them.

Parameters:

  filename | Filename with data

Returns:
  loaded value

template<T >

virtual T VisimBox.Resources.AbstractResMan< T >.Load | ( | string | key,
|  | string | filename
| ) |  | `[virtual]`

Returns data with associated filename from cache or loads them.

Parameters:

  filename | Filename with data
  key | Key to use for loaded data

Returns:
  loaded value

Reimplemented in VisimBox.Resources.BitmapManager, and VisimRenderGL.GLTextureMan.

template<T >

virtual void VisimBox.Resources.AbstractResMan< T >.PerformCleanup | ( |  | ) | `[virtual]`

Performs cleanup of the resources. Should be called periodically or after big changes.

template<T >

virtual void VisimBox.Resources.AbstractResMan< T >.Remove | ( | string | key | ) | `[virtual]`

Removes item with specified key and DISPOSES it!

Parameters:

  key | key to remove

template<T >

virtual string VisimBox.Resources.AbstractResMan< T >.Rename | ( | string | key,
|  | string | newkey,
|  | bool | uniquename = `true`
| ) |  | `[virtual]`

Renames key to new value.

Parameters:

  key | Original key
  newkey | New key
  uniquename | If unique set to true, unique newkwey will be found

Returns:
  New used key or null (if object not found)

Reimplemented in VisimBox.Renderer.MaterialManager.

template<T >

virtual void VisimBox.Resources.AbstractResMan< T >.ResourceDisposing | ( | IResource | resource | ) | `[virtual]`

Callback for resource disposing - just before releasing itself from memory resource will call all it's consumers to notify them it will be no longer valid.

Parameters:

  resource | Resource which is being disposed

Implements VisimBox.Resources.IResourceConsumer.

template<T >

virtual bool VisimBox.Resources.AbstractResMan< T >.ResourceReplaced | ( | IResource | original,
|  | IResource | newresource
| ) |  | `[virtual]`

Resource was replaced by another resource. Consumers can decide to keep new resource instead or hold to original value. If consumers wants to hold new resource instead, it should change it's pointers and return true, references in resources will be automatically updated. If false, consumer is not interested in new resource - depending on the nature of replace it may then get ResourceDisposing callback.

Parameters:

  original | Original resource registered with consumer
  newresource | New resource

Returns:
  Consumer must return true if it want's to change reference to newresource, otherwise false.

Implements VisimBox.Resources.IResourceConsumer.

## Member Data Documentation

template<T >

bool VisimBox.Resources.AbstractResMan< T >.disposing = false`[protected]`

template<T >

Dictionary<string, T> VisimBox.Resources.AbstractResMan< T >.resources`[protected]`

## Property Documentation

template<T >

virtual T VisimBox.Resources.AbstractResMan< T >.this[string index]`[get, set]`

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

- ResourceManagers.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events