Arcane
v3.16.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
ItemInternalSortFunction.h
1
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2
//-----------------------------------------------------------------------------
3
// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4
// See the top-level COPYRIGHT file for details.
5
// SPDX-License-Identifier: Apache-2.0
6
//-----------------------------------------------------------------------------
7
/*---------------------------------------------------------------------------*/
8
/* ItemInternalSortFunction.h (C) 2000-2008 */
9
/* */
10
/* Fonction de tri des entités. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_ITEMINTERNALSORTFUNCTION_H
13
#define ARCANE_ITEMINTERNALSORTFUNCTION_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/utils/String.h"
18
#include "arcane/IItemInternalSortFunction.h"
19
20
#include <algorithm>
21
22
/*---------------------------------------------------------------------------*/
23
/*---------------------------------------------------------------------------*/
24
25
ARCANE_BEGIN_NAMESPACE
26
27
/*---------------------------------------------------------------------------*/
28
/*---------------------------------------------------------------------------*/
29
30
/*---------------------------------------------------------------------------*/
31
/*---------------------------------------------------------------------------*/
32
/*!
33
* \ingroup Mesh
34
* \brief Interface d'une fonction de tri des entités.
35
*
36
* Cette classe est utilisée pour trier des entités.
37
* Il faut spécifier comme paramètre template un functor
38
* ayant le prototype suivant:
39
* \code
40
* bool operator()(const ItemInternal* item1,const ItemInternal* item2) const
41
* \endcode
42
* et qui retourne \a true si \a item1 est avant \a item2.
43
*/
44
template
<
typename
SortFunction>
45
class
ItemInternalSortFunction
46
:
public
IItemInternalSortFunction
47
{
48
public
:
49
50
ItemInternalSortFunction(
const
String
&
name
)
51
: m_name(
name
){}
52
virtual
~ItemInternalSortFunction() {}
//<! Libère les ressources
53
54
public
:
55
56
virtual
const
String
&
name
()
const
57
{
58
return
m_name;
59
}
60
61
public
:
62
63
/*!
64
* \brief Trie les entités du tableau \a items.
65
*/
66
virtual
void
sortItems
(ItemInternalMutableArrayView items)
67
{
68
std::sort(std::begin(items),std::end(items),SortFunction());
69
}
70
71
private
:
72
73
String
m_name;
74
};
75
76
/*---------------------------------------------------------------------------*/
77
/*---------------------------------------------------------------------------*/
78
79
ARCANE_END_NAMESPACE
80
81
/*---------------------------------------------------------------------------*/
82
/*---------------------------------------------------------------------------*/
83
84
#endif
Arcane::IItemInternalSortFunction
Interface d'une fonction de tri des entités.
Definition
IItemInternalSortFunction.h:42
Arcane::ItemInternalSortFunction::name
virtual const String & name() const
Nom de la fonction de tri.
Definition
ItemInternalSortFunction.h:56
Arcane::ItemInternalSortFunction::sortItems
virtual void sortItems(ItemInternalMutableArrayView items)
Trie les entités du tableau items.
Definition
ItemInternalSortFunction.h:66
Arcane::String
Chaîne de caractères unicode.
Definition
arccore/src/base/arccore/base/String.h:70
arcane
core
ItemInternalSortFunction.h
Généré le Lundi 24 Mars 2025 02:48:31 pour Arcane par
1.13.2