#include <Media.hh>
Collaboration diagram for MediaLookupTable:

Public Member Functions | |
| HashTable const & | getTable () |
Static Public Member Functions | |
| static MediaLookupTable * | ourMedia (UsageEnvironment &env) |
Protected Member Functions | |
| MediaLookupTable (UsageEnvironment &env) | |
| virtual | ~MediaLookupTable () |
Private Member Functions | |
| Medium * | lookup (char const *name) const |
| void | addNew (Medium *medium, char *mediumName) |
| void | remove (char const *name) |
| void | generateNewName (char *mediumName, unsigned maxLen) |
Private Attributes | |
| UsageEnvironment & | fEnv |
| HashTable * | fTable |
| unsigned | fNameGenerator |
Friends | |
| class | Medium |
Definition at line 92 of file Media.hh.
| MediaLookupTable::MediaLookupTable | ( | UsageEnvironment & | env | ) | [protected] |
Definition at line 161 of file Media.cpp.
Referenced by ourMedia().
00162 : fEnv(env), fTable(HashTable::create(STRING_HASH_KEYS)), fNameGenerator(0) { 00163 }
| MediaLookupTable::~MediaLookupTable | ( | ) | [protected, virtual] |
| MediaLookupTable * MediaLookupTable::ourMedia | ( | UsageEnvironment & | env | ) | [static] |
Definition at line 121 of file Media.cpp.
References env, _Tables::getOurTables(), MediaLookupTable(), _Tables::mediaTable, and NULL.
Referenced by Medium::close(), Medium::lookupByName(), and Medium::Medium().
00121 { 00122 _Tables* ourTables = _Tables::getOurTables(env); 00123 if (ourTables->mediaTable == NULL) { 00124 // Create a new table to record the media that are to be created in 00125 // this environment: 00126 ourTables->mediaTable = new MediaLookupTable(env); 00127 } 00128 return ourTables->mediaTable; 00129 }
| HashTable const& MediaLookupTable::getTable | ( | ) | [inline] |
| Medium * MediaLookupTable::lookup | ( | char const * | name | ) | const [private] |
Definition at line 131 of file Media.cpp.
References fTable, and HashTable::Lookup().
Referenced by Medium::lookupByName(), and remove().
| void MediaLookupTable::addNew | ( | Medium * | medium, | |
| char * | mediumName | |||
| ) | [private] |
Definition at line 135 of file Media.cpp.
References HashTable::Add(), and fTable.
Referenced by Medium::Medium().
| void MediaLookupTable::remove | ( | char const * | name | ) | [private] |
Definition at line 139 of file Media.cpp.
References fEnv, fTable, _Tables::getOurTables(), HashTable::IsEmpty(), lookup(), _Tables::mediaTable, NULL, and HashTable::Remove().
Referenced by Medium::close().
00139 { 00140 Medium* medium = lookup(name); 00141 if (medium != NULL) { 00142 fTable->Remove(name); 00143 if (fTable->IsEmpty()) { 00144 // We can also delete ourselves (to reclaim space): 00145 _Tables* ourTables = _Tables::getOurTables(fEnv); 00146 delete this; 00147 ourTables->mediaTable = NULL; 00148 ourTables->reclaimIfPossible(); 00149 } 00150 00151 delete medium; 00152 } 00153 }
| void MediaLookupTable::generateNewName | ( | char * | mediumName, | |
| unsigned | maxLen | |||
| ) | [private] |
Definition at line 155 of file Media.cpp.
References fNameGenerator.
Referenced by Medium::Medium().
00156 { 00157 // We should really use snprintf() here, but not all systems have it 00158 sprintf(mediumName, "liveMedia%d", fNameGenerator++); 00159 }
UsageEnvironment& MediaLookupTable::fEnv [private] |
HashTable* MediaLookupTable::fTable [private] |
Definition at line 114 of file Media.hh.
Referenced by addNew(), getTable(), lookup(), remove(), and ~MediaLookupTable().
unsigned MediaLookupTable::fNameGenerator [private] |
1.5.2