diff -r 4bb60993758e -r ec73814041b4 core/ADTFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/ADTFactory.cpp Sat Jun 30 16:43:11 2007 +0000 @@ -0,0 +1,60 @@ +#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; +}