    

 ## On this page

  

 

 # simulation\_framework::autonomy::cli::CliProvider Class Reference

 Last update: 16.07.2025 

Provides a command-line interface for simulation execution via dependency injection. [More...](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml#details)

`#include <<a class="el" href="cli__provider_8h_source.xhtml">cli_provider.h</a>>`

## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

 [CliProvider](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml#aaa4a83f8ce6c7532b64621c25a646eb3) (std::unique\_ptr&lt; [ISimInstanceCreator](classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.xhtml) &gt; [sim\_instance\_creator](classsimulation__framework_1_1core_1_1Topic.xhtml)) Construct [CliProvider](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml "Provides a command-line interface for simulation execution via dependency injection.") to execute simulation based on given instance through command line options or args.   
 <a id="ad471556a9f2093e7678b580843827f12" name="ad471556a9f2093e7678b580843827f12"></a> **~CliProvider** ()=[default](classsimulation__framework_1_1core_1_1Topic.xhtml) Default Destructor.   
 [const](classsimulation__framework_1_1core_1_1Topic.xhtml) std::unique\_ptr&lt; [core::Cli](classsimulation__framework_1_1core_1_1Cli.xhtml) &gt; &amp; [GetCommandLineInterface](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml#a5989884eebef1c6a32141f72b7842b9f) () Accesser of Cli reference.   
 [core::SimulationParameters](structsimulation__framework_1_1core_1_1SimulationParameters.xhtml) [GetCoreParameters](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml#a632fd12769ad3ba2aecaf2d854602e9a) () [const](classsimulation__framework_1_1core_1_1Topic.xhtml) Accesser of simulation parameters.   
 [bool](classsimulation__framework_1_1core_1_1Topic.xhtml) [Parse](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml#abd689d5923a3218f0acb267f080ec591) ([int](classsimulation__framework_1_1core_1_1Topic.xhtml) [argc](classsimulation__framework_1_1core_1_1Topic.xhtml), [const](classsimulation__framework_1_1core_1_1Topic.xhtml) [char](classsimulation__framework_1_1core_1_1Topic.xhtml) \*\*[argv](classsimulation__framework_1_1core_1_1Topic.xhtml)) Parses command-line arguments.   
 <a id="details" name="details"></a>## 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 `<a class="el" href="classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.xhtml" title="Defines a generic interface for creating instances of core::lifecycle::ISimulationInstance.">ISimInstanceCreator</a>` interface, enabling flexibility and modularity.

The design supports scenarios where different simulation instances need to be created dynamically based on the implementation of the `<a class="el" href="classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.xhtml" title="Defines a generic interface for creating instances of core::lifecycle::ISimulationInstance.">ISimInstanceCreator</a>`.

See also[ISimInstanceCreator](classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.xhtml "Defines a generic interface for creating instances of core::lifecycle::ISimulationInstance."), [core::SimulationParameters](structsimulation__framework_1_1core_1_1SimulationParameters.xhtml "The SimulationParameters struct encapsulates parameters related to simfwk-core configuration.")An example of executable creation using [CliProvider](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml "Provides a command-line interface for simulation execution via dependency injection.").

\#include "autonomy/cli/cli\_provider/cli\_provider.h"

\#include "your\_sim\_instance\_creator.h"

 

enum [CliReturnCode](classsimulation__framework_1_1core_1_1Topic.xhtml)

{

 [kSuccess](classsimulation__framework_1_1core_1_1Topic.xhtml) = 0,

 [kParserError](classsimulation__framework_1_1core_1_1Topic.xhtml) = 1,

 [kCliError](classsimulation__framework_1_1core_1_1Topic.xhtml) = 2

};

 

int [main](classsimulation__framework_1_1core_1_1Topic.xhtml)(int [argc](classsimulation__framework_1_1core_1_1Topic.xhtml), const char** [argv](classsimulation__framework_1_1core_1_1Topic.xhtml))

{

 auto [cli\_provider](classsimulation__framework_1_1core_1_1Topic.xhtml) = std::make_unique&lt;autonomy::cli::CliProvider&gt;(

 std::move(std::make_unique&lt;YourSimInstanceCreator&gt;()));

 

 if ([cli\_provider](classsimulation__framework_1_1core_1_1Topic.xhtml)-&gt;Parse([argc](classsimulation__framework_1_1core_1_1Topic.xhtml), [argv](classsimulation__framework_1_1core_1_1Topic.xhtml)))

 {

 if (![cli\_provider](classsimulation__framework_1_1core_1_1Topic.xhtml)-&gt;GetCommandLineInterface()-&gt;Execute())

 {

 return CliReturnCode::kCliError;

 }

 return CliReturnCode::kSuccess;

 }

 

 return CliReturnCode::kParserError;

}

[simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)

This is the concrete Topic class that can be used for creation of a communication channel with given ...

**Definition** [topic.h:38](topic_8h_source.xhtml#l00037)





Definition at line [71](cli__provider_8h_source.xhtml#l00071) of file [cli\_provider.h](cli__provider_8h_source.xhtml).



## Constructor &amp; Destructor Documentation

<a id="aaa4a83f8ce6c7532b64621c25a646eb3" name="aaa4a83f8ce6c7532b64621c25a646eb3"></a>## [◆ ](#aaa4a83f8ce6c7532b64621c25a646eb3)CliProvider()

 simulation\_framework::autonomy::cli::CliProvider::CliProvider  ( std::unique\_ptr&lt; [ISimInstanceCreator](classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.xhtml) &gt;  *sim\_instance\_creator*) 

Construct [CliProvider](classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.xhtml "Provides a command-line interface for simulation execution via dependency injection.") to execute simulation based on given instance through command line options or args.

Parameters sim\_instance\_creatorAn implementation of interface '[ISimInstanceCreator](classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.xhtml "Defines a generic interface for creating instances of core::lifecycle::ISimulationInstance.")', showing how your simulation should be constructed 



## Member Function Documentation

<a id="a5989884eebef1c6a32141f72b7842b9f" name="a5989884eebef1c6a32141f72b7842b9f"></a>## [◆ ](#a5989884eebef1c6a32141f72b7842b9f)GetCommandLineInterface()

 [const](classsimulation__framework_1_1core_1_1Topic.xhtml) std::unique\_ptr&lt; [core::Cli](classsimulation__framework_1_1core_1_1Cli.xhtml) &gt; &amp; simulation\_framework::autonomy::cli::CliProvider::GetCommandLineInterface  ( ) 

Accesser of Cli reference.

ReturnsThe reference of '[core::Cli](classsimulation__framework_1_1core_1_1Cli.xhtml "Handles the decision to start the simulation framework.")' object to let you do execution or enable the cli controller 



<a id="a632fd12769ad3ba2aecaf2d854602e9a" name="a632fd12769ad3ba2aecaf2d854602e9a"></a>## [◆ ](#a632fd12769ad3ba2aecaf2d854602e9a)GetCoreParameters()

 [core::SimulationParameters](structsimulation__framework_1_1core_1_1SimulationParameters.xhtml) simulation\_framework::autonomy::cli::CliProvider::GetCoreParameters  ( )  const

Accesser of simulation parameters.

ReturnsThe generic simulation parameters parsed from command line inputs 



<a id="abd689d5923a3218f0acb267f080ec591" name="abd689d5923a3218f0acb267f080ec591"></a>## [◆ ](#abd689d5923a3218f0acb267f080ec591)Parse()

 [bool](classsimulation__framework_1_1core_1_1Topic.xhtml) simulation\_framework::autonomy::cli::CliProvider::Parse  ( [int](classsimulation__framework_1_1core_1_1Topic.xhtml)  *argc*,    [const](classsimulation__framework_1_1core_1_1Topic.xhtml) [char](classsimulation__framework_1_1core_1_1Topic.xhtml) \*\*  *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:- [cli\_provider.h](cli__provider_8h_source.xhtml)