README_src.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- python -*-
3 #
4 # @file README_src.py
5 # @brief rtc-template RTComponent's README file generator class
6 # @date $Date: 2007/01/11 07:47:03 $
7 # @author Noriaki Ando <n-ando@aist.go.jp>
8 #
9 # Copyright (C) 2004-2005
10 # Task-intelligence Research Group,
11 # Intelligent Systems Research Institute,
12 # National Institute of
13 # Advanced Industrial Science and Technology (AIST), Japan
14 # All rights reserved.
15 #
16 # $Id: README_src.py,v 1.5 2007/01/11 07:47:03 n-ando Exp $
17 #
18 
19 #
20 # $Log: README_src.py,v $
21 # Revision 1.5 2007/01/11 07:47:03 n-ando
22 # Some trivial fixes.
23 #
24 # Revision 1.4 2005/09/08 09:23:36 n-ando
25 # - A bug fix for merge function.
26 #
27 # Revision 1.3 2005/09/06 14:36:53 n-ando
28 # rtc-template's command options and data structure for ezt (Easy Template)
29 # are changed for RTComponent's service features.
30 # Now rtc-template can generate services' skeletons, stubs and
31 # implementation files.
32 # The implementation code generation uses omniidl's IDL parser.
33 #
34 # Revision 1.2 2005/08/26 12:01:15 n-ando
35 # Now rtc-template uses ezt (Easy Template).
36 #
37 # Revision 1.1.1.1 2005/05/12 09:06:18 n-ando
38 # Public release.
39 #
40 #
41 
42 import re
43 import os
44 import time
45 import ezt
46 import gen_base
47 
48 readme = """======================================================================
49  RTComponent: [module.name] specificatioin
50 
51  OpenRTM-[version]
52  Date: [date]
53 
54  This file is generated by rtc-template with the following argments.
55 
56 [for fmtd_args] [fmtd_args]
57 [end]
58 ======================================================================
59 # <rtc-template block="module">
60 # </rtc-template>
61 
62 
63 ======================================================================
64  Activity definition
65 ======================================================================
66 
67 [b]Initializing[e]
68 
69 [b]Ready[e]
70  [b]Entry[e]
71  [b]Do[e]
72  [b]Exit[e]
73 
74 [b]Starting[e]
75 
76 [b]Active[e]
77  [b]Entry[e]
78  [b]Do[e]
79  [b]Exit[e]
80 
81 [b]Stopping[e]
82 
83 [b]Error[e]
84  [b]Entry[e]
85  [b]Do[e]
86  [b]Exit[e]
87 
88 
89 [b]Fatal Error[e]
90  [b]Entry[e]
91  [b]Do[e]
92  [b]Exit[e]
93 
94 [b]Exiting[e]
95 
96 ======================================================================
97  InPorts definition
98 ======================================================================
99 # <rtc-template block="inport">
100 # </rtc-template>
101 
102 ======================================================================
103  OutPorts definition
104 ======================================================================
105 # <rtc-template block="outport">
106 # </rtc-template>
107 
108 
109 ======================================================================
110  Service definition
111 ======================================================================
112 # <rtc-template block="service">
113 # </rtc-template>
114 
115 ======================================================================
116  Configuration definition
117 ======================================================================
118 This area is reserved for future OpenRTM.
119 
120 """
121 
122 module = """Description: [module.desc]
123 Version: [module.version]
124 Author: [module.vendor]
125 Category: [module.category]
126 Comp. Type: [module.comp_type]
127 Act. Type: [module.act_type]
128 MAX Inst.: [module.max_inst]
129 Lang:
130 Lang Type:
131 """
132 
133 inport = """[for inport]
134  Name: [inport.name]
135  PortNumber: [inport.num]
136  Description:
137  PortType:
138  DataType: [inport.type]
139  MaxOut:
140  [b]Data Elements[e]
141  Number:
142  Name:
143  Type:
144  Unit:
145  RangeLow:
146  RangeHigh:
147  DefaultValue:
148 [end]
149 """
150 
151 outport = """[for outport]
152  Name: [outport.name]
153  PortNumber: [outport.num]
154  Description:
155  PortType:
156  DataType: [outport.type]
157  MaxOut:
158  [b]Data Elements[e]
159  Number:
160  Name:
161  Type:
162  Unit:
163  RangeLow:
164  RangeHigh:
165  DefaultValue:
166 [end]
167 """
168 service = """[for service]
169  Interface: [service.type]
170  Name: [service.name]
171  Type: [service.type]
172 [end]
173 """
174 
176  def __init__(self, data):
177  self.data = data.copy()
178  self.data['fname'] = "README." + self.data['fname']
179  #self.data['version'] = os.popen("rtm-config --version", "r").read()
180  self.data['version'] = "0.4.1"
181  self.data['date'] = time.asctime()
182  self.data['b'] = "["
183  self.data['e'] = "]"
184 
185  self.tags = {}
186  self.tags["module"] = module
187  self.tags["inport"] = inport
188  self.tags["outport"] = outport
189  self.tags["service"] = service
190 
191  self.gen_tags(self.tags)
192  return
193 
194  def print_readme(self):
195  self.gen(self.data["fname"], readme, self.data, self.tags)
196 
197  def print_all(self):
198  self.print_readme()
199 
def gen(self, fname, temp_txt, data, tags)
Definition: gen_base.py:105


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34