// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause

// Includes vtkModuleNameSerDes.h.
@_vtk_serdes_include_libraries_registrar_headers@

#include <iostream> // for std::cerr

extern "C"
{
  /**
   * Register the (de)serialization handlers of classes in all serialized libraries.
   * @param serializer   a vtkSerializer instance
   * @param deserializer a vtkDeserializer instance
   * @param invoker      a vtkInvoker instance
   * @param error        when registration fails, the error message is pointed to by `error`. Use it for logging purpose.
   * @warning The memory pointed to by `error` is not dynamically allocated. Do not free it.
   */
  int RegisterLibraries_@_vtk_serdes_registrar_name@(void* serializer, void* deserializer, void* invoker, const char** error);
}

int RegisterLibraries_@_vtk_serdes_registrar_name@(void* serializer, void* deserializer, void* invoker, const char** error)
{
  const int SUCCESS = 1;
  const int FAIL = 0;
  if (error)
  {
    *error = "";
  }
  else
  {
    std::cerr << "\'error\' argument cannot be null!\n";
    return FAIL;
  }
  // call RegisterClasses for each library.
@_vtk_serdes_register_libraries@
  return SUCCESS;
}
