| /* |
| * Copyright 2019-present Infosys Limited |
| * |
| * SPDX-License-Identifier: Apache-2.0 |
| */ |
| |
| /****************************************************************************** |
| * |
| * This is an auto generated file. |
| * Please do not edit this file. |
| * All edits to be made through template source file |
| * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/msgfactorytemplate.cpp.tt> |
| ******************************************************************************/ |
| |
| #include "gtpV2MsgFactory.h" |
| [% FOREACH msg IN tempdata.msgList -%] |
| #include "[% msg.msgFileName %].h" |
| [% END -%] |
| |
| static GtpV2MsgFactory gtpV2MsgFactory; |
| |
| GtpV2MsgFactory::GtpV2MsgFactory() |
| { |
| //Create Message Objects |
| |
| [% FOREACH msg IN tempdata.msgList -%] |
| [% msg.className %]* [% msg.msgFileName %]_p = new ([% msg.className %]); |
| msgObjectContainer.insert(std::pair<Uint8, GtpV2Message*>([% msg.className %]Type, [% msg.msgFileName %]_p)); |
| |
| [% END -%] |
| |
| } |
| |
| GtpV2MsgFactory::~GtpV2MsgFactory() { |
| // TODO clean up the allocated memory for message objects |
| } |
| |
| GtpV2MsgFactory& GtpV2MsgFactory::getInstance() |
| { |
| static GtpV2MsgFactory gtpV2MsgFactory; |
| return gtpV2MsgFactory; |
| } |
| |
| GtpV2Message& GtpV2MsgFactory::getMsgObject(Uint8 msgType) |
| { |
| std::map<Uint8, GtpV2Message*>::iterator it; |
| it = msgObjectContainer.find(msgType); |
| return *(it->second); |
| } |