programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
base
cs_map.h
Go to the documentation of this file.
1
#ifndef __CS_MAP_H__
2
#define __CS_MAP_H__
3
4
/*============================================================================
5
* Map helper structures
6
*============================================================================*/
7
8
/*
9
This file is part of Code_Saturne, a general-purpose CFD tool.
10
11
Copyright (C) 1998-2013 EDF S.A.
12
13
This program is free software; you can redistribute it and/or modify it under
14
the terms of the GNU General Public License as published by the Free Software
15
Foundation; either version 2 of the License, or (at your option) any later
16
version.
17
18
This program is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21
details.
22
23
You should have received a copy of the GNU General Public License along with
24
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25
Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
*/
27
28
/*----------------------------------------------------------------------------*/
29
30
/*----------------------------------------------------------------------------
31
* Local headers
32
*----------------------------------------------------------------------------*/
33
34
#include "
cs_base.h
"
35
36
/*----------------------------------------------------------------------------*/
37
38
BEGIN_C_DECLS
39
40
/*============================================================================
41
* Macro definitions
42
*============================================================================*/
43
44
/*============================================================================
45
* Type definitions
46
*============================================================================*/
47
48
typedef
struct
_cs_map_name_to_id_t cs_map_name_to_id_t;
49
50
/*============================================================================
51
* Global variables
52
*============================================================================*/
53
54
/*=============================================================================
55
* Public function prototypes for Fortran API
56
*============================================================================*/
57
58
/*=============================================================================
59
* Public function prototypes
60
*============================================================================*/
61
62
/*----------------------------------------------------------------------------
63
* Create empty name to id map.
64
*
65
* returns:
66
* pointer to newly initialized map structure.
67
*----------------------------------------------------------------------------*/
68
69
cs_map_name_to_id_t *
70
cs_map_name_to_id_create
(
void
);
71
72
/*----------------------------------------------------------------------------
73
* Destroy name to id map structure.
74
*
75
* parameters:
76
* m <-> pointer to map structure.
77
*----------------------------------------------------------------------------*/
78
79
void
80
cs_map_name_to_id_destroy
(cs_map_name_to_id_t **m);
81
82
/*----------------------------------------------------------------------------
83
* Find id matching a key, inserting key if not already present.
84
*
85
* parameters:
86
* m <-> pointer to map structure
87
* key <-- character string (key)
88
*
89
* returns:
90
* id matching key (already present or newly inserted)
91
*----------------------------------------------------------------------------*/
92
93
int
94
cs_map_name_to_id
(cs_map_name_to_id_t *m,
95
const
char
*key);
96
97
/*----------------------------------------------------------------------------
98
* Return id matching a key, or -1 if not present.
99
*
100
*
101
* parameters:
102
* m <-- pointer to map structure
103
* key <-- character string (key)
104
*
105
* returns:
106
* id matching key, or -1.
107
*----------------------------------------------------------------------------*/
108
109
int
110
cs_map_name_to_id_try
(
const
cs_map_name_to_id_t *m,
111
const
char
*key);
112
113
/*----------------------------------------------------------------------------
114
* Return a key name in a map matching a given id.
115
*
116
* parameters:
117
* m <-- pointer to map structure.
118
* id <-- key id
119
*
120
* returns:
121
* pointer to key.
122
*----------------------------------------------------------------------------*/
123
124
const
char
*
125
cs_map_name_to_id_reverse
(
const
cs_map_name_to_id_t *m,
126
size_t
id
);
127
128
/*----------------------------------------------------------------------------
129
* Return the size of a map.
130
*
131
* parameters:
132
* m <-- pointer to map structure.
133
*
134
* returns:
135
* number of entries in map.
136
*----------------------------------------------------------------------------*/
137
138
size_t
139
cs_map_name_to_id_size
(
const
cs_map_name_to_id_t *m);
140
141
/*----------------------------------------------------------------------------
142
* Return key in a map for a given index position.
143
*
144
* parameters:
145
* m <-- pointer to map structure.
146
* index <-- key index
147
*
148
* returns:
149
* pointer to key.
150
*----------------------------------------------------------------------------*/
151
152
const
char
*
153
cs_map_name_to_id_key
(
const
cs_map_name_to_id_t *m,
154
size_t
index);
155
156
/*----------------------------------------------------------------------------*/
157
158
END_C_DECLS
159
160
#endif
/* __CS_MAP_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1