Added: #1440 Functionality between ClassDirectory3 and DllDirectory

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent f56e7e2b18
commit ab57e97782

@ -35,8 +35,9 @@
// #include <nel/misc/debug.h>
// Project includes
#include "dll_directory.h"
using namespace std;
// using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
@ -264,7 +265,7 @@ uint16 CClassDirectory3::getOrCreateIndex(const ISceneClassDesc *sceneClassDesc)
return it->second;
// Create new entry
CClassEntry *classEntry = new CClassEntry(sceneClassDesc);
CClassEntry *classEntry = new CClassEntry(m_DllDirectory, sceneClassDesc);
uint16 index = m_Entries.size();
m_ClassIdToIndex[classEntry->classId()] = index;
m_Entries.push_back(classEntry);
@ -299,11 +300,11 @@ CClassEntry::CClassEntry() : m_Header(NULL), m_Name(NULL)
}
CClassEntry::CClassEntry(const ISceneClassDesc *sceneClassDesc) : m_Header(new CClassEntryHeader()), m_Name(new CStorageValue<ucstring>())
CClassEntry::CClassEntry(CDllDirectory *dllDirectory, const ISceneClassDesc *sceneClassDesc) : m_Header(new CClassEntryHeader()), m_Name(new CStorageValue<ucstring>())
{
Chunks.push_back(TStorageObjectWithId(0x2060, m_Header));
Chunks.push_back(TStorageObjectWithId(0x2042, m_Name));
m_Header->DllIndex = -9; // Invalid temporary value
m_Header->DllIndex = dllDirectory->getOrCreateIndex(sceneClassDesc->dllPluginDesc());
m_Header->ClassId = sceneClassDesc->classId();
m_Header->SuperClassId = sceneClassDesc->superClassId();
m_Name->Value = sceneClassDesc->displayName();

@ -121,7 +121,7 @@ class CClassEntry : public CStorageContainer
{
public:
CClassEntry();
CClassEntry(const ISceneClassDesc *sceneClassDesc);
CClassEntry(CDllDirectory *dllDirectory, const ISceneClassDesc *sceneClassDesc);
virtual ~CClassEntry();
// inherited

@ -253,7 +253,7 @@ void CDllDirectory::reset()
}
// Parallel to CClassDirectory3
uint16 CDllDirectory::getOrCreateIndex(const IDllPluginDesc *dllPluginDesc)
uint16 CDllDirectory::getOrCreateIndex(const IDllPluginDescInternal *dllPluginDesc)
{
nlassert(!ChunksOwnsPointers);
std::map<ucstring, uint16>::iterator it = m_InternalNameToIndex.find(NLMISC::toLower(ucstring(dllPluginDesc->internalName())));
@ -303,7 +303,7 @@ CDllEntry::CDllEntry() : m_DllDescription(NULL), m_DllFilename(NULL)
}
CDllEntry::CDllEntry(const IDllPluginDesc *dllPluginDesc) : m_DllDescription(new CStorageValue<ucstring>()), m_DllFilename(new CStorageValue<ucstring>())
CDllEntry::CDllEntry(const IDllPluginDescInternal *dllPluginDesc) : m_DllDescription(new CStorageValue<ucstring>()), m_DllFilename(new CStorageValue<ucstring>())
{
Chunks.push_back(TStorageObjectWithId(0x2039, m_DllDescription));
Chunks.push_back(TStorageObjectWithId(0x2037, m_DllFilename));

@ -69,7 +69,7 @@ public:
// Reset the dll directory, all dll entry pointers become invalid, use internal name and dll plugin registry
void reset();
// Get or create the chunk index for a dll by dll plugin description
uint16 getOrCreateIndex(const IDllPluginDesc *dllPluginDesc);
uint16 getOrCreateIndex(const IDllPluginDescInternal *dllPluginDesc);
protected:
virtual IStorageObject *createChunkById(uint16 id, bool container);
@ -91,7 +91,7 @@ class CDllEntry : public CStorageContainer
{
public:
CDllEntry();
CDllEntry(const IDllPluginDesc *dllPluginDesc);
CDllEntry(const IDllPluginDescInternal *dllPluginDesc);
virtual ~CDllEntry();
// inherited

@ -92,11 +92,11 @@ IStorageObject *CSceneClass::createChunkById(uint16 id, bool container)
const ucchar *CSceneClass::DisplayName = ucstring("Scene Class").c_str();
const char *CSceneClass::InternalName = "SceneClass";
const NLMISC::CClassId CSceneClass::ClassId = NLMISC::CClassId::Null;
const TSClassId CSceneClass::SuperClassId = 0x0000;
const NLMISC::CClassId CSceneClass::ClassId = NLMISC::CClassId::Null; // This class is invalid
const TSClassId CSceneClass::SuperClassId = 0x0000; // This class is invalid
namespace {
static const CSceneClassDesc<CSceneClass> SceneClassDesc;
static const CSceneClassDesc<CSceneClass> SceneClassDesc(static_cast<const IDllPluginDescInternal *>(&DllPluginDescBuiltin));
} /* anonymous namespace */
const ISceneClassDesc *CSceneClass::getClassDesc()

@ -37,6 +37,7 @@
// Project includes
#include "storage_object.h"
#include "storage_value.h"
#include "dll_plugin_desc.h"
namespace PIPELINE {
namespace MAX {
@ -95,6 +96,7 @@ public:
virtual const char *internalName() const = 0;
virtual NLMISC::CClassId classId() const = 0;
virtual TSClassId superClassId() const = 0;
virtual const IDllPluginDescInternal *dllPluginDesc() const = 0;
}; /* class ISceneClassDesc */
@ -109,12 +111,16 @@ template <typename T>
class CSceneClassDesc : public ISceneClassDesc
{
public:
CSceneClassDesc(const IDllPluginDescInternal *dllPluginDesc) : m_DllPluginDesc(dllPluginDesc) { }
virtual CSceneClass *create() const { return static_cast<CSceneClass *>(new T()); }
virtual void destroy(CSceneClass *sc) const { delete static_cast<T *>(sc); }
virtual const ucchar *displayName() const { return T::DisplayName; }
virtual const char *internalName() const { return T::InternalName; }
virtual NLMISC::CClassId classId() const { return T::ClassId; }
virtual TSClassId superClassId() const { return T::SuperClassId; }
virtual const IDllPluginDescInternal *dllPluginDesc() const { return m_DllPluginDesc; }
private:
const IDllPluginDescInternal *m_DllPluginDesc;
}; /* class CSceneClassDesc */

Loading…
Cancel
Save