template.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: shift_jis -*-
00003 # -*- python -*-
00004 #
00005 #  @file template.py
00006 #  @brief doil interface header template
00007 #  @date $Date$
00008 #  @author Noriaki Ando <n-ando@aist.go.jp>
00009 # 
00010 #  Copyright (C) 2008
00011 #      Task-intelligence Research Group,
00012 #      Intelligent Systems Research Institute,
00013 #      National Institute of
00014 #          Advanced Industrial Science and Technology (AIST), Japan
00015 #      All rights reserved.
00016 # 
00017 #  $Id$
00018 # 
00019 
00020 types_h = """\
00021 // -*- C++ -*-
00022 /*!
00023  * @file [types_h] 
00024  * @brief C++ interface definition for doil
00025  * @date $Date$
00026  * @author This file was automatically generated by omniidl/doil backend
00027  *         This file was generated from [idl_fname].
00028  *
00029  * $Id$
00030  */
00031 
00032 #ifndef [types_include_guard] 
00033 #define [types_include_guard] 
00034 
00035 #include <vector>
00036 #include <string>
00037 
00038 [for inc in include_h]
00039 #include <[inc]>
00040 [endfor]
00041 
00042 [for iinc in idl_includes]
00043 #include <[iinc.types_h_path]>
00044 [endfor]
00045 
00046 [for decl in declarations]
00047 [decl]
00048 [endfor]
00049 #endif // [types_include_guard]
00050 
00051 """
00052 
00053 ns_decl = """
00054 [for-inv ens in end_ns]
00055 }; // namespace [ens] 
00056 [endfor]
00057 [for bns in begin_ns]
00058 namespace [bns] 
00059 {
00060 [endfor]
00061 
00062 """
00063 
00064 ifacefwd_decl = """\
00065   // forward declaration of interface
00066   class [local.iface_name];
00067 
00068 """
00069 
00070 struct_decl = """\
00071   // struct
00072   struct [local.name] 
00073   {
00074 [for mem in members]
00075     [mem.local.member_type] [mem.local.member_name];
00076 [endfor]
00077   };
00078 
00079 """
00080 
00081 structfwd_decl = """\
00082   // struct
00083   struct [local.name];
00084 
00085 """
00086 
00087 union_decl = """\
00088   // union
00089   class [local.name] 
00090   {
00091   public:
00092     [local.name](){}
00093     virtual ~[local.name](){}
00094 
00095 [for cas in cases]
00096     [local.name]([cas.local.case_type] var)
00097       : m_type([cas.local.discriminator]),
00098         m_[cas.local.case_member](var){}
00099 
00100     [cas.local.case_type] get_[cas.local.case_member]() const
00101     {
00102       return m_[cas.local.case_member];
00103     }
00104     void set_[cas.local.case_member]([cas.local.case_type] var)
00105     {
00106       m_type = [cas.local.discriminator];
00107       m_[cas.local.case_member] = var;
00108     }
00109 [endfor]
00110 
00111     [local.switch_fq_type] get_type() const
00112     {
00113       return m_type;
00114     }
00115   private:
00116     [local.switch_fq_type] m_type;
00117 [for cas in cases]
00118     [cas.local.case_type] m_[cas.local.case_member];
00119 [endfor]
00120 
00121   };
00122 
00123 """
00124 
00125 unionfwd_decl = """\
00126   class [local.name];
00127 
00128 """
00129 
00130 enum_decl = """\
00131   // enum
00132   enum [local.name] 
00133   {
00134 [for mem in local.members]
00135 [if-index mem is last]
00136     [mem]
00137 [else]
00138     [mem],
00139 [endif]
00140 [endfor]
00141 
00142   };
00143 
00144 """
00145 
00146 exception_decl = """\
00147   // struct
00148   struct [local.name] 
00149   {
00150 [for mem in members]
00151     [mem.local.member_type] [mem.local.member_name];
00152 [endfor]
00153   };
00154 
00155 """
00156 
00157 typedef_decl = """\
00158   // typedef
00159   typedef [local.base_type] [local.derived_type];
00160 
00161 """
00162 
00163 
00164 
00165 interface_h = """\
00166 // -*- C++ -*-
00167 /*!
00168  * @file [local.iface_h] 
00169  * @brief [local.iface_name] C++ interface definition for doil
00170  * @date $Date$
00171  * @author This file was automatically generated by omniidl/doil backend
00172  *
00173  * $Id$
00174  */
00175 
00176 #ifndef [local.iface_include_guard] 
00177 #define [local.iface_include_guard] 
00178 
00179 #include <doil/ImplBase.h>
00180 [for inc in local.include_h]
00181 #include <[inc]>
00182 [endfor]
00183 
00184 [for iinc in idl_includes]
00185 #include <[iinc.types_h_path]>
00186 [endfor]
00187 #include <[types_h_path]>
00188 
00189 [for ih in inherits]
00190 #include <[ih.local.iface_h_path]>
00191 [endfor]
00192 
00193 [for ns in local.iface_ns]
00194 namespace [ns] 
00195 {
00196 [endfor]
00197   /*!
00198    * @if jp
00199    * @class [local.iface_name] 
00200    * @brief [local.iface_name] インターフェースクラス
00201    * @else
00202    * @class [local.iface_name] 
00203    * @brief [local.iface_name] interface class
00204    * @endif
00205    */
00206   class [local.iface_name] 
00207    : public virtual doil::LocalBase
00208 [for ih in inherits]
00209 [if-index ih is last],
00210      public virtual [ih.local.iface_name_fq]
00211 [else],
00212      public virtual [ih.local.iface_name_fq]
00213 [endif]
00214 [endfor]
00215 
00216   {
00217   public:
00218     virtual ~[local.iface_name](){};
00219 
00220 [for op in operations]
00221     virtual [op.return.local.retn_type] [op.name]([for a in op.args]
00222 [if-index a is last][a.local.arg_type] [a.local.arg_name]
00223 [else][a.local.arg_type][a.local.arg_name], [endif]
00224 [endfor])
00225       throw ([for raise in op.raises]
00226 [if-index raise is first]
00227 [raise.local.name_fq]
00228 [else]
00229 ,
00230              [raise.local.name_fq]
00231 [endif]
00232 [endfor]
00233 ) = 0;
00234 
00235 [endfor]
00236   };
00237 [for-inv ns in local.iface_ns]
00238 }; // namespace [ns] 
00239 [endfor]
00240 
00241 #endif // [local.iface_include_guard]
00242 
00243 """
00244 
00245 
00246 
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 
00256 
00257 
00258 
00259 
00260 
00261 
00262 
00263 
00264 
00265 
00266 
00267 
00268 
00269 
00270 a = """
00271 [for td in typedefs]
00272 [if td.corba.tk is "tk_sequence"][if td.corba.sq_tk is "tk_struct"]
00273 [if td.local.deref_sq_type is st.local.base_type]
00274   typedef [td.local.deref_fq_type] [td.local.derived_type];
00275 [endif][endif][endif]
00276 [endfor]
00277 
00278   //------------------------------------------------------------
00279   // rest of typedef
00280   //------------------------------------------------------------
00281 [for td in typedefs]
00282 [if td.corba.tk is "tk_sequence"]
00283 [if td.corba.sq_tk is "tk_struct"]
00284 [elif td.corba.sq_tk is "tk_objref"]
00285 [else]
00286   typedef [td.local.deref_fq_type] [td.local.derived_type];
00287 [endif]
00288 [else]
00289   typedef [td.local.deref_fq_type] [td.local.derived_type];
00290 [endif]
00291 [endfor]
00292 
00293 
00294 [for ns in iface_ns]
00295 }; // namespace [ns] 
00296 [endfor]
00297 
00298 #endif // [types_include_guard] 
00299 """


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:39