int main()

in lex_node/src/main.cpp [50:87]


int main(int argc, char * argv[])
{

  setvbuf(stdout, NULL, _IONBF, BUFSIZ);

  rclcpp::init(argc, argv);

  rclcpp::NodeOptions node_options;
  node_options.allow_undeclared_parameters(true);
  node_options.automatically_declare_parameters_from_overrides(true);

  auto lex_node = std::make_shared<Aws::Lex::LexNode>(node_options);
  Aws::Utils::Logging::InitializeAWSLogging(
    Aws::MakeShared<Aws::Utils::Logging::AWSROSLogger>("lex_node",
    Aws::Utils::Logging::LogLevel::Debug, lex_node));
  Aws::SDKOptions options;
  Aws::InitAPI(options);
  {
    // Build a lex interactor and give it to the lex node to use it.
    // Lex has an internal conversation session, therefore the lex interactor
    // should only be available for use by one point of entry.
    auto lex_interactor = std::make_shared<Aws::Lex::LexInteractor>();
    auto params = std::make_shared<Aws::Client::Ros2NodeParameterReader>(lex_node);
    auto error_code = Aws::Lex::BuildLexInteractor(params, *lex_interactor);
    if (error_code != Aws::Lex::ErrorCode::SUCCESS) {
      shutdown(options);
      return error_code;
    }
    lex_node->Init(lex_interactor);
  }
  AWS_LOG_INFO(__func__, "Starting Lex Node...");

  // blocking here, waiting until shutdown.
  rclcpp::spin(lex_node);
  shutdown(options);

  return Aws::Lex::ErrorCode::SUCCESS;
}