2eb6f78289354404c458b3d053fce4bbc1e61cae
[anna.git] / EngineManager.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 // Project
10 #include <anna/diameter/codec/EngineManager.hpp>
11 #include <anna/diameter/codec/Engine.hpp>
12 #include <anna/diameter/stack/Engine.hpp>
13 #include <anna/diameter/stack/Dictionary.hpp>
14 #include <anna/core/tracing/Logger.hpp>
15 #include <anna/xml/Node.hpp>
16
17
18 using namespace anna::diameter::codec;
19
20 Engine *EngineManager::getCodecEngine(const ApplicationId &appid) const throw() {
21   appid_codec_engines_it it = a_appid_codec_engines.find(appid);
22   if (it != a_appid_codec_engines.end())
23     return it->second;
24
25   return NULL;
26 }
27
28 void EngineManager::registerCodecEngine(const ApplicationId &appid, Engine* engine) throw() {
29   if (!engine) return; // nothing done
30   a_appid_codec_engines[appid] = engine;
31 }
32
33 anna::xml::Node* EngineManager::asXML(anna::xml::Node* parent) const
34 throw() {
35   anna::xml::Node* result = parent->createChild("EngineManager");
36   appid_codec_engines_it it_min(a_appid_codec_engines.begin());
37   appid_codec_engines_it it_max(a_appid_codec_engines.end());
38   for (appid_codec_engines_it it = it_min; it != it_max; it++)
39     it->second->asXML(result);
40
41   return result;
42 }