> For the complete documentation index, see [llms.txt](https://docs.medcrypt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.medcrypt.com/fr/guardian/api-overview/api-reference/classes/classmedcrypt-guardian-task.md).

# medcrypt::guardian::Task

Conteneur multithread.

`#include <Task.h>`

## Fonctions publiques

|                                                                                                         | Nom                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                                                                                                         | <p><a href="#function-~task"><strong>\~Task</strong></a>()<br>Le destructeur.</p>                                                                                                                                                                                               |
| [État](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status) | <p><a href="#function-run"><strong>Exécuter</strong></a>()<br>Exécute l’objet contenu.</p>                                                                                                                                                                                      |
| [État](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status) | <p><a href="#function-getservice"><strong>GetService</strong></a>(std::unique\_ptr< <a href="/fr/guardian/api-overview/api-reference/classes/classmedcrypt-guardian-service.md">Service</a> > \* out\_service)<br>Renvoie le service contenu.</p>                               |
| [État](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status) | <p><a href="#function-getsession"><strong>GetSession</strong></a>(std::unique\_ptr< <a href="/fr/guardian/api-overview/api-reference/classes/classmedcrypt-guardian-session.md">Session</a> > \* out\_session)<br>Renvoie la session contenue.</p>                              |
| [État](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status) | <p><a href="#function-getchannelguard"><strong>GetChannelGuard</strong></a>(std::unique\_ptr< <a href="/fr/guardian/api-overview/api-reference/classes/classmedcrypt-guardian-channelguard.md">ChannelGuard</a> > \* out\_channelguard)<br>Renvoie le ChannelGuard contenu.</p> |

## Documentation des fonctions publiques

### fonction \~Task

```cpp
~Task()
```

Le destructeur.

**Paramètres**:

* **aucun**

**Valeur de retour**: none

Le destructeur renvoie l’objet contenu au Guardian principal. [Guardian](/fr/guardian/api-overview/api-reference/classes/classmedcrypt-guardian-guardian.md) Exécute le thread.

### fonction Run

```cpp
Status Run()
```

Exécute l’objet contenu.

**Paramètres**:

* **aucun**

**Renvoie**:

* **OK** l’objet contenu a été exécuté avec succès
* **FAIL** échec général
* **SHUTDOWN** l’objet contenu est arrêté

**Retour**: [medcrypt::guardian::Status](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status)

Cet appel à Run doit être effectué par la boucle principale du thread.

### fonction GetService

```cpp
Status GetService(
    std::unique_ptr< Service > * out_service
)
```

Renvoie le service contenu.

**Paramètres**:

* **out\_service** pointeur vers le stockage unique\_ptr du service contenu

**Renvoie**:

* **OK** le pointeur dans out\_service est valide
* **FAIL** échec général
* **BADPARAM** out\_service est nullptr
* **MISCONFIGURED** la tâche ne contient pas de service

**Retour**: [medcrypt::guardian::Status](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status)

### fonction GetSession

```cpp
Status GetSession(
    std::unique_ptr< Session > * out_session
)
```

Renvoie la session contenue.

**Paramètres**:

* **out\_session** pointeur vers le stockage unique\_ptr de la session contenue

**Renvoie**:

* **OK** le pointeur dans out\_session est valide
* **FAIL** échec général
* * **BADPARAM** out\_session est nullptr
  * **MISCONFIGURED** la tâche ne contient pas de session

**Retour**: [medcrypt::guardian::Status](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status)

### fonction GetChannelGuard

```cpp
Status GetChannelGuard(
    std::unique_ptr< ChannelGuard > * out_channelguard
)
```

Renvoie le channelguard contenu.

**Paramètres**:

* **out\_channelguard** pointeur vers le stockage unique\_ptr du channelguard contenu

**Renvoie**:

* **OK** le pointeur dans out\_channelguard est valide
* **FAIL** échec général
* **BADPARAM** out\_channelguard est nullptr
* **MISCONFIGURED** la tâche ne contient pas de channelguard

**Retour**: [medcrypt::guardian::Status](/fr/guardian/api-overview/api-reference/namespaces/namespacemedcrypt-guardian.md#typedef-status)

## Débogage et journalisation

Guardian ne crée pas de fichiers journaux. La journalisation est plutôt contrôlée par l’application :

* Guardian écrit les journaux dans `stdout` et `stderr`, qui s’affichent dans le terminal/la CLI de l’application en cours d’exécution. Recherchez dans la sortie les codes d’erreur spécifiques ou les échecs de connexion.
* **Journalisation personnalisée :** Utilisez `SetLoggingCallback` pour rediriger les messages de journalisation vers une fonction de rappel, interrompre leur affichage dans le terminal et permettre un traitement personnalisé des journaux
* **Contrôle de la journalisation :** Les applications peuvent contrôler le niveau et le degré de détail de la journalisation.
* **Interface utilisateur de Guardian Cloud**: Consultez l’interface Guardian Cloud pour obtenir des détails supplémentaires sur les erreurs et connaître l’état du provisionnement.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.medcrypt.com/fr/guardian/api-overview/api-reference/classes/classmedcrypt-guardian-task.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
