MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen
Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/scripts/SMCodeGen/templates/ctxtManagerTmpls/dataBlocks.h.tt b/scripts/SMCodeGen/templates/ctxtManagerTmpls/dataBlocks.h.tt
new file mode 100644
index 0000000..51a189d
--- /dev/null
+++ b/scripts/SMCodeGen/templates/ctxtManagerTmpls/dataBlocks.h.tt
@@ -0,0 +1,121 @@
+ [%- DataStore = templateIn %]
+ [%- 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 %]
+ [%- END %]
+ [%- MACRO REF(str) BLOCK %]
+ [%- primTypeList = [ "int", "short", "uint8_t", "uint16_t", "uint32_t", "unsigned int", "unsigned char", "unsigned short", "bool" ] %]
+ [%- reference = String.new %]
+ [%- reference = '&' %]
+ [%- FOREACH type = primTypeList %]
+ [%- IF str == type %]
+ [%- reference = '' %]
+ [%- END %]
+ [%- END %]
+ [%- reference %]
+ [%- END %]
+ /*
+ * Copyright 2019-present, Infosys Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef DGM_BLOCKSTRUCTURES_H
+#define DGM_BLOCKSTRUCTURES_H
+/**************************************
+ *
+ * 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/dataBlocks.h.tt>
+ ***************************************/
+#include "permDataBlock.h"
+#include "tempDataBlock.h"
+#include "structs.h"
+
+namespace mme
+{
+ [%- FOREACH DataGroup = DataStore.DataGroups %]
+ [%- FOREACH DataBlock = DataGroup.DataBlocks %]
+ [%- dataBlockClassName = CLASSNAME(DataBlock.BlockName) %]
+ class [% dataBlockClassName %];
+ [%- END %]
+ [%- END %]
+
+ [%- FOREACH DataGroup = DataStore.DataGroups %]
+ [%- FOREACH DataBlock = DataGroup.DataBlocks %]
+ [%- dataBlockClassName = CLASSNAME(DataBlock.BlockName) %]
+ class [% dataBlockClassName %]:public SM::[% IF DataBlock.BlockType == 'Permanent' %]PermDataBlock[% ELSE %]TempDataBlock[%- END %]
+ {
+ public:
+
+ /****************************************
+ * [% dataBlockClassName %]
+ * constructor
+ ****************************************/
+ [% dataBlockClassName %]();
+
+ /****************************************
+ * ~[% dataBlockClassName %]
+ * destructor
+ ****************************************/
+ ~[% dataBlockClassName %]();
+
+ [%- FOREACH Data = DataBlock.Data %]
+ /****************************************
+ * set[% Data.Name %]
+ * set [% Data.Name %] to [% dataBlockClassName %]
+ ****************************************/
+ void set[% Data.Name %]( const [% Data.Type %][% REF(Data.Type) %] [% Data.Name %]_i );
+
+ /****************************************
+ * get[% Data.Name %]
+ * get [% Data.Name %] from [% dataBlockClassName %]
+ ****************************************/
+ const [% Data.Type %][% REF(Data.Type) %] get[% Data.Name %]()const;
+ [% END %]
+
+ [%- FOREACH Child = DataBlock.Children %]
+ /****************************************
+ * set[% Child %]
+ * set [% Child %] to [% dataBlockClassName %]
+ ****************************************/
+ void set[% Child %]( [% Child %]* [% Child %]p ) ;
+
+ /****************************************
+ * get[% Child %]
+ * get [% Child %] to [% dataBlockClassName %]
+ ****************************************/
+ [% Child %]* get[% Child %]();
+ [% END %]
+
+ private:
+
+ [%- FOREACH Data = DataBlock.Data %]
+ [%- DataName = CLASSNAME(Data.Name) %]
+ // DataName
+ [% Data.Type %] [% Data.Name %]_m;
+ [% END %]
+
+ [%- FOREACH Child = DataBlock.Children %]
+ // [% Child %]
+ [% Child %]* [% Child %]_mp;
+ [% END %]
+ };
+ [% END %]
+ [% END %]
+} // mme
+#endif
\ No newline at end of file