80 : mObject(pObject), mLoad(nLoad), mDelete(nDelete) {
154 void *
operator new(
size_t nSize) {
155 return PoolMemAlloc(
static_cast<int>(nSize),
"Loader", 0);
163 void operator delete(
void *pBlock) {
307 std::unique_ptr<BinStream> mOwnedStream;
308 std::list<RndObject *> mObjects;
312 std::vector<FilePath> mTextures;
313 std::list<ObjectLoader> mObjectLoaders;
314 std::list<ObjectLoader>::iterator mCurLoader;
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Interface a loader consults before it creates each object of its file.
Definition rndloader.h:35
virtual void SetObjectCount(int nObjects)
Receive the number of objects of the file before the first is created.
Definition rndloader.h:46
virtual ~Callback()
Destroy the callback.
Definition rndloader.h:61
virtual int ShouldLoad(RndObject *pExisting, const char *pszName, const char *pszClass)=0
Decide whether the loader loads an object of its file.
void Release()
Delete the object when the loader created it only to skip it.
int GetLoad() const
Definition rndloader.h:108
ObjectLoader(RndObject *pObject, int nLoad, int nDelete)
Construct the record of one object.
Definition rndloader.h:79
RndObject * GetObject() const
Definition rndloader.h:113
void Load(BinStream &stream, int nVersion)
Load the record of the object, or skip it.
Flags
Behaviour bits of a load, as RndManager::AddLoader() takes them.
Definition rndloader.h:24
@ kDeleteObjects
Definition rndloader.h:27
@ kAsync
Definition rndloader.h:25
@ kReportExisting
Definition rndloader.h:26
void LoadResources(float fDeadlineMs)
Read the texture files of the file and start reading them, then start LoadObjects().
const String & GetFile() const
Definition rndloader.h:286
std::list< RndObject * > & GetObjects()
Definition rndloader.h:296
void DoneLoading(float fDeadlineMs)
The final stage, which does nothing.
RndLoader(const char *pszFile, int nFlags, Callback *pCallback, BinStream *pStream)
Create a loader for a file.
void LoadObjects(float fDeadlineMs)
Load or skip the record of each object while the stream has data, then start DeleteObjects().
void Finish()
End the load unless it has ended, releasing the stream it opened.
void DeleteObjects(float fDeadlineMs)
Delete the objects created only to be skipped, then end the load.
void PreloadHeader(float fDeadlineMs)
Wait for the stream, read the version and the object count, then start CreateObjects().
~RndLoader()
End the load, delete the loaded objects when kDeleteObjects is set, and leave the queue.
const std::list< RndObject * > & GetObjects() const
Definition rndloader.h:291
void Poll(float fDeadlineMs)
Advance the load until a deadline.
void(RndLoader::* State)(float fDeadlineMs)
A stage of the load, which works until a deadline on the system clock in milliseconds.
Definition rndloader.h:124
void LoadFile(float fDeadlineMs)
Open a stream on the file unless one was given, then start PreloadHeader().
bool IsLoaded() const
Report whether the load has ended.
void RemapClassName(char *pszClass)
Rewrite a class name of an older version to the name the registry knows.
void CreateObjects(float fDeadlineMs)
Read the object table, find or create each object, and record what to do with its record.
Base of every object the renderer can load, resolve by name, and serialise.
Definition rndobject.h:20
Growable text buffer that is also a PrnStream.
Definition string.h:19
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.