*** empty log message ***

This commit is contained in:
Mike Goslin 2000-10-13 19:29:25 +00:00
parent 98a46bed4d
commit eb2b49b8a0
4 changed files with 74 additions and 3 deletions

View File

@ -911,9 +911,31 @@ output(ostream &out) const {
out << " FileRecord: " << _name << " version: " << _version << endl;
}
////////////////////////////////////////////////////////////////////
// Function: DownloadDb::add_version
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void DownloadDb::
add_version(const Filename &name, ulong hash, int version) {
int name_code = atoi(name.get_fullpath().c_str());
_versions[name_code][version] = hash;
}
////////////////////////////////////////////////////////////////////
// Function: DownloadDb::get_version
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
int DownloadDb::
get_version(const Filename &name, ulong hash) {
int name_code = atoi(name.get_fullpath().c_str());
vector_ulong ulvec = _versions[name_code];
vector_ulong::iterator i = find(ulvec.begin(), ulvec.end(), hash);
if (i != ulvec.end())
return (ulvec.begin() - i);
return -1;
}

View File

@ -17,6 +17,7 @@
#include <vector>
#include <string>
#include <pointerTo.h>
#include <map>
/*
@ -193,6 +194,13 @@ public:
// Magic number for knowing this is a download Db
static PN_uint32 _magic_number;
typedef vector<unsigned long> vector_ulong;
typedef map<int, vector_ulong> VersionMap;
void add_version(const Filename &name, ulong hash, int version);
int get_version(const Filename &name, ulong hash);
protected:
VersionMap _versions;
};
INLINE ostream &operator << (ostream &out, const DownloadDb &dldb) {

View File

@ -0,0 +1,11 @@
// Filename: vector_ulong.cxx
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#include "vector_ulong.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -0,0 +1,30 @@
// Filename: vector_ulong.h
// Created by: drose (10May00)
//
////////////////////////////////////////////////////////////////////
#ifndef VECTOR_ULONG_H
#define VECTOR_ULONG_H
#include <pandabase.h>
#include <vector>
////////////////////////////////////////////////////////////////////
// Class : vector_ushort
// Description : A vector of ushorts. This class is defined once here,
// and exported to PANDA.DLL; other packages that want
// to use a vector of this type (whether they need to
// export it or not) should include this header file,
// rather than defining the vector again.
////////////////////////////////////////////////////////////////////
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, std::vector<unsigned long>)
typedef vector<unsigned long> vector_ulong;
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif