parameters: (cls, module_names, namespace, outfile)
docstring: Writes a single function that will open + initialize each module.
  
      This intializer will take in an stl map of that lists the correct
      dlopen target for each module.  The map type is
      std::map<enum StubModules, vector<std::string>> which matches one module
      to a list of paths to try in dlopen.
  
      This function is an all-or-nothing function.  If any module fails to load,
      all other modules are dlclosed, and the function returns.  Though it is
      not enforced, this function should only be called once.
  
      Args:
        module_names: A list with the names of the modules in this stub file.
        namespace: The namespace these functions should be in.
        outfile: The file handle to populate with pointer definitions.
docstring_summary: Writes a single function that will open + initialize each module.
docstring_tokens: Writes a single function that will open + initialize each module .
function: def WriteUmbrellaInitializer(cls, module_names, namespace, outfile):
      """Writes a single function that will open + initialize each module.
  
      This intializer will take in an stl map of that lists the correct
      dlopen target for each module.  The map type is
      std::map<enum StubModules, vector<std::string>> which matches one module
      to a list of paths to try in dlopen.
  
      This function is an all-or-nothing function.  If any module fails to load,
      all other modules are dlclosed, and the function returns.  Though it is
      not enforced, this function should only be called once.
  
      Args:
        module_names: A list with the names of the modules in this stub file.
        namespace: The namespace these functions should be in.
        outfile: The file handle to populate with pointer definitions.
      """
      outfile.write(UMBRELLA_INITIALIZER_START % namespace)
      outfile.write(UMBRELLA_INITIALIZER_CLEANUP_FUNCTION)
  
      # Create the initializaiton function that calls all module initializers,
      # checks if they succeeded, and backs out module loads on an error.
      outfile.write(UMBRELLA_INITIALIZER_INITIALIZE_FUNCTION_START)
      outfile.write(
          '\n  // Initialize each module if we have not already failed.\n')
      for module in module_names:
        outfile.write('  %s(opened_libraries[%s]);\n' %
                      (PosixStubWriter.InitializeModuleName(module),
                       PosixStubWriter.EnumName(module)))
      outfile.write('\n')
  
      # Output code to check the initialization status, clean up on error.
      initializer_checks = ['!%s()' % PosixStubWriter.IsInitializedName(name)
                            for name in module_names]
      uninitializers = ['%s()' % PosixStubWriter.UninitializeModuleName(name)
                        for name in module_names]
      outfile.write(UMBRELLA_INITIALIZER_CHECK_AND_CLEANUP % {
          'conditional': ' ||\n      '.join(initializer_checks),
          'uninitializers': ';\n    '.join(uninitializers)})
      outfile.write('\n}  // namespace %s\n' % namespace)
function_tokens: def WriteUmbrellaInitializer ( cls , module_names , namespace , outfile ) : outfile . write ( UMBRELLA_INITIALIZER_START % namespace ) outfile . write ( UMBRELLA_INITIALIZER_CLEANUP_FUNCTION ) # Create the initializaiton function that calls all module initializers, # checks if they succeeded, and backs out module loads on an error. outfile . write ( UMBRELLA_INITIALIZER_INITIALIZE_FUNCTION_START ) outfile . write ( '\n  // Initialize each module if we have not already failed.\n' ) for module in module_names : outfile . write ( '  %s(opened_libraries[%s]);\n' % ( PosixStubWriter . InitializeModuleName ( module ) , PosixStubWriter . EnumName ( module ) ) ) outfile . write ( '\n' ) # Output code to check the initialization status, clean up on error. initializer_checks = [ '!%s()' % PosixStubWriter . IsInitializedName ( name ) for name in module_names ] uninitializers = [ '%s()' % PosixStubWriter . UninitializeModuleName ( name ) for name in module_names ] outfile . write ( UMBRELLA_INITIALIZER_CHECK_AND_CLEANUP % { 'conditional' : ' ||\n      ' . join ( initializer_checks ) , 'uninitializers' : ';\n    ' . join ( uninitializers ) } ) outfile . write ( '\n}  // namespace %s\n' % namespace )