资源简介
1 VS2013下编译好的live555完整工程(live555.2014.5.14版)
2 编译方法:http://www.cnblogs.com/skyseraph/archive/2012/04/11/2442840.html
代码片段和文件信息
/**********
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2.1 of the License or (at your
option) any later version. (See .)
This library is distributed in the hope that it will be useful but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not write to the Free Software Foundation Inc.
51 Franklin Street Fifth Floor Boston MA 02110-1301 USA
**********/
// Copyright (c) 1996-2014 Live Networks Inc. All rights reserved.
// Basic Hash Table implementation
// Implementation
#include “BasicHashTable.hh“
#include “strDup.hh“
#if defined(__WIN32__) || defined(_WIN32)
#else
#include
#endif
#include
#include
// When there are this many entries per bucket on average rebuild
// the table to increase the number of buckets
#define REBUILD_MULTIPLIER 3
BasicHashTable::BasicHashTable(int keyType)
: fBuckets(fStaticBuckets) fNumBuckets(SMALL_HASH_TABLE_SIZE)
fNumEntries(0) fRebuildSize(SMALL_HASH_TABLE_SIZE*REBUILD_MULTIPLIER)
fDownShift(28) fMask(0x3) fKeyType(keyType) {
for (unsigned i = 0; i < SMALL_HASH_TABLE_SIZE; ++i) {
fStaticBuckets[i] = NULL;
}
}
BasicHashTable::~BasicHashTable() {
// Free all the entries in the table:
for (unsigned i = 0; i < fNumBuckets; ++i) {
TableEntry* entry;
while ((entry = fBuckets[i]) != NULL) {
deleteEntry(i entry);
}
}
// Also free the bucket array if it was dynamically allocated:
if (fBuckets != fStaticBuckets) delete[] fBuckets;
}
void* BasicHashTable::Add(char const* key void* value) {
void* oldValue;
unsigned index;
TableEntry* entry = lookupKey(key index);
if (entry != NULL) {
// There‘s already an item with this key
oldValue = entry->value;
} else {
// There‘s no existing entry; create a new one:
entry = insertNewEntry(index key);
oldValue = NULL;
}
entry->value = value;
// If the table has become too large rebuild it with more buckets:
if (fNumEntries >= fRebuildSize) rebuild();
return oldValue;
}
Boolean BasicHashTable::Remove(char const* key) {
unsigned index;
TableEntry* entry = lookupKey(key index);
if (entry == NULL) return False; // no such entry
deleteEntry(index entry);
return True;
}
void* BasicHashTable::Lookup(char const* key) const {
unsigned index;
TableEntry* entry = lookupKey(key index);
if (entry == NULL) return NULL; // no such entry
return entry->value;
}
unsigned BasicHashTable::numEntries() const {
return fNumEntries;
}
BasicHashTable::Iterator::Iterator(BasicHashTable const& table)
: fTable(table) fNextIndex(0)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7664 2014-05-15 00:03 live555\BasicUsageEnvironment\BasicHashTable.cpp
文件 10356 2014-05-20 09:38 live555\BasicUsageEnvironment\BasicTaskScheduler.cpp
文件 7512 2014-05-15 00:03 live555\BasicUsageEnvironment\BasicTaskScheduler0.cpp
文件 2437 2014-05-15 00:03 live555\BasicUsageEnvironment\BasicUsageEnvironment.cpp
文件 4316 2014-05-20 19:07 live555\BasicUsageEnvironment\BasicUsageEnvironment.vcxproj
文件 1557 2014-05-20 19:07 live555\BasicUsageEnvironment\BasicUsageEnvironment.vcxproj.filters
文件 165 2014-05-20 18:52 live555\BasicUsageEnvironment\BasicUsageEnvironment.vcxproj.user
文件 2622 2014-05-15 00:03 live555\BasicUsageEnvironment\BasicUsageEnvironment0.cpp
文件 24389 2014-05-15 00:04 live555\BasicUsageEnvironment\COPYING
文件 57870 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicHashTable.obj
文件 57442 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicTaskScheduler.obj
文件 69566 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicTaskScheduler0.obj
文件 184 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\BasicUsageEnvironment.lastbuildstate
文件 5470 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\cl.command.1.tlog
文件 126240 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\CL.read.1.tlog
文件 4986 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\CL.write.1.tlog
文件 2612 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\Lib-li
文件 1390 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\Lib-li
文件 1750 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsa.92E04722.tlog\lib.command.1.tlog
文件 2083 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment.log
文件 47122 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment.obj
文件 44385 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment0.obj
文件 68533 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\DelayQueue.obj
文件 756736 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\vc120.idb
文件 208896 2014-05-20 19:07 live555\BasicUsageEnvironment\Debug\vc120.pdb
文件 6416 2014-05-15 00:03 live555\BasicUsageEnvironment\DelayQueue.cpp
文件 3475 2014-05-15 00:03 live555\BasicUsageEnvironment\include\BasicHashTable.hh
文件 3044 2014-05-15 00:03 live555\BasicUsageEnvironment\include\BasicUsageEnvironment.hh
文件 3712 2014-05-15 00:03 live555\BasicUsageEnvironment\include\BasicUsageEnvironment0.hh
文件 354 2014-05-15 00:03 live555\BasicUsageEnvironment\include\BasicUsageEnvironment_version.hh
............此处省略1149个文件信息
评论
共有 条评论