资源简介

live555流媒体服务 实现视频流直播及视频流点播 vs2013 编译通过

资源截图

代码片段和文件信息

/**********
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 3 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-2017 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) fN

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       7662  2017-10-28 08:26  live555\BasicUsageEnvironment\BasicHashTable.cpp

     文件      10386  2018-01-29 14:05  live555\BasicUsageEnvironment\BasicTaskScheduler.cpp

     文件       7519  2017-10-28 08:26  live555\BasicUsageEnvironment\BasicTaskScheduler0.cpp

     文件       2436  2018-01-18 17:31  live555\BasicUsageEnvironment\BasicUsageEnvironment.cpp

     文件       4765  2018-01-18 16:08  live555\BasicUsageEnvironment\BasicUsageEnvironment.vcxproj

     文件       2214  2018-01-18 15:53  live555\BasicUsageEnvironment\BasicUsageEnvironment.vcxproj.filters

     文件       3250  2017-10-28 08:26  live555\BasicUsageEnvironment\BasicUsageEnvironment0.cpp

     文件      57889  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicHashTable.obj

     文件      57580  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicTaskScheduler.obj

     文件      70774  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicTaskScheduler0.obj

     文件        163  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\BasicUsageEnvironment.lastbuildstate

     文件       5626  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\cl.command.1.tlog

     文件     111936  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\CL.read.1.tlog

     文件       3270  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\CL.write.1.tlog

     文件       1820  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\Lib-link.read.1.tlog

     文件        928  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\Lib-link.write.1.tlog

     文件       1288  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsa.31A49C66.tlog\lib.command.1.tlog

     文件       1292  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment.Build.CppClean.log

     文件       1679  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment.log

     文件      46502  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment.obj

     文件      44322  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\BasicUsageEnvironment0.obj

     文件      67604  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\DelayQueue.obj

     文件     756736  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\vc120.idb

     文件     217088  2018-01-29 14:14  live555\BasicUsageEnvironment\Debug\vc120.pdb

     文件       6419  2017-10-28 08:26  live555\BasicUsageEnvironment\DelayQueue.cpp

     文件       3473  2017-10-28 08:26  live555\BasicUsageEnvironment\include\BasicHashTable.hh

     文件       3194  2017-10-28 08:26  live555\BasicUsageEnvironment\include\BasicUsageEnvironment.hh

     文件       3780  2017-10-28 08:26  live555\BasicUsageEnvironment\include\BasicUsageEnvironment0.hh

     文件        354  2017-10-28 08:26  live555\BasicUsageEnvironment\include\BasicUsageEnvironment_version.hh

     文件       4654  2017-10-28 08:26  live555\BasicUsageEnvironment\include\DelayQueue.hh

............此处省略649个文件信息

评论

共有 条评论