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/iefactorytemplate.cpp.tt> |
| 13 | ******************************************************************************/ |
| 14 | |
| 15 | #include <map> |
| 16 | #include "gtpV2IeFactory.h" |
| 17 | #include "manual/gtpV2Ie.h" |
| 18 | #include "gtpV2GrpIeDataTypes.h" |
| 19 | [% FOREACH ie IN tempdata.ieList -%] |
| 20 | #include "[% ie.ieFileName %].h" |
| 21 | [% END -%] |
| 22 | |
| 23 | GtpV2IeFactory::GtpV2IeFactory() |
| 24 | { |
| 25 | //Create Message Objects |
| 26 | [% FOREACH ie IN tempdata.ieList -%] |
| 27 | [% ie.className %]* [% ie.ieFileName %]_p = new ([% ie.className %]); |
| 28 | ieObjectContainer.insert(std::pair<Uint8, GtpV2Ie*>([% ie.className %]Type, [% ie.ieFileName %]_p)); |
| 29 | |
| 30 | [% END -%] |
| 31 | |
| 32 | } |
| 33 | |
| 34 | GtpV2IeFactory::~GtpV2IeFactory() { |
| 35 | // TODO clean up the allocated memory for message objects |
| 36 | } |
| 37 | |
| 38 | GtpV2IeFactory& GtpV2IeFactory::getInstance() |
| 39 | { |
| 40 | static GtpV2IeFactory gtpV2IeFactory; |
| 41 | return gtpV2IeFactory; |
| 42 | } |
| 43 | |
| 44 | GtpV2Ie& GtpV2IeFactory::getIeObject(Uint8 ieType) |
| 45 | { |
| 46 | std::map<Uint8, GtpV2Ie*>::iterator it; |
| 47 | it = ieObjectContainer.find(ieType); |
| 48 | return *(it->second); |
| 49 | } |