MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen
Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/scripts/GtpV2StackCodeGen/tts/msgfactorytemplate.cpp.tt b/scripts/GtpV2StackCodeGen/tts/msgfactorytemplate.cpp.tt
new file mode 100644
index 0000000..d21197e
--- /dev/null
+++ b/scripts/GtpV2StackCodeGen/tts/msgfactorytemplate.cpp.tt
@@ -0,0 +1,49 @@
+/*
+ * 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);
+}