Debian Codegraph @

src/thirdparty/VLFeat/array.h

raw
1 /** @file array.h
2 ** @brief Array - Definition
3 ** @author Andrea Vedaldi
4 **/
5
6 /*
7 Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
8 All rights reserved.
9
10 This file is part of the VLFeat library and is made available under
11 the terms of the BSD license (see the COPYING file).
12 */
13
14 #ifndef VL_ARRAY_H
15 #define VL_ARRAY_H
16
17 #include "generic.h"
18
19 /** @brief Maximum number of array dimensions */
20 #define VL_ARRAY_MAX_NUM_DIMENSIONS 16
21
22 /** @brief Numeric array */
23 typedef struct _VlArray
24 {
25 vl_type type ;
26 vl_bool isEnvelope ;
27 vl_bool isSparse ;
28 vl_size numDimensions ;
29 vl_size dimensions [VL_ARRAY_MAX_NUM_DIMENSIONS] ;
30 void * data ;
31 void * rowPointers ;
32 void * columnPointers ;
33 } VlArray ;
34
35
36 /** @name Get data and parameters
37 ** @{ */
38
39 /** @brief Get number of dimensions
40 ** @param self array.
41 ** @return number of dimensions.
42 **/
43
44 VL_INLINE vl_size
45 vl_array_get_num_dimensions (VlArray const * self)
46 {
47 return self->numDimensions ;
48 }
49
50 /** @brief Get dimensions
51 ** @param self array.
52 ** @return dimensions.
53 **/
54
55 VL_INLINE vl_size const *
56 vl_array_get_dimensions (VlArray const * self)
57 {
58 return self->dimensions ;
59 }
60
61 /** @brief Get data
62 ** @param self array.
63 ** @return data.
64 **/
65
66 VL_INLINE void *
67 vl_array_get_data (VlArray const * self)
68 {
69 return self->data;
70 }
71
72 /** @brief Get type
73 ** @param self array.
74 ** @return type.
75 **/
76
77 VL_INLINE vl_type
78 vl_array_get_data_type (VlArray const * self)
79 {
80 return self->type ;
81 }
82
83 VL_EXPORT vl_size vl_array_get_num_elements (VlArray const * self) ;
84
85 /** @{ */
86
87 /** @name Constructing and destroying
88 ** @{ */
89
90 VL_EXPORT VlArray * vl_array_init (VlArray * self, vl_type type, vl_size numDimension, vl_size const * dimensions) ;
91 VL_EXPORT VlArray * vl_array_init_envelope (VlArray *self, void * data, vl_type type, vl_size numDimension, vl_size const * dimensions) ;
92 VL_EXPORT VlArray * vl_array_init_matrix (VlArray * self, vl_type type, vl_size numRows, vl_size numColumns) ;
93 VL_EXPORT VlArray * vl_array_init_matrix_envelope (VlArray * self, void * data, vl_type type, vl_size numRows, vl_size numColumns) ;
94
95 VL_EXPORT VlArray * vl_array_new (vl_type type, vl_size numDimension, vl_size const * dimensions) ;
96 VL_EXPORT VlArray * vl_array_new_envelope (void * data, vl_type type, vl_size numDimension, vl_size const * dimensions) ;
97 VL_EXPORT VlArray * vl_array_new_matrix (vl_type type, vl_size numRows, vl_size numColumns) ;
98 VL_EXPORT VlArray * vl_array_new_matrix_envelope (void * data, vl_type type, vl_size numRows, vl_size numColumns) ;
99
100 VL_EXPORT void vl_array_dealloc (VlArray * self) ;
101 VL_EXPORT void vl_array_delete (VlArray * self) ;
102 /** @} */
103
104 /* VL_ARRAY_H */
105 #endif