CFx SDK Documentation  2020SP3
TfHandleMap.h
Go to the documentation of this file.
1 #include "TfIO.h"
2 
3 struct OdTfHandleMap : std::map<OdDbHandle, OdTfDigest>
4 {
5  void write(OdStreamBuf* hmStream) const
6  {
7  OdPlatformStreamer::wrInt64(*hmStream, size());
8  for (OdTfHandleMap::const_iterator i = begin(); i != end(); ++i)
9  {
10  OdPlatformStreamer::wrInt64(*hmStream, i->first);
11  i->second.write(hmStream);
12  }
13  }
14  void write(OdTfStorage* vfs, OdTfDigest& sha) const
15  {
16  OdFlatMemStreamPtr hmStream = OdFlatMemStreamManaged::createNew(sizeof(OdInt64) + size()*(20 /*sizeof (OdTfDigest)*/ + sizeof(OdInt64) )); // FELIX_CHANGE merged from ODA Git
17  write(hmStream);
18  vfs->write(hmStream, sha);
19  }
20  void read(OdStreamBuf* s)
21  {
22  OdInt64 nObjects = OdPlatformStreamer::rdInt64(*s);
23  for (OdInt64 i = 0; i < nObjects; ++i)
24  {
26  OdTfDigest sha; sha.read(s);
27  (*this)[h] = sha;
28  }
29  }
30  void read(OdTfStorage* vfs, const OdTfDigest& hsh)
31  {
32  read(vfs->read(hsh));
33  }
34 };
OdTfHandleMap
Definition: TfHandleMap.h:4
OdTfDigest
Definition: TfIO.h:9
OdInt64
Definition: Int64.h:43
OdPlatformStreamer::rdInt64
static OdInt64 rdInt64(OdStreamBuf &streamBuf)
Definition: OdPlatformStreamer.h:189
OdTfStorage::write
virtual void write(OdStreamBuf *data, OdTfDigest &sha1)=0
OdFlatMemStreamManaged::createNew
static OdFlatMemStreamPtr createNew(OdUInt64 numBytes)
OdTfHandleMap::write
void write(OdStreamBuf *hmStream) const
Definition: TfHandleMap.h:5
OdPlatformStreamer::wrInt64
static void wrInt64(OdStreamBuf &streamBuf, OdInt64 value)
Definition: OdPlatformStreamer.h:248
size
GLsizeiptr size
Definition: gles2_ext.h:182
OdTfHandleMap::read
void read(OdStreamBuf *s)
Definition: TfHandleMap.h:20
OdSmartPtr
Definition: SmartPtr.h:58
OdTfDigest::read
void read(OdStreamBuf *pBuf)
Definition: TfIO.h:12
OdTfStorage::read
virtual OdStreamBufPtr read(const OdTfDigest &sha1, OdTfThreadContext *ctx=0)=0
OdTfHandleMap::read
void read(OdTfStorage *vfs, const OdTfDigest &hsh)
Definition: TfHandleMap.h:30
OdStreamBuf
Definition: OdStreamBuf.h:67
OdDbHandle
Definition: DbHandle.h:67
TfIO.h
OdTfStorage
Definition: TfIO.h:56
OdTfHandleMap::write
void write(OdTfStorage *vfs, OdTfDigest &sha) const
Definition: TfHandleMap.h:14
OdUInt64
Definition: Int64.h:137