anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019-present Infosys Limited |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | */ |
| 6 | |
| 7 | /****************************************************************************** |
| 8 | * |
| 9 | * This is an auto generated file. |
| 10 | * Please do not edit this file. |
| 11 | * All edits to be made through template source file |
| 12 | * <TOP-DIR/scripts/GtpV2StackCodeGen/tts/msgfactorytemplate.cpp.tt> |
| 13 | ******************************************************************************/ |
| 14 | |
| 15 | #include "gtpV2MsgFactory.h" |
| 16 | [% FOREACH msg IN tempdata.msgList -%] |
| 17 | #include "[% msg.msgFileName %].h" |
| 18 | [% END -%] |
| 19 | |
| 20 | static GtpV2MsgFactory gtpV2MsgFactory; |
| 21 | |
| 22 | GtpV2MsgFactory::GtpV2MsgFactory() |
| 23 | { |
| 24 | //Create Message Objects |
| 25 | |
| 26 | [% FOREACH msg IN tempdata.msgList -%] |
| 27 | [% msg.className %]* [% msg.msgFileName %]_p = new ([% msg.className %]); |
| 28 | msgObjectContainer.insert(std::pair<Uint8, GtpV2Message*>([% msg.className %]Type, [% msg.msgFileName %]_p)); |
| 29 | |
| 30 | [% END -%] |
| 31 | |
| 32 | } |
| 33 | |
| 34 | GtpV2MsgFactory::~GtpV2MsgFactory() { |
| 35 | // TODO clean up the allocated memory for message objects |
| 36 | } |
| 37 | |
| 38 | GtpV2MsgFactory& GtpV2MsgFactory::getInstance() |
| 39 | { |
| 40 | static GtpV2MsgFactory gtpV2MsgFactory; |
| 41 | return gtpV2MsgFactory; |
| 42 | } |
| 43 | |
| 44 | GtpV2Message& GtpV2MsgFactory::getMsgObject(Uint8 msgType) |
| 45 | { |
| 46 | std::map<Uint8, GtpV2Message*>::iterator it; |
| 47 | it = msgObjectContainer.find(msgType); |
| 48 | return *(it->second); |
| 49 | } |