summaryrefslogtreecommitdiff
path: root/tests/suite/ecore/src/include/eina_matrixsparse.h
blob: fc63ec22ed4e8f40850143025ca4553b9ef109dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* EINA - EFL data type library
 * Copyright (C) 2009 Gustavo Sverzut Barbieri
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library;
 * if not, see <https://www.gnu.org/licenses/>.
 */

#ifndef EINA_MATRIXSPARSE_H_
#define EINA_MATRIXSPARSE_H_

#include <stdlib.h>

#include "eina_config.h"

#include "eina_types.h"
#include "eina_iterator.h"
#include "eina_accessor.h"

/**
 * @addtogroup Eina_Data_Types_Group Data Types
 *
 * @{
 */

/**
 * @addtogroup Eina_Containers_Group Containers
 *
 * @{
 */

/**
 * @defgroup Eina_Matrixsparse_Group Sparse Matrix
 *
 * @{
 */

/**
 * @typedef Eina_Matrixsparse
 * Type for a generic sparse matrix.
 */
typedef struct _Eina_Matrixsparse Eina_Matrixsparse;

/**
 * @typedef Eina_Matrixsparse_Row
 * Type for a generic sparse matrix row, opaque for users.
 */
typedef struct _Eina_Matrixsparse_Row Eina_Matrixsparse_Row;

/**
 * @typedef Eina_Matrixsparse_Cell
 * Type for a generic sparse matrix cell, opaque for users.
 */
typedef struct _Eina_Matrixsparse_Cell Eina_Matrixsparse_Cell;

typedef struct _Eina_Matrixsparse_Item_Cell Eina_Matrixsparse_Item_Cell;
typedef struct _Eina_Matrixsparse_Item_Row Eina_Matrixsparse_Item_Row;


/* constructors and destructors */
EAPI Eina_Matrixsparse *eina_matrixsparse_new(unsigned long rows,
					      unsigned long cols,
					      void (*free_func) (void
								 *user_data,
								 void
								 *cell_data),
					      const void *user_data);
EAPI void eina_matrixsparse_free(Eina_Matrixsparse * m);

/* size manipulation */
EAPI void eina_matrixsparse_size_get(const Eina_Matrixsparse * m,
				     unsigned long *rows,
				     unsigned long *cols);
EAPI Eina_Bool eina_matrixsparse_size_set(Eina_Matrixsparse * m,
					  unsigned long rows,
					  unsigned long cols);

/* data getting */
EAPI Eina_Bool eina_matrixsparse_cell_idx_get(const Eina_Matrixsparse * m,
					      unsigned long row,
					      unsigned long col,
					      Eina_Matrixsparse_Cell **
					      cell);
EAPI void *eina_matrixsparse_cell_data_get(const Eina_Matrixsparse_Cell *
					   cell);
EAPI void *eina_matrixsparse_data_idx_get(const Eina_Matrixsparse * m,
					  unsigned long row,
					  unsigned long col);
EAPI Eina_Bool eina_matrixsparse_cell_position_get(const
						   Eina_Matrixsparse_Cell *
						   cell,
						   unsigned long *row,
						   unsigned long *col);

/* data setting */
EAPI Eina_Bool eina_matrixsparse_cell_data_replace(Eina_Matrixsparse_Cell *
						   cell, const void *data,
						   void **p_old);
EAPI Eina_Bool eina_matrixsparse_cell_data_set(Eina_Matrixsparse_Cell *
					       cell, const void *data);
EAPI Eina_Bool eina_matrixsparse_data_idx_replace(Eina_Matrixsparse * m,
						  unsigned long row,
						  unsigned long col,
						  const void *data,
						  void **p_old);
EAPI Eina_Bool eina_matrixsparse_data_idx_set(Eina_Matrixsparse * m,
					      unsigned long row,
					      unsigned long col,
					      const void *data);

/* data deleting */
EAPI Eina_Bool eina_matrixsparse_row_idx_clear(Eina_Matrixsparse * m,
					       unsigned long row);
EAPI Eina_Bool eina_matrixsparse_column_idx_clear(Eina_Matrixsparse * m,
						  unsigned long col);
EAPI Eina_Bool eina_matrixsparse_cell_idx_clear(Eina_Matrixsparse * m,
						unsigned long row,
						unsigned long col);
EAPI Eina_Bool eina_matrixsparse_cell_clear(Eina_Matrixsparse_Cell * cell);

/* iterators */
EAPI Eina_Iterator *eina_matrixsparse_iterator_new(const Eina_Matrixsparse
						   * m);
EAPI Eina_Iterator *eina_matrixsparse_iterator_complete_new(const
							    Eina_Matrixsparse
							    * m);

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

#endif				/* EINA_MATRIXSPARSE_H_ */