CFx SDK Documentation  2022 SP0
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 };
static OdFlatMemStreamPtr createNew(OdUInt64 numBytes)
Definition: Int64.h:43
static OdInt64 rdInt64(OdStreamBuf &streamBuf)
static void wrInt64(OdStreamBuf &streamBuf, OdInt64 value)
virtual void write(OdStreamBuf *data, OdTfDigest &sha1)=0
virtual OdStreamBufPtr read(const OdTfDigest &sha1, OdTfThreadContext *ctx=0)=0
GLsizeiptr size
Definition: gles2_ext.h:182
Definition: TfIO.h:9
void read(OdStreamBuf *pBuf)
Definition: TfIO.h:12
void write(OdStreamBuf *hmStream) const
Definition: TfHandleMap.h:5
void read(OdStreamBuf *s)
Definition: TfHandleMap.h:20
void read(OdTfStorage *vfs, const OdTfDigest &hsh)
Definition: TfHandleMap.h:30
void write(OdTfStorage *vfs, OdTfDigest &sha) const
Definition: TfHandleMap.h:14