MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen
Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/scripts/SMCodeGen/templates/ctxtManagerTmpls/blockPoolManager.cpp.tt b/scripts/SMCodeGen/templates/ctxtManagerTmpls/blockPoolManager.cpp.tt
new file mode 100644
index 0000000..f95a5a7
--- /dev/null
+++ b/scripts/SMCodeGen/templates/ctxtManagerTmpls/blockPoolManager.cpp.tt
@@ -0,0 +1,71 @@
+ [%- DataBlock = TemplateInputVar %]
+ [%- USE String %]
+ [%- MACRO CLASSNAME(str) BLOCK %]
+ [%- className = String.new %]
+ [%- strList = String.new(str).split("_") %]
+ [%- FOREACH str = strList %]
+ [%- token = className.append(String.new(str).capital.text()) %]
+ [%- END %]
+ [%- className = className.append("Manager") %]
+ [%- 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 %]
+ [%- poolMgrClassName = CLASSNAME(DataBlock.BlockName) -%]
+/*
+ * Copyright 2019-present Infosys Limited
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/******************************************************************************
+ * [% FILENAME(DataBlock.BlockName) %].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/ctxtManagerTmpls/blockPoolManager.cpp.tt>
+ ******************************************************************************/
+
+#include "memPoolManager.h"
+#include "contextManager/dataBlocks.h"
+#include "contextManager/[% FILENAME(DataBlock.BlockName) %].h"
+
+using namespace cmn::memPool;
+
+namespace mme
+{
+ /******************************************************************************
+ * Constructor
+ ******************************************************************************/
+ [%poolMgrClassName%]::[%poolMgrClassName%](int numOfBlocks):poolManager_m(numOfBlocks)
+ {
+ }
+
+ /******************************************************************************
+ * Destructor
+ ******************************************************************************/
+ [%poolMgrClassName%]::~[%poolMgrClassName%]()
+ {
+ }
+
+ /******************************************************************************
+ * Allocate [% DataBlock.BlockName %] data block
+ ******************************************************************************/
+ [% DataBlock.BlockName %]* [%poolMgrClassName%]::allocate[% DataBlock.BlockName %]()
+ {
+ [% DataBlock.BlockName %]* [% DataBlock.BlockName %]_p = poolManager_m.allocate();
+ return [% DataBlock.BlockName %]_p;
+ }
+
+ /******************************************************************************
+ * Deallocate a [% DataBlock.BlockName %] data block
+ ******************************************************************************/
+ void [%poolMgrClassName%]::deallocate[% DataBlock.BlockName %]([% DataBlock.BlockName %]* [% DataBlock.BlockName %]p)
+ {
+ poolManager_m.free( [% DataBlock.BlockName %]p );
+ }
+}
\ No newline at end of file