zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Zeni::Database< TYPE > Class Template Referenceabstract

A Texture Database Singleton. More...

#include <Database.h>

Inherited by Zeni::Sounds.

Public Member Functions

 Database (const String &filename, const String &xml_identifier)
 
virtual ~Database ()
 
void clear (const String &name, const String &filename="")
 Clear an entry. More...
 
void clear ()
 Permanently clear all resources. More...
 
unsigned long find (const String &name) const
 Get an id by name, without throwing an Error. More...
 
bool find (const unsigned long &id) const
 Check to see that an id is valid. More...
 
unsigned long get_id (const String &name) const
 Get an id by name, possibly throwing an Error. More...
 
unsigned long give (const String &name, TYPE *const &type, const bool &keep, const String &filename="")
 Add an entry (which it will later delete) More...
 
unsigned long lend (const String &name, TYPE *const &type, const bool &keep)
 Add an entry (which it will NEVER delete) More...
 
void load_file (const String &filename)
 Load all resources from a given file, giving them highest priority. More...
 
void lose_resources ()
 Wipe losable resources and prepare to reload them when they are next needed. More...
 
const bool & lost_resources ()
 Check to see if resources have been lost. More...
 
TYPEoperator[] (const String &name) const
 Get a TYPE by name. More...
 
TYPEoperator[] (const unsigned long &id) const
 Get a TYPE by id. More...
 
void reload ()
 lose_resources + init More...
 
void unload_file (const String &filename)
 Unload all resources from a given file, reloading lower priority resources. More...
 
void unlose_resources ()
 If resources have been lost, then reload them. More...
 

Protected Member Functions

bool give_priority (const String &name, const bool &lent, const bool &keep, const String &filename="")
 If 'lent', 'keep', and 'filename' match, give priority over other 'name' entries. More...
 
void init ()
 
void uninit ()
 

Detailed Description

template<class TYPE>
class Zeni::Database< TYPE >

A Texture Database Singleton.

Note
Database will be reloaded automatically if settings are changed with a call to set_texturing_mode.
Author
bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 46 of file Database.h.

Constructor & Destructor Documentation

template<class TYPE >
Zeni::Database< TYPE >::Database ( const String filename,
const String xml_identifier 
)

Definition at line 78 of file Database.hxx.

template<class TYPE >
Zeni::Database< TYPE >::~Database ( )
virtual

Definition at line 86 of file Database.hxx.

Member Function Documentation

template<class TYPE >
void Zeni::Database< TYPE >::clear ( const String name,
const String filename = "" 
)

Clear an entry.

Definition at line 145 of file Database.hxx.

template<class TYPE >
void Zeni::Database< TYPE >::clear ( )

Permanently clear all resources.

Definition at line 220 of file Database.hxx.

template<class TYPE >
unsigned long Zeni::Database< TYPE >::find ( const String name) const

Get an id by name, without throwing an Error.

Definition at line 182 of file Database.hxx.

template<class TYPE >
bool Zeni::Database< TYPE >::find ( const unsigned long &  id) const

Check to see that an id is valid.

Definition at line 192 of file Database.hxx.

template<class TYPE >
unsigned long Zeni::Database< TYPE >::get_id ( const String name) const
template<class TYPE>
unsigned long Zeni::Database< TYPE >::give ( const String name,
TYPE *const type,
const bool &  keep,
const String filename = "" 
)

Add an entry (which it will later delete)

Definition at line 91 of file Database.hxx.

References Zeni::Resource::assign(), and Zeni::get_Resource().

template<class TYPE >
bool Zeni::Database< TYPE >::give_priority ( const String name,
const bool &  lent,
const bool &  keep,
const String filename = "" 
)
protected

If 'lent', 'keep', and 'filename' match, give priority over other 'name' entries.

Definition at line 354 of file Database.hxx.

References Zeni::Database< TYPE >::Lookup::Handle::ptr.

template<class TYPE >
void Zeni::Database< TYPE >::init ( )
protected

Definition at line 314 of file Database.hxx.

References ZENI_LOGD().

template<class TYPE>
unsigned long Zeni::Database< TYPE >::lend ( const String name,
TYPE *const type,
const bool &  keep 
)

Add an entry (which it will NEVER delete)

Definition at line 118 of file Database.hxx.

References Zeni::Resource::assign(), and Zeni::get_Resource().

template<class TYPE >
void Zeni::Database< TYPE >::load_file ( const String filename)
template<class TYPE >
void Zeni::Database< TYPE >::lose_resources ( )

Wipe losable resources and prepare to reload them when they are next needed.

Definition at line 386 of file Database.hxx.

template<class TYPE >
const bool & Zeni::Database< TYPE >::lost_resources ( )

Check to see if resources have been lost.

Definition at line 381 of file Database.hxx.

Referenced by Zeni::Textures::set_texturing_mode().

template<class TYPE >
TYPE & Zeni::Database< TYPE >::operator[] ( const String name) const

Get a TYPE by name.

Definition at line 215 of file Database.hxx.

template<class TYPE >
TYPE & Zeni::Database< TYPE >::operator[] ( const unsigned long &  id) const

Get a TYPE by id.

Definition at line 197 of file Database.hxx.

template<class TYPE >
void Zeni::Database< TYPE >::reload ( )

lose_resources + init

Definition at line 308 of file Database.hxx.

References init().

Referenced by Zeni::Textures::set_texturing_mode().

template<class TYPE >
void Zeni::Database< TYPE >::uninit ( )
protected

Definition at line 330 of file Database.hxx.

template<class TYPE >
void Zeni::Database< TYPE >::unload_file ( const String filename)

Unload all resources from a given file, reloading lower priority resources.

Definition at line 269 of file Database.hxx.

References sort_controllers::filename.

template<class TYPE >
void Zeni::Database< TYPE >::unlose_resources ( )

If resources have been lost, then reload them.

Definition at line 415 of file Database.hxx.

References init().

Referenced by Zeni::Video_GL_Fixed::begin_prerender(), Zeni::Video_GL_Shader::begin_prerender(), and Zeni::Video_DX9::begin_prerender().


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