# IDiagnostic

<a id="idiagnostic"></a>

# IDiagnostic

```cpp
#include <icy/diagnosticmanager.h>

class IDiagnostic
```

[Defined in src/base/include/icy/diagnosticmanager.h:64](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L64)

> **Inherits:** [`Stateful< DiagnosticState >`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful)
> **Subclassed by:** [`AsyncDiagnostic`](https://auscaster.com/icey/docs/api-reference/icy-AsyncDiagnostic.md#asyncdiagnostic)

Abstract interface for diagnostic information providers.

## List of all members

| Name | Kind | Owner |
|------|------|-------|
| [`name`](#name) | `variable` | Declared here |
| [`description`](#description) | `variable` | Declared here |
| [`summary`](#summary) | `variable` | Declared here |
| [`SummaryUpdated`](#summaryupdated) | `variable` | Declared here |
| [`IDiagnostic`](#idiagnostic-1) | `function` | Declared here |
| [`~IDiagnostic`](#idiagnostic-2) | `function` | Declared here |
| [`check`](#check-1) | `function` | Declared here |
| [`reset`](#reset-2) | `function` | Declared here |
| [`complete`](#complete) | `function` | Declared here |
| [`passed`](#passed) | `function` | Declared here |
| [`failed`](#failed) | `function` | Declared here |
| [`run`](#run-3) | `function` | Declared here |
| [`pass`](#pass) | `function` | Declared here |
| [`fail`](#fail) | `function` | Declared here |
| [`addSummary`](#addsummary) | `function` | Declared here |
| [`StateChange`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#statechange) | `variable` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful-1) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`~Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful-2) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`stateEquals`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateequals) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`stateBetween`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#statebetween) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`state`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#state-4) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`state`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#state-5) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`_state`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#_state) | `variable` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`beforeStateChange`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#beforestatechange) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`onStateChange`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#onstatechange-2) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`setState`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#setstate) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |
| [`setState`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#setstate-1) | `function` | Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful) |

## Inherited from [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful)

| Kind | Name | Description |
|------|------|-------------|
| `variable` | [`StateChange`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#statechange)  | Signals when the state changes. |
| `function` | [`Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful-1) `inline` |  |
| `function` | [`~Stateful`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateful-2) `virtual` `inline` |  |
| `function` | [`stateEquals`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#stateequals) `virtual` `const` `inline` | Returns true if the current state ID equals the given ID. |
| `function` | [`stateBetween`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#statebetween) `virtual` `const` `inline` | Returns true if the current state ID is in the inclusive range [lid, rid]. |
| `function` | [`state`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#state-4) `virtual` `inline` | Returns a mutable reference to the current state. |
| `function` | [`state`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#state-5) `virtual` `const` `inline` | Returns a copy of the current state. |
| `variable` | [`_state`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#_state)  |  |
| `function` | [`beforeStateChange`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#beforestatechange) `virtual` `inline` | Override to handle pre state change logic. Return false to prevent state change. |
| `function` | [`onStateChange`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#onstatechange-2) `virtual` `inline` | Override to handle post state change logic. |
| `function` | [`setState`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#setstate) `virtual` `inline` | Sets the state and sends the state signal if the state change was successful. |
| `function` | [`setState`](https://auscaster.com/icey/docs/api-reference/icy-Stateful.md#setstate-1) `virtual` `inline` | Sets the state and sends the state signal if the state change was successful. |

## Public Attributes

| Return | Name | Description |
|--------|------|-------------|
| `std::string` | [`name`](#name)  | The name of the diagnostic. |
| `std::string` | [`description`](#description)  | The diagnostic description. |
| `std::vector< std::string >` | [`summary`](#summary)  | The diagnostic summary, maybe including troubleshooting information on failure. |
| [`ThreadSignal`](https://auscaster.com/icey/docs/api-reference/base.md#threadsignal)< void(const std::string &)> | [`SummaryUpdated`](#summaryupdated)  | Signals when a new text item is added to the summary. |

---

<a id="name"></a>

### name

```cpp
std::string name
```

[Defined in src/base/include/icy/diagnosticmanager.h:70](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L70)

The name of the diagnostic.

---

<a id="description"></a>

### description

```cpp
std::string description
```

[Defined in src/base/include/icy/diagnosticmanager.h:71](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L71)

The diagnostic description.

---

<a id="summary"></a>

### summary

```cpp
std::vector< std::string > summary
```

[Defined in src/base/include/icy/diagnosticmanager.h:72](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L72)

The diagnostic summary, maybe including troubleshooting information on failure.

---

<a id="summaryupdated"></a>

### SummaryUpdated

```cpp
ThreadSignal< void(const std::string &)> SummaryUpdated
```

Type: [`ThreadSignal`](https://auscaster.com/icey/docs/api-reference/base.md#threadsignal)< void(const std::string &)>

[Defined in src/base/include/icy/diagnosticmanager.h:95](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L95)

Signals when a new text item is added to the summary.

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`IDiagnostic`](#idiagnostic-1)  |  |
|  | [`~IDiagnostic`](#idiagnostic-2) `virtual` |  |
| `void` | [`check`](#check-1) `virtual` | Resets state to None and invokes [run()](#run-3) to perform the diagnostic check. |
| `void` | [`reset`](#reset-2) `virtual` | Clears the summary and resets state to None. |
| `bool` | [`complete`](#complete) `virtual` `const` | Returns true if the diagnostic has reached a terminal state (Passed or Failed). |
| `bool` | [`passed`](#passed) `virtual` `const` | Returns true if the diagnostic state is Passed. |
| `bool` | [`failed`](#failed) `virtual` `const` | Returns true if the diagnostic state is Failed. |

---

<a id="idiagnostic-1"></a>

### IDiagnostic

```cpp
IDiagnostic()
```

[Defined in src/base/include/icy/diagnosticmanager.h:67](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L67)

---

<a id="idiagnostic-2"></a>

### ~IDiagnostic

`virtual`

```cpp
virtual ~IDiagnostic()
```

[Defined in src/base/include/icy/diagnosticmanager.h:68](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L68)

---

<a id="check-1"></a>

### check

`virtual`

```cpp
virtual void check()
```

[Defined in src/base/include/icy/diagnosticmanager.h:76](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L76)

Resets state to None and invokes [run()](#run-3) to perform the diagnostic check.

#### Reimplemented by

- [`AsyncDiagnostic::check`](https://auscaster.com/icey/docs/api-reference/icy-AsyncDiagnostic.md#check)

---

<a id="reset-2"></a>

### reset

`virtual`

```cpp
virtual void reset()
```

[Defined in src/base/include/icy/diagnosticmanager.h:79](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L79)

Clears the summary and resets state to None.

---

<a id="complete"></a>

### complete

`virtual` `const`

```cpp
virtual bool complete() const
```

[Defined in src/base/include/icy/diagnosticmanager.h:83](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L83)

Returns true if the diagnostic has reached a terminal state (Passed or Failed). 
#### Returns
true if complete.

---

<a id="passed"></a>

### passed

`virtual` `const`

```cpp
virtual bool passed() const
```

[Defined in src/base/include/icy/diagnosticmanager.h:87](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L87)

Returns true if the diagnostic state is Passed. 
#### Returns
true if passed.

---

<a id="failed"></a>

### failed

`virtual` `const`

```cpp
virtual bool failed() const
```

[Defined in src/base/include/icy/diagnosticmanager.h:91](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L91)

Returns true if the diagnostic state is Failed. 
#### Returns
true if failed.

## Protected Methods

| Return | Name | Description |
|--------|------|-------------|
| `void` | [`run`](#run-3) `virtual` | Override to implement diagnostic logic. |
| `bool` | [`pass`](#pass) `virtual` | Transitions the state to Passed. |
| `bool` | [`fail`](#fail) `virtual` | Transitions the state to Failed. |
| `void` | [`addSummary`](#addsummary) `virtual` | Appends text to the summary list and emits SummaryUpdated. |

---

<a id="run-3"></a>

### run

`virtual`

```cpp
virtual void run()
```

[Defined in src/base/include/icy/diagnosticmanager.h:102](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L102)

Override to implement diagnostic logic.

The StateChange signal will dispatch diagnostic test results to delegates.

#### Reimplemented by

- [`AsyncDiagnostic::run`](https://auscaster.com/icey/docs/api-reference/icy-AsyncDiagnostic.md#run-1)

---

<a id="pass"></a>

### pass

`virtual`

```cpp
virtual bool pass()
```

[Defined in src/base/include/icy/diagnosticmanager.h:106](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L106)

Transitions the state to Passed. 
#### Returns
true if the state transition succeeded.

---

<a id="fail"></a>

### fail

`virtual`

```cpp
virtual bool fail()
```

[Defined in src/base/include/icy/diagnosticmanager.h:110](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L110)

Transitions the state to Failed. 
#### Returns
true if the state transition succeeded.

---

<a id="addsummary"></a>

### addSummary

`virtual`

```cpp
virtual void addSummary(const std::string & text)
```

[Defined in src/base/include/icy/diagnosticmanager.h:114](https://github.com/auscaster/icey/blob/main/src/base/include/icy/diagnosticmanager.h#L114)

Appends text to the summary list and emits SummaryUpdated.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `text` | `const std::string &` | Summary line to append. |
