README_src.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- python -*-
00003 #
00004 #  @file README_src.py
00005 #  @brief rtc-template RTComponent's README file generator class
00006 #  @date $Date: 2007/01/11 07:47:03 $
00007 #  @author Noriaki Ando <n-ando@aist.go.jp>
00008 # 
00009 #  Copyright (C) 2004-2005
00010 #      Task-intelligence Research Group,
00011 #      Intelligent Systems Research Institute,
00012 #      National Institute of
00013 #          Advanced Industrial Science and Technology (AIST), Japan
00014 #      All rights reserved.
00015 # 
00016 #  $Id: README_src.py,v 1.5 2007/01/11 07:47:03 n-ando Exp $
00017 #
00018 
00019 #
00020 #  $Log: README_src.py,v $
00021 #  Revision 1.5  2007/01/11 07:47:03  n-ando
00022 #  Some trivial fixes.
00023 #
00024 #  Revision 1.4  2005/09/08 09:23:36  n-ando
00025 #  - A bug fix for merge function.
00026 #
00027 #  Revision 1.3  2005/09/06 14:36:53  n-ando
00028 #  rtc-template's command options and data structure for ezt (Easy Template)
00029 #  are changed for RTComponent's service features.
00030 #  Now rtc-template can generate services' skeletons, stubs and
00031 #  implementation files.
00032 #  The implementation code generation uses omniidl's IDL parser.
00033 #
00034 #  Revision 1.2  2005/08/26 12:01:15  n-ando
00035 #  Now rtc-template uses ezt (Easy Template).
00036 #
00037 #  Revision 1.1.1.1  2005/05/12 09:06:18  n-ando
00038 #  Public release.
00039 #
00040 #
00041 
00042 import re
00043 import os
00044 import time
00045 import ezt
00046 import gen_base
00047 
00048 readme = """======================================================================
00049   RTComponent: [module.name] specificatioin
00050 
00051   OpenRTM-[version]
00052   Date: [date]
00053 
00054   This file is generated by rtc-template with the following argments.
00055 
00056 [for fmtd_args]    [fmtd_args]
00057 [end]
00058 ======================================================================
00059 # <rtc-template block="module">
00060 # </rtc-template>
00061 
00062 
00063 ======================================================================
00064     Activity definition
00065 ======================================================================
00066 
00067 [b]Initializing[e]
00068 
00069 [b]Ready[e]
00070         [b]Entry[e]
00071         [b]Do[e]
00072         [b]Exit[e]
00073 
00074 [b]Starting[e]
00075 
00076 [b]Active[e]
00077         [b]Entry[e]
00078         [b]Do[e]
00079         [b]Exit[e]
00080 
00081 [b]Stopping[e]
00082 
00083 [b]Error[e]
00084         [b]Entry[e]
00085         [b]Do[e]
00086         [b]Exit[e]
00087 
00088 
00089 [b]Fatal Error[e]
00090         [b]Entry[e]
00091         [b]Do[e]
00092         [b]Exit[e]
00093 
00094 [b]Exiting[e]
00095 
00096 ======================================================================
00097     InPorts definition
00098 ======================================================================
00099 # <rtc-template block="inport">
00100 # </rtc-template>
00101 
00102 ======================================================================
00103     OutPorts definition
00104 ======================================================================
00105 # <rtc-template block="outport">
00106 # </rtc-template>
00107 
00108 
00109 ======================================================================
00110     Service definition
00111 ======================================================================
00112 # <rtc-template block="service">
00113 # </rtc-template> 
00114 
00115 ======================================================================
00116     Configuration definition
00117 ======================================================================
00118 This area is reserved for future OpenRTM.
00119 
00120 """
00121 
00122 module = """Description: [module.desc]
00123 Version:     [module.version]
00124 Author:      [module.vendor]
00125 Category:    [module.category]
00126 Comp. Type:  [module.comp_type]
00127 Act. Type:   [module.act_type]
00128 MAX Inst.:   [module.max_inst]
00129 Lang:        
00130 Lang Type:   
00131 """
00132 
00133 inport = """[for inport]
00134         Name:        [inport.name]
00135         PortNumber:  [inport.num]
00136         Description:
00137         PortType: 
00138         DataType:    [inport.type]
00139         MaxOut: 
00140         [b]Data Elements[e]
00141                 Number:
00142                 Name:
00143                 Type:
00144                 Unit:
00145                 RangeLow:
00146                 RangeHigh:
00147                 DefaultValue:
00148 [end]
00149 """
00150 
00151 outport = """[for outport]
00152         Name:        [outport.name]
00153         PortNumber:  [outport.num]
00154         Description:
00155         PortType: 
00156         DataType:    [outport.type]
00157         MaxOut: 
00158         [b]Data Elements[e]
00159                 Number:
00160                 Name:
00161                 Type:
00162                 Unit:
00163                 RangeLow:
00164                 RangeHigh:
00165                 DefaultValue:
00166 [end]
00167 """
00168 service = """[for service]
00169         Interface:   [service.type] 
00170         Name:        [service.name]
00171         Type:        [service.type]
00172 [end]
00173 """
00174 
00175 class README_src(gen_base.gen_base):
00176         def __init__(self, data):
00177                 self.data = data.copy()
00178                 self.data['fname'] = "README." + self.data['fname']
00179                 #self.data['version'] = os.popen("rtm-config --version", "r").read()
00180                 self.data['version'] = "0.4.1"
00181                 self.data['date'] = time.asctime()
00182                 self.data['b'] = "["
00183                 self.data['e'] = "]"
00184 
00185                 self.tags = {}
00186                 self.tags["module"] = module
00187                 self.tags["inport"] = inport
00188                 self.tags["outport"] = outport
00189                 self.tags["service"] = service
00190 
00191                 self.gen_tags(self.tags)
00192                 return
00193 
00194         def print_readme(self):
00195                 self.gen(self.data["fname"], readme, self.data, self.tags)
00196 
00197         def print_all(self):
00198                 self.print_readme()
00199         


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Aug 27 2015 14:17:28