a2617e5644
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401063
66 lines
1.1 KiB
C++
66 lines
1.1 KiB
C++
#include "ADTFactory.h"
|
|
#include "sm_globals.h"
|
|
#include "ShareSys.h"
|
|
|
|
ADTFactory g_AdtFactory;
|
|
|
|
const char *ADTFactory::GetInterfaceName()
|
|
{
|
|
return SMINTERFACE_ADTFACTORY_NAME;
|
|
}
|
|
|
|
unsigned int ADTFactory::GetInterfaceVersion()
|
|
{
|
|
return SMINTERFACE_ADTFACTORY_VERSION;
|
|
}
|
|
|
|
void ADTFactory::OnSourceModAllInitialized()
|
|
{
|
|
g_ShareSys.AddInterface(NULL, this);
|
|
}
|
|
|
|
IBasicTrie *ADTFactory::CreateBasicTrie()
|
|
{
|
|
return new BaseTrie();
|
|
}
|
|
|
|
BaseTrie::BaseTrie()
|
|
{
|
|
m_pTrie = sm_trie_create();
|
|
}
|
|
|
|
BaseTrie::~BaseTrie()
|
|
{
|
|
sm_trie_destroy(m_pTrie);
|
|
}
|
|
|
|
bool BaseTrie::Insert(const char *key, void *value)
|
|
{
|
|
return sm_trie_insert(m_pTrie, key, value);
|
|
}
|
|
|
|
bool BaseTrie::Retrieve(const char *key, void **value)
|
|
{
|
|
return sm_trie_retrieve(m_pTrie, key, value);
|
|
}
|
|
|
|
bool BaseTrie::Delete(const char *key)
|
|
{
|
|
return sm_trie_delete(m_pTrie, key);
|
|
}
|
|
|
|
void BaseTrie::Clear()
|
|
{
|
|
sm_trie_clear(m_pTrie);
|
|
}
|
|
|
|
void BaseTrie::Destroy()
|
|
{
|
|
delete this;
|
|
}
|
|
|
|
bool BaseTrie::Replace(const char *key, void *value)
|
|
{
|
|
return sm_trie_replace(m_pTrie, key, value);
|
|
}
|