<reponame>dstockhouse/eaglesat-fprime<filename>Autocoders/src/generators/templates/topology/includes1TopologyCpp.py
#!/usr/bin/env python




##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
    import builtins as builtin
except ImportError:
    import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
from Cheetah.Template import Template
from Cheetah.DummyTransaction import *
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
from Cheetah.CacheRegion import CacheRegion
import Cheetah.Filters as Filters
import Cheetah.ErrorCatchers as ErrorCatchers

##################################################
## MODULE CONSTANTS
VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.4.4'
__CHEETAH_versionTuple__ = (2, 4, 4, 'development', 0)
__CHEETAH_genTime__ = 1554930774.40949
__CHEETAH_genTimestamp__ = 'Wed Apr 10 14:12:54 2019'
__CHEETAH_src__ = 'includes1TopologyCpp.tmpl'
__CHEETAH_srcLastModified__ = 'Wed Apr 10 11:25:47 2019'
__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'

if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
    raise AssertionError(
      'This template was compiled with Cheetah version'
      ' %s. Templates compiled before version %s must be recompiled.'%(
         __CHEETAH_version__, RequiredCheetahVersion))

##################################################
## CLASSES

class includes1TopologyCpp(Template):

    ##################################################
    ## CHEETAH GENERATED METHODS


    def __init__(self, *args, **KWs):

        super(includes1TopologyCpp, self).__init__(*args, **KWs)
        if not self._CHEETAH__instanceInitialized:
            cheetahKWArgs = {}
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
            for k,v in KWs.items():
                if k in allowedKWs: cheetahKWArgs[k] = v
            self._initCheetahInstance(**cheetahKWArgs)
        

    def respond(self, trans=None):



        ## CHEETAH: main method generated for this template
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        # 
        #  This template will contain the includes and starting static code
        # 
        write(u'''
''')
        if VFSL([locals()]+SL+[globals(), builtin],"connect_only",True): # generated from line 5, col 1
            write(u'''#include <''')
            _v = VFSL([locals()]+SL+[globals(), builtin],"path",True) # u'$path' on line 6, col 12
            if _v is not None: write(_filter(_v, rawExpr=u'$path')) # from line 6, col 12.
            write(u'''/Components.hpp>
''')
        else: # generated from line 7, col 1
            write(u'''#include <''')
            _v = VFSL([locals()]+SL+[globals(), builtin],"name",True) # u'$(name)' on line 8, col 12
            if _v is not None: write(_filter(_v, rawExpr=u'$(name)')) # from line 8, col 12.
            write(u'''TopologyAppAc.hpp>
#include <Fw/Obj/SimpleObjRegistry.hpp>
#include <string.h>

//''')
            for p, ns, t in VFSL([locals()]+SL+[globals(), builtin],"component_header_list",True): # generated from line 12, col 3
                write(u'''
//#include <''')
                _v = VFSL([locals()]+SL+[globals(), builtin],"p",True) # u'${p}' on line 13, col 14
                if _v is not None: write(_filter(_v, rawExpr=u'${p}')) # from line 13, col 14.
                write(u'''/''')
                _v = VFSL([locals()]+SL+[globals(), builtin],"ns",True) # u'${ns}' on line 13, col 19
                if _v is not None: write(_filter(_v, rawExpr=u'${ns}')) # from line 13, col 19.
                _v = VFSL([locals()]+SL+[globals(), builtin],"t",True) # u'${t}' on line 13, col 24
                if _v is not None: write(_filter(_v, rawExpr=u'${t}')) # from line 13, col 24.
                write(u'''Impl.hpp>
//''')
            write(u'''

//#include <unistd.h>

using namespace std;

//''')
            if VFSL([locals()]+SL+[globals(), builtin],"is_ptr",True): # generated from line 20, col 3
                write(u'''
//// Registry
//static Fw::SimpleObjRegistry* simpleReg_ptr = 0;
//''')
            else: # generated from line 23, col 3
                write(u'''
//static Fw::SimpleObjRegistry simpleReg;
//''')
            write(u'''

// Component declarations
//''')
            for declaration_template in VFSL([locals()]+SL+[globals(), builtin],"component_declarations",True): # generated from line 28, col 3
                write(u'''
//''')
                _v = VFSL([locals()]+SL+[globals(), builtin],"declaration_template",True) # u'${declaration_template}' on line 29, col 3
                if _v is not None: write(_filter(_v, rawExpr=u'${declaration_template}')) # from line 29, col 3.
                write(u'''
//''')
            write(u'''

extern "C" {
    void dumparch(void);
    void dumpobj(const char* objName);
}


void dumparch(void) {
''')
            if VFSL([locals()]+SL+[globals(), builtin],"is_ptr",True): # generated from line 39, col 1
                write(u'''    simpleReg_ptr->dump();
''')
            else: # generated from line 41, col 1
                write(u'''    simpleReg.dump();
''')
            write(u'''}


void dumpobj(const char* objName) {
''')
            if VFSL([locals()]+SL+[globals(), builtin],"is_ptr",True): # generated from line 48, col 1
                write(u'''    simpleReg_ptr->dump(objName);
''')
            else: # generated from line 50, col 1
                write(u'''    simpleReg.dump(objName);
''')
            write(u'''}

''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        
    ##################################################
    ## CHEETAH GENERATED ATTRIBUTES


    _CHEETAH__instanceInitialized = False

    _CHEETAH_version = __CHEETAH_version__

    _CHEETAH_versionTuple = __CHEETAH_versionTuple__

    _CHEETAH_genTime = __CHEETAH_genTime__

    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__

    _CHEETAH_src = __CHEETAH_src__

    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__

    _mainCheetahMethod_for_includes1TopologyCpp= 'respond'

## END CLASS DEFINITION

if not hasattr(includes1TopologyCpp, '_initCheetahAttributes'):
    templateAPIClass = getattr(includes1TopologyCpp, '_CHEETAH_templateClass', Template)
    templateAPIClass._addCheetahPlumbingCodeToClass(includes1TopologyCpp)


# CHEETAH was developed by <NAME> and <NAME>
# with code, advice and input from many other volunteers.
# For more information visit http://www.CheetahTemplate.org/

##################################################
## if run from command line:
if __name__ == '__main__':
    from Cheetah.TemplateCmdLineIface import CmdLineIface
    CmdLineIface(templateObj=includes1TopologyCpp()).run()


