> ## 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 ansys::dpf::Context

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

The class representing the DPF execution context. This is used to configure several aspects of DPF like:

* The XML configuration file to be loaded.

* The license context to be used.

**See also**: [dpf::LibraryHandle](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-libraryhandle.md), [dpf::core::applyContext](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-core.md#classansys-dpf-core-1a5fbdf727da47ba6dd749ade51f1f2dcc)

## Inner classes

* [ansys::dpf::Context::internal](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/structansys-dpf-context-internal.md)

## Members

* [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)
* [defaultContext](#classansys-dpf-context-1a05d1af3aea226b6cb8547d1d56c9c146)
* [EDpfLicenseContext](#classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef)
* [entryContext](#classansys-dpf-context-1a30b9265329478de651ae53b753831bc4)
* [errorOnPluginLoad](#classansys-dpf-context-1ab36cb19d02596f0c9e84670632a7567c)
* [getContext](#classansys-dpf-context-1af4b49f2ed79e09c7d20d59895d52c139)
* [getLicenseContext](#classansys-dpf-context-1a75bf6a9e641e9c9f24d61ef6364672c8)
* [getSetupFilePath](#classansys-dpf-context-1a8e69df73d5d7695a12619e98bb4ef82b)
* [PluginLoadErrorMode](#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3)
* [premiumContext](#classansys-dpf-context-1a8416bcd2b6a76249a97bf259851aa121)
* [standaloneContext](#classansys-dpf-context-1a327ad3dde1ba5c314c34d5b2552156f9)
* [userDefinedContext](#classansys-dpf-context-1af2efd2673fef4ce34b56f85dad9d5520)
* [withEntryLevelLicense](#classansys-dpf-context-1a6848f3f755ec83e57544e688182d534d)
* [withErrorOnPluginLoad](#classansys-dpf-context-1a5fe6bfb18b6d33dd88f16bb006bb0d8c)
* [withPremiumLicense](#classansys-dpf-context-1a33a89b830c012a1563bf6534d5de7d48)

## Public types

### Enumeration type EDpfLicenseContext

![][public]

```cpp theme={null}
enum EDpfLicenseContext {
  eNone = 0,
  eEntryLevel = 1,
  ePremium = 2
}
```

Enum to select the license context.

#### Enumerator eNone

#### Enumerator eEntryLevel

#### Enumerator ePremium

### Enumeration type PluginLoadErrorMode

![][public]

```cpp theme={null}
enum PluginLoadErrorMode {
  eSilent = 0,
  eReportFirst = 1,
  eReportAll = 2
}
```

Enum that determines the error reporting strategy during plugin loading.

#### Enumerator eSilent

#### Enumerator eReportFirst

#### Enumerator eReportAll

## Friends

### Friend internal

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

## Public functions

### Function Context

![][public]

```cpp theme={null}
ansys::dpf::Context::Context(EDpfContext context=EDpfContext::eDefault, std::string const &setup_file_path="")
```

Defines the settings that will be used to load DPF. A DPF xml file is used to define those settings.

**Parameters**:

* [EDpfContext](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/namespaceansys-dpf.md#namespaceansys-dpf-1a02d1b14b4a34eeae292e89f8ee7cfe60) **context** = EDpfContext::eDefault : \[in] Defines setup to use.
* std::string const & **setup\_file\_path** = "" : \[in] Optional path to a DPF xml file if using a custom defined location. If a file name is passed, instead of a path, it will search for it int the predefined location dpf/utilities.

**Return type**:

### Function getContext

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

```cpp theme={null}
EDpfContext ansys::dpf::Context::getContext() const
```

Get the DPF context enum value.

**Returns**:

[EDpfContext](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/namespaceansys-dpf.md#namespaceansys-dpf-1a02d1b14b4a34eeae292e89f8ee7cfe60)

**Return type**: [EDpfContext](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/namespaceansys-dpf.md#namespaceansys-dpf-1a02d1b14b4a34eeae292e89f8ee7cfe60)

### Function getSetupFilePath

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

```cpp theme={null}
std::string const  & ansys::dpf::Context::getSetupFilePath() const
```

Get the path to the XML file used to configure DPF.

**Returns**:

std::string const&

**Return type**: std::string const &

### Function getLicenseContext

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

```cpp theme={null}
EDpfLicenseContext ansys::dpf::Context::getLicenseContext() const
```

Get the DPF license context enum value.

Use with DPF runtime R2025R1 or later.

**Returns**:

[EDpfLicenseContext](#classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef)

**Return type**: [EDpfLicenseContext](#classansys-dpf-context-1a1149672f0fad6470e3533a15d358baef)

### Function errorOnPluginLoad

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

```cpp theme={null}
PluginLoadErrorMode ansys::dpf::Context::errorOnPluginLoad() const
```

Get the error reporting mode for plugin loading.

Use with DPF runtime R2025R1 or later.

**Returns**:

[PluginLoadErrorMode](#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3)

**Return type**: [PluginLoadErrorMode](#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3)

### Function withErrorOnPluginLoad

![][public]

```cpp theme={null}
Context & ansys::dpf::Context::withErrorOnPluginLoad(PluginLoadErrorMode error_mode)
```

Sets the mode in which DPF report errors when plugins are loaded.

Use with DPF runtime R2025R1 or later.

**Parameters**:

* **error\_mode**: The strategy for error reporting.

**Returns**:

[Context](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-context.md)&

**Parameters**:

* [PluginLoadErrorMode](#classansys-dpf-context-1a89c9954b0806e1ffbefd5d413d44a8e3) **error\_mode**

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b) &

### Function withPremiumLicense

![][public]

```cpp theme={null}
Context & ansys::dpf::Context::withPremiumLicense()
```

Sets the license context to Premium.

Use with DPF runtime R2025R1 or later.

**Returns**:

[Context](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-context.md)&

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b) &

### Function withEntryLevelLicense

![][public]

```cpp theme={null}
Context & ansys::dpf::Context::withEntryLevelLicense()
```

Sets the license context to Entry.

Use with DPF runtime R2025R1 or later.

**Returns**:

[Context](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-context.md)&

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b) &

## Public static functions

### Function entryContext

![][public]
![][static]

```cpp theme={null}
static Context ansys::dpf::Context::entryContext()
```

**Returns**:

Entry context instance that does not allow DPF to perform any license checkout, meaning that licensed DPF operators run will fail.

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

### Function premiumContext

![][public]
![][static]

```cpp theme={null}
static Context ansys::dpf::Context::premiumContext()
```

**Returns**:

Premium context instance that allows DPF to perform license checkouts, allowing licensed DPF operators to run.

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

### Function defaultContext

![][public]
![][static]

```cpp theme={null}
static Context ansys::dpf::Context::defaultContext()
```

Creates a default context.

Use with DPF runtime R2025R1 or later.

**Returns**:

[Context](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-context.md)

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

### Function standaloneContext

![][public]
![][static]

```cpp theme={null}
static Context ansys::dpf::Context::standaloneContext()
```

Creates a standalone context.

**Returns**:

[Context](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-context.md)

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

### Function userDefinedContext

![][public]
![][static]

```cpp theme={null}
static Context ansys::dpf::Context::userDefinedContext(std::string const &setup_file="DpfCustomDefined.xml")
```

Creates a user-defined context.

Use with DPF runtime R2025R1 or later.

**Parameters**:

* **setup\_file**: The path to the DPF XML file with the user configuration. If a file name is provided as parameter, it will search in /utilities for it. The default XML file used is /utilities/DpfCustomDefined.xml, that the user can edit.

**Returns**:

[Context](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-context.md)

**Parameters**:

* std::string const & **setup\_file** = "DpfCustomDefined.xml"

**Return type**: [Context](#classansys-dpf-context-1ae26354fe1dea7b2691e115275704278b)

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

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

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

[static]: https://img.shields.io/badge/-static-lightgrey "static"
