cmil::TranslatorRegistry Class Reference

#include <System.h>

Inheritance diagram for cmil::TranslatorRegistry:

Inheritance graph
[legend]
Collaboration diagram for cmil::TranslatorRegistry:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::map< const std::string,
InputTranslator *const > 
Translators
 This is defines the registry structure.

Public Member Functions

virtual ~TranslatorRegistry ()
std::string getName () const
InputTranslator *const getFirstTranslator ()
InputTranslator *const getTranslator (const std::string &name)
virtual bool addTranslator (InputTranslator *translator)
virtual void poll ()

Private Attributes

Translators m_index

Detailed Description

Definition at line 46 of file System.h.


Member Typedef Documentation

typedef std::map<const std::string, InputTranslator* const > cmil::TranslatorRegistry::Translators

This is defines the registry structure.

Definition at line 49 of file System.h.


Constructor & Destructor Documentation

virtual cmil::TranslatorRegistry::~TranslatorRegistry (  )  [inline, virtual]

Definition at line 51 of file System.h.

References Logger::log_debug(), and m_index.

00051                                     {
00052         log_debug("calling TranslatorRegistry destructor");
00053 
00054         for(Translators::iterator i = m_index.begin() ; i!= m_index.end() ; ++i) 
00055         {
00056           log_debug("dtor deleting translator");
00057           delete i->second;
00058         }
00059       }

Here is the call graph for this function:


Member Function Documentation

bool cmil::TranslatorRegistry::addTranslator ( InputTranslator translator  )  [virtual]

Definition at line 46 of file System.cpp.

References cmil::InputTranslator::getName(), Logger::log_error(), and m_index.

Referenced by cmil::SDL::SDLSystem::init().

00046                                                                     {
00047       if(m_index.find(translator->getName()) == m_index.end()) {
00048       
00049         m_index.insert(std::pair<const std::string, InputTranslator* const> 
00050           ( (translator->getName()), translator )); 
00051         
00052         return true;
00053       }
00054 
00055     log_error("addTranslator() not added due to translator with pre-existing name found.");
00056     return false;
00057   }

Here is the call graph for this function:

Here is the caller graph for this function:

InputTranslator *const cmil::TranslatorRegistry::getFirstTranslator (  ) 

Definition at line 29 of file System.cpp.

References Logger::log_debug(), Logger::log_error(), and m_index.

00029                                                                 {
00030     log_debug("getFirstTranslator() checking if any translators exist..");
00031 
00032     if(!(m_index.empty()) ) {
00033       log_debug("getFirstTranslator() returning first translator");
00034       return m_index.begin()->second;
00035     }
00036     else {
00037       log_error("getFirstTranslator() no translators exist; returning null.");
00038       return NULL;
00039     }
00040   }

Here is the call graph for this function:

std::string cmil::TranslatorRegistry::getName (  )  const [inline, virtual]

Implements Logger.

Definition at line 61 of file System.h.

00061                                 {
00062         return "TranslatorRegistry";
00063       };

InputTranslator *const cmil::TranslatorRegistry::getTranslator ( const std::string &  name  ) 

Definition at line 42 of file System.cpp.

References m_index.

00042                                                                                  {
00043     return m_index[name];
00044   }

void cmil::TranslatorRegistry::poll (  )  [virtual]

Definition at line 59 of file System.cpp.

References m_index.

Referenced by cmil::System::poll().

00059                                 {
00060     for(Translators::iterator i; i != m_index.end() ; ++i)
00061       (*i).second->poll();
00062   }

Here is the caller graph for this function:


Member Data Documentation

Translators cmil::TranslatorRegistry::m_index [private]

Definition at line 72 of file System.h.

Referenced by addTranslator(), getFirstTranslator(), getTranslator(), poll(), and ~TranslatorRegistry().


The documentation for this class was generated from the following files:
(c) 2006-2007 John P. Feltz
Generated on Wed Jul 25 16:08:03 2007 for Common Media Input Layer by doxygen 1.4.7

SourceForge.net Logo