code: def create_registration_cpp(
      all_algos, registration_filename, use_streaming=True
  ):
      cpp_code = '#include "algorithmfactory.h"\n'
  
      # write #include's
      for algo in all_algos:
          if all_algos[algo]["has_standard"] or (
              use_streaming and all_algos[algo]["has_streaming"]
          ):
              # Essentia's Duration conflicts with Accelerates, so bump the include to the top
              if "FFTA" in algo:
                  cpp_code = (
                      '#include "%s"\n' % all_algos[algo]["header"]
                      + cpp_code
                  )
              else:
                  cpp_code += (
                      '#include "%s"\n' % all_algos[algo]["header"]
                  )
  
      # register standard algorithms in factory
      cpp_code += "\nnamespace essentia {\nnamespace standard {\n\nESSENTIA_API void registerAlgorithm() {\n"
  
      for algo in all_algos:
          if all_algos[algo]["has_standard"]:
              cpp_code += (
                  "    AlgorithmFactory::Registrar<%s> reg%s;\n"
                  % (algo, algo)
              )
  
      cpp_code += "}}}\n"
  
      cpp_code += "\n"
      cpp_code += "\n"
  
      # register streaming algorithms in factory
      if use_streaming:
          cpp_code += "\nnamespace essentia {\nnamespace streaming {\n\nESSENTIA_API void registerAlgorithm() {\n"
  
          for algo in all_algos:
              if all_algos[algo]["has_streaming"]:
                  if all_algos[algo]["has_standard"]:
                      cpp_code += (
                          "    AlgorithmFactory::Registrar<%s, essentia::standard::%s> reg%s;\n"
                          % (algo, algo, algo)
                      )
                  else:
                      cpp_code += (
                          "    AlgorithmFactory::Registrar<%s> reg%s;\n"
                          % (algo, algo)
                      )
  
          cpp_code += "}}}\n"
  
      with open(registration_filename, "w") as f:
          f.write(cpp_code)
  
imports: from __future__ import print_function
  import os
  import sys
  import glob
  import io
label_desc: Use image node_id 2 for calling a global function with example usage: create_registration_cpp(all_algos, registration_filename, use_streaming) without return types