
Public 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) |
Static Public Member Functions | |
| static MediaLookupTable * | ourMedia (UsageEnvironment &env) |
Protected Member Functions | |
| MediaLookupTable (UsageEnvironment &env) | |
| virtual | ~MediaLookupTable () |
Private Attributes | |
| UsageEnvironment & | fEnv |
| HashTable * | fTable |
| unsigned | fNameGenerator |
Definition at line 25 of file Media.cpp.
| MediaLookupTable::MediaLookupTable | ( | UsageEnvironment & | env | ) | [protected] |
Definition at line 185 of file Media.cpp.
Referenced by ourMedia().
00186 : fEnv(env), fTable(HashTable::create(STRING_HASH_KEYS)), fNameGenerator(0) { 00187 }
| MediaLookupTable::~MediaLookupTable | ( | ) | [protected, virtual] |
| MediaLookupTable * MediaLookupTable::ourMedia | ( | UsageEnvironment & | env | ) | [static] |
Definition at line 145 of file Media.cpp.
References env, _Tables::getOurTables(), MediaLookupTable(), _Tables::mediaTable, and NULL.
Referenced by Medium::close(), Medium::lookupByName(), and Medium::Medium().
00145 { 00146 _Tables* ourTables = _Tables::getOurTables(env); 00147 if (ourTables->mediaTable == NULL) { 00148 // Create a new table to record the media that are to be created in 00149 // this environment: 00150 ourTables->mediaTable = new MediaLookupTable(env); 00151 } 00152 return (MediaLookupTable*)(ourTables->mediaTable); 00153 }
| Medium * MediaLookupTable::lookup | ( | char const * | name | ) | const |
Definition at line 155 of file Media.cpp.
References fTable, and HashTable::Lookup().
Referenced by Medium::lookupByName(), and remove().
| void MediaLookupTable::addNew | ( | Medium * | medium, | |
| char * | mediumName | |||
| ) |
Definition at line 159 of file Media.cpp.
References HashTable::Add(), and fTable.
Referenced by Medium::Medium().
| void MediaLookupTable::remove | ( | char const * | name | ) |
Definition at line 163 of file Media.cpp.
References fEnv, fTable, _Tables::getOurTables(), HashTable::IsEmpty(), lookup(), _Tables::mediaTable, NULL, and HashTable::Remove().
Referenced by Medium::close().
00163 { 00164 Medium* medium = lookup(name); 00165 if (medium != NULL) { 00166 fTable->Remove(name); 00167 if (fTable->IsEmpty()) { 00168 // We can also delete ourselves (to reclaim space): 00169 _Tables* ourTables = _Tables::getOurTables(fEnv); 00170 delete this; 00171 ourTables->mediaTable = NULL; 00172 ourTables->reclaimIfPossible(); 00173 } 00174 00175 delete medium; 00176 } 00177 }
| void MediaLookupTable::generateNewName | ( | char * | mediumName, | |
| unsigned | maxLen | |||
| ) |
Definition at line 179 of file Media.cpp.
References fNameGenerator.
Referenced by Medium::Medium().
00180 { 00181 // We should really use snprintf() here, but not all systems have it 00182 sprintf(mediumName, "liveMedia%d", fNameGenerator++); 00183 }
UsageEnvironment& MediaLookupTable::fEnv [private] |
HashTable* MediaLookupTable::fTable [private] |
unsigned MediaLookupTable::fNameGenerator [private] |
1.5.2