Skip to main content

AVxcelerate Simulation Framework 2025 R2 SP02

simulation_framework::autonomy::cli::CliProvider Class Reference

Last update: 19.09.2025

Provides a command-line interface for simulation execution via dependency injection. More...

#include <cli_provider.h>

Public Member Functions

 CliProvider (std::unique_ptr< ISimInstanceCreator > sim_instance_creator)
 Construct CliProvider to execute simulation based on given instance through command line options or args.
 
 ~CliProvider ()=default
 Default Destructor.
 
const std::unique_ptr< core::Cli > & GetCommandLineInterface ()
 Accesser of Cli reference.
 
core::SimulationParameters GetCoreParameters () const
 Accesser of simulation parameters.
 
bool Parse (int argc, const char **argv)
 Parses command-line arguments.
 

Detailed Description

Provides a command-line interface for simulation execution via dependency injection.

This class facilitates the creation of a command-line executable that executes a simulation on a specific simulation instance. The simulation instance is provided through a concrete implementation of the ISimInstanceCreator interface, enabling flexibility and modularity.

The design supports scenarios where different simulation instances need to be created dynamically based on the implementation of the ISimInstanceCreator.

See also
ISimInstanceCreator, core::SimulationParameters

An example of executable creation using CliProvider.

#include "autonomy/cli/cli_provider/cli_provider.h"
#include "your_sim_instance_creator.h"
{
kSuccess = 0,
};
int main(int argc, const char** argv)
{
auto cli_provider = std::make_unique<autonomy::cli::CliProvider>(
std::move(std::make_unique<YourSimInstanceCreator>()));
if (cli_provider->Parse(argc, argv))
{
if (!cli_provider->GetCommandLineInterface()->Execute())
{
return CliReturnCode::kCliError;
}
return CliReturnCode::kSuccess;
}
return CliReturnCode::kParserError;
}
This is the concrete Topic class that can be used for creation of a communication channel with given ...
Definition topic.h:38

Definition at line 71 of file cli_provider.h.

Constructor & Destructor Documentation

◆ CliProvider()

simulation_framework::autonomy::cli::CliProvider::CliProvider ( std::unique_ptr< ISimInstanceCreator sim_instance_creator)

Construct CliProvider to execute simulation based on given instance through command line options or args.

Parameters
sim_instance_creatorAn implementation of interface 'ISimInstanceCreator', showing how your simulation should be constructed

Member Function Documentation

◆ GetCommandLineInterface()

const std::unique_ptr< core::Cli > & simulation_framework::autonomy::cli::CliProvider::GetCommandLineInterface ( )

Accesser of Cli reference.

Returns
The reference of 'core::Cli' object to let you do execution or enable the cli controller

◆ GetCoreParameters()

core::SimulationParameters simulation_framework::autonomy::cli::CliProvider::GetCoreParameters ( ) const

Accesser of simulation parameters.

Returns
The generic simulation parameters parsed from command line inputs

◆ Parse()

bool simulation_framework::autonomy::cli::CliProvider::Parse ( int  argc,
const char **  argv 
)

Parses command-line arguments.

Processes the arguments passed from the process main function, allowing the application to configure or initialize based on the provided input. This function typically interprets options, flags, and positional arguments supplied via the command line.

Parameters
argcThe number of arguments passed to the program, including the executable name.
argvAn array of C-style strings representing the arguments.
Returns
true if the arguments were successfully parsed; otherwise, false.

The documentation for this class was generated from the following file:

Connect with Ansys