MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen

Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/scripts/SMCodeGen/templates/stateMachineTmpls/state.cpp.tt b/scripts/SMCodeGen/templates/stateMachineTmpls/state.cpp.tt
new file mode 100644
index 0000000..94e0425
--- /dev/null
+++ b/scripts/SMCodeGen/templates/stateMachineTmpls/state.cpp.tt
@@ -0,0 +1,87 @@
+ [%- State = TemplateInputVar %]
+ [%- USE String %]
+ [%- MACRO CLASSNAME(str) BLOCK %]
+ [%- className =  String.new %]
+ [%- strList =  String.new(str).lower.split("_") %]
+ [%- FOREACH str = strList %]
+ [%-    token = className.append(String.new(str).capital.text()) %]
+ [%- END %]
+ [%- className %]
+ [%- END %] 
+ [%- MACRO FILENAME(str) BLOCK %]
+ [%- fileName =  String.new %]
+ [%- str = CLASSNAME(str) %]
+ [%- fileName = fileName.append(str.substr(0,1)).lower %]
+ [%- fileName = fileName.append(str.substr(1)) %]
+ [%- fileName %]
+ [%- END %] 
+ [%- stateClassName = CLASSNAME(State.Name) %]
+/*
+ * Copyright 2019-present Infosys Limited  
+ *   
+ * SPDX-License-Identifier: Apache-2.0    
+ */
+ 
+/**************************************
+ * [% FILENAME(State.Name) %].cpp
+ * This is an auto generated file.
+ * Please do not edit this file.
+ * All edits to be made through template source file
+ * <TOP-DIR/scripts/SMCodeGen/templates/stateMachineTmpls/state.cpp.tt>
+ **************************************/
+
+#include "smEnumTypes.h"
+#include "actionTable.h"
+#include "actionHandlers/actionHandlers.h"
+
+#include "mmeStates/[% FILENAME(State.Name) %].h"
+[%- FOREACH Event = State.Events %]
+[%- IF Event.NextState != "end_state" %]	
+#include "mmeStates/[% FILENAME(Event.NextState) %].h"
+[%- END %]
+[%- END %]
+
+using namespace mme;
+using namespace SM;
+
+/******************************************************************************
+* Constructor
+******************************************************************************/
+[% stateClassName %]::[% stateClassName %]():State(State_e::[% State.Name %])
+{
+}
+
+/******************************************************************************
+* Destructor
+******************************************************************************/
+[% stateClassName %]::~[% stateClassName %]()
+{
+}
+
+/******************************************************************************
+* creates and returns static instance
+******************************************************************************/
+[% stateClassName %]* [% stateClassName %]::Instance()
+{
+        static [% stateClassName %] state;
+        return &state;
+}
+
+/******************************************************************************
+* initializes eventToActionsMap
+******************************************************************************/
+void [% stateClassName %]::initialize()
+{
+        [%- FOREACH Event = State.Events %]
+        {
+                ActionTable actionTable;
+                [%- FOREACH Action = Event.Actions %]
+                actionTable.addAction(&ActionHandlers::[% String.new(Action).lower %]);
+                [%- END %]
+				[%- IF Event.NextState != "end_state" %]
+                actionTable.setNextState([% CLASSNAME(Event.NextState) %]::Instance());
+                [%- END %]
+                eventToActionsMap.insert(pair<Event_e, ActionTable>(Event_e::[% Event.Name %], actionTable));
+        }
+        [%- END %]
+}