blob: 74cb717a17df2953c115379c3064c7289ea72e95 [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301 [%- USE String %]
2 [%- MACRO CLASSNAME(str) BLOCK %]
3 [%- className = String.new %]
4 [%- strList = String.new(str).lower.split("_") %]
5 [%- FOREACH str = strList %]
6 [%- token = className.append(String.new(str).capital.text()) %]
7 [%- END %]
8 [%- className %]
9 [%- END %]
10 [%- MACRO FILENAME(str) BLOCK %]
11 [%- fileName = String.new %]
12 [%- str = CLASSNAME(str) %]
13 [%- fileName = fileName.append(str.substr(0,1)).lower %]
14 [%- fileName = fileName.append(str.substr(1)) %]
15 [%- fileName %]
16 [%- END %]
17 [%- stateList = [] %]
18 [%- FOREACH StatesArray = TemplateInputVar %]
19 [%- FOREACH State = StatesArray %]
20 [%- stateList.push(State.Name) %]
21 [%- END %]
22 [%- END %]
23 [%- stateList = stateList.unique.sort %]
24/*
25 * Copyright 2019-present Infosys Limited  
26 *   
27 * SPDX-License-Identifier: Apache-2.0    
28 */
29
30/**************************************
31 * [% FILENAME(State.Name) %].cpp
32 * This is an auto generated file.
33 * Please do not edit this file.
34 * All edits to be made through template source file
35 * <TOP-DIR/scripts/SMCodeGen/templates/stateMachineTmpls/stateFactory.cpp.tt>
36 **************************************/
37
38#include "mmeStates/stateFactory.h"
39[%- FOREACH state = stateList%]
40[%- IF state != "end_state" %]
41#include "mmeStates/[% FILENAME(state) %].h"
42[%- END %]
43[%- END %]
44
45using namespace mme;
46
47/**********************************************
48* Constructor
49***********************************************/
50StateFactory::StateFactory()
51{
52}
53
54/**********************************************
55* Destructor
56***********************************************/
57StateFactory::~StateFactory()
58{
59}
60
61/**********************************************
62* creates and returns static instance
63***********************************************/
64
65StateFactory* StateFactory::Instance()
66{
67 static StateFactory instance;
68 return &instance;
69}
70
71void StateFactory::initialize()
72{
73 [%- FOREACH state = stateList%]
74 [%- IF state != "end_state" %]
75 [% CLASSNAME(state) %]::Instance()->initialize();
76 [%- END %]
77 [%- END %]
78}