parameters: (block_definition)
docstring: Replace template arguments with the correct C++ template
      expressions
docstring_summary: Replace template arguments with the correct C++ template
      expressions
docstring_tokens: Replace template arguments with the correct C ++ template expressions
function: def convert_impl_impl(block_definition):
      """
      Replace template arguments with the correct C++ template
      expressions
      """
      real_name = get_real_name(block_definition)
      cpp_keyword = False
      if real_name in cpp_keywords:
          real_name += "_blk"
          cpp_keyword = True
  
      target_impl = os.path.join(
          block_definition.get("path"), real_name + "_impl.cc")
      source_impl = os.path.join(
          block_definition.get("path"),
          block_definition.get("name") + "_impl.cc.t")
  
      os.rename(source_impl, target_impl)
      with open(target_impl, "r") as f:
          content = f.readlines()
  
      with open(target_impl, "w") as f:
          new_content = []
          instantiated = False
          for line in content:
              line = line.replace("@GUARD_NAME_IMPL@",
                                  "_".join([real_name, "impl_h"]).upper())
              if "typedef" in line or "class" in line:
                  line = line.replace("@NAME@", " " + real_name + "<T> ")
                  line = line.replace("@BASE_NAME@", " " + real_name + "<T> ")
              else:
                  line = line.replace("@NAME@", real_name)
                  line = line.replace("@BASE_NAME@", real_name)
              line = line.replace("@IMPL_NAME@", real_name + "_impl<T>")
              line = line.replace("@NAME_IMPL@", real_name + "_impl<T> ")
              line = line.replace("@I_TYPE@", "T")
              line = line.replace("@O_TYPE@", "T")
              line = line.replace("@TYPE@", "T")
              if "@WARNING@" in line:
                  continue
              if "class" in line:
                  new_content.append("template<class T>\n")
              if not instantiated and "} /* namespace" in line:
                  for t in block_definition.get("types"):
                      new_content.append("template class " + real_name + "<" +
                                         types[t[0]] + ">;\n")
                      instantiated = True
              new_content.append(line)
          f.writelines(new_content)
function_tokens: def convert_impl_impl ( block_definition ) : real_name = get_real_name ( block_definition ) cpp_keyword = False if real_name in cpp_keywords : real_name += "_blk" cpp_keyword = True target_impl = os . path . join ( block_definition . get ( "path" ) , real_name + "_impl.cc" ) source_impl = os . path . join ( block_definition . get ( "path" ) , block_definition . get ( "name" ) + "_impl.cc.t" ) os . rename ( source_impl , target_impl ) with open ( target_impl , "r" ) as f : content = f . readlines ( ) with open ( target_impl , "w" ) as f : new_content = [ ] instantiated = False for line in content : line = line . replace ( "@GUARD_NAME_IMPL@" , "_" . join ( [ real_name , "impl_h" ] ) . upper ( ) ) if "typedef" in line or "class" in line : line = line . replace ( "@NAME@" , " " + real_name + "<T> " ) line = line . replace ( "@BASE_NAME@" , " " + real_name + "<T> " ) else : line = line . replace ( "@NAME@" , real_name ) line = line . replace ( "@BASE_NAME@" , real_name ) line = line . replace ( "@IMPL_NAME@" , real_name + "_impl<T>" ) line = line . replace ( "@NAME_IMPL@" , real_name + "_impl<T> " ) line = line . replace ( "@I_TYPE@" , "T" ) line = line . replace ( "@O_TYPE@" , "T" ) line = line . replace ( "@TYPE@" , "T" ) if "@WARNING@" in line : continue if "class" in line : new_content . append ( "template<class T>\n" ) if not instantiated and "} /* namespace" in line : for t in block_definition . get ( "types" ) : new_content . append ( "template class " + real_name + "<" + types [ t [ 0 ] ] + ">;\n" ) instantiated = True new_content . append ( line ) f . writelines ( new_content )