das2C
das core C utilities (v3)
vector.h
Go to the documentation of this file.
1 /* Copyright (C) 2024 Chris Piker <chris-piker@uiowa.edu>
2  *
3  * This file is part of das2C, the Core Das C Library.
4  *
5  * Das2C is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * Das2C is distributed in the hope that it will be useful, but WITHOUT ANY
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * version 2.1 along with Das2C; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
20 #ifndef _vector_h_
21 #define _vector_h_
22 
23 #include <das2/value.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
35 typedef struct das_geovec_t{
36 
37  /* The vector values if local */
38  double comp[3];
39 
40  /* The ID of the vector frame, or 0 if unknown */
41  ubyte frame;
42 
43  /* Frame type copied from Frame Descrptor */
44  ubyte ftype;
45 
46  /* the element value type, taken from das_val_type */
47  ubyte et;
48 
49  /* the size of each element, in bytes, copied in from das_vt_size */
50  ubyte esize;
51 
52  /* Number of valid components */
53  ubyte ncomp;
54 
55  /* Direction for each component, storred in nibbles */
56  ubyte dirs[3];
57 
58 } das_geovec;
59 
60 DasErrCode das_geovec_init(
61  das_geovec* pVec, const ubyte* pData, ubyte frame, ubyte ftype,
62  ubyte et, ubyte esize, ubyte ncomp, const ubyte* pDirs
63 );
64 
65 #define das_geovec_eltype(p) (p->vt & 0x0F)
66 
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* _vector_h_ */
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition: defs.h:164
Holds a geometric vector of some sort.
Definition: vector.h:35
A generic value type for use in arrays, datums and variables.