> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Class simulation_framework::autonomy::cli::CliProvider

![][C++]
![][public]

**Definition**: `autonomy/cli/cli_provider/cli_provider.h` (line 72)

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`.

An example of executable creation using [CliProvider](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.md).
**See also**: [ISimInstanceCreator](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.md), [core::SimulationParameters](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/structsimulation__framework_1_1core_1_1SimulationParameters.md)

```cpp theme={null}
#include "autonomy/cli/cli_provider/cli_provider.h"
#include "your_sim_instance_creator.h"

enum CliReturnCode
{
    kSuccess = 0,
    kParserError = 1,
    kCliError = 2
};

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;
}
```

## Members

* [CliProvider](#classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider_1aaa4a83f8ce6c7532b64621c25a646eb3)
* [GetCommandLineInterface](#classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider_1a5989884eebef1c6a32141f72b7842b9f)
* [GetCoreParameters](#classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider_1a632fd12769ad3ba2aecaf2d854602e9a)
* [Parse](#classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider_1abd689d5923a3218f0acb267f080ec591)
* [\~CliProvider](#classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider_1ad471556a9f2093e7678b580843827f12)

## Public functions

### Function CliProvider

![][public]

```cpp theme={null}
simulation_framework::autonomy::cli::CliProvider::CliProvider(std::unique_ptr< ISimInstanceCreator > sim_instance_creator)
```

Construct [CliProvider](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1autonomy_1_1cli_1_1CliProvider.md) to execute simulation based on given instance through command line options or args.

**Parameters**:

* **sim\_instance\_creator**: An implementation of interface '[ISimInstanceCreator](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.md)', showing how your simulation should be constructed

**Parameters**:

* std::unique\_ptr\< [ISimInstanceCreator](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1autonomy_1_1ISimInstanceCreator.md) > **sim\_instance\_creator**

**Return type**:

### Function \~CliProvider

![][public]

```cpp theme={null}
simulation_framework::autonomy::cli::CliProvider::~CliProvider()=default
```

Default Destructor.

**Return type**:

### Function GetCommandLineInterface

![][public]

```cpp theme={null}
const std::unique_ptr< core::Cli > & simulation_framework::autonomy::cli::CliProvider::GetCommandLineInterface()
```

Accesser of Cli reference.

**Returns**:

The reference of '[core::Cli](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Cli.md)' object to let you do execution or enable the cli controller

**Return type**: [const](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md) std::unique\_ptr\< [core::Cli](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Cli.md) > &

### Function GetCoreParameters

![][public]
![][const]

```cpp theme={null}
core::SimulationParameters simulation_framework::autonomy::cli::CliProvider::GetCoreParameters() const
```

Accesser of simulation parameters.

**Returns**:

The generic simulation parameters parsed from command line inputs

**Return type**: [core::SimulationParameters](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/structsimulation__framework_1_1core_1_1SimulationParameters.md)

### Function Parse

![][public]

```cpp theme={null}
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**:

* **argc**: The number of arguments passed to the program, including the executable name.
* **argv**: An array of C-style strings representing the arguments.

**Returns**:

`true` if the arguments were successfully parsed; otherwise, `false`.

**Parameters**:

* [int](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md) **argc**
* [const](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md) [char](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md) \*\* **argv**

**Return type**: [bool](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/reference/classsimulation__framework_1_1core_1_1Topic.md)

[private]: https://img.shields.io/badge/-private-red "private"

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[const]: https://img.shields.io/badge/-const-lightblue "const"

[C++]: https://img.shields.io/badge/language-C%2B%2B-blue "C++"
