CMR  1.3.0
element.h
Go to the documentation of this file.
1 #ifndef CMR_ELEMENT_H
2 #define CMR_ELEMENT_H
3 
12 #include <cmr/env.h>
13 
14 #include <assert.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 typedef int CMR_ELEMENT;
21 
22 CMR_EXPORT
23 const char* CMRelementString(
24  CMR_ELEMENT element,
25  char* buffer
26 );
27 
32 static inline
34  CMR_ELEMENT element
35 )
36 {
37  return element != 0;
38 }
39 
40 static inline
42  size_t row
43 )
44 {
45  return -1 - (int)row;
46 }
47 
48 static inline
50  size_t column
51 )
52 {
53  return 1 + (int)column;
54 }
55 
56 static inline
58  CMR_ELEMENT element
59 )
60 {
61  return element < 0;
62 }
63 
64 static inline
66  CMR_ELEMENT element
67 )
68 {
69  assert(element < 0);
70  return -1 - element;
71 }
72 
73 static inline
75  CMR_ELEMENT element
76 )
77 {
78  return element > 0;
79 }
80 
81 static inline
83  CMR_ELEMENT element
84 )
85 {
86  assert(element > 0);
87  return -1 + element;
88 }
89 
94 static inline
96  CMR_ELEMENT element
97 )
98 {
99  return -element;
100 }
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif /* CMR_ELEMENT_H */
int CMR_ELEMENT
Definition: element.h:20
static CMR_ELEMENT CMRrowToElement(size_t row)
Definition: element.h:41
static size_t CMRelementToRowIndex(CMR_ELEMENT element)
Definition: element.h:65
CMR_EXPORT const char * CMRelementString(CMR_ELEMENT element, char *buffer)
Definition: element.c:9
static CMR_ELEMENT CMRcolumnToElement(size_t column)
Definition: element.h:49
static bool CMRelementIsValid(CMR_ELEMENT element)
Returns true if element is a row or a column element.
Definition: element.h:33
static size_t CMRelementToColumnIndex(CMR_ELEMENT element)
Definition: element.h:82
static bool CMRelementIsColumn(CMR_ELEMENT element)
Definition: element.h:74
static CMR_ELEMENT CMRelementTranspose(CMR_ELEMENT element)
Transposes element, i.e., turns rows into columns and vice versa.
Definition: element.h:95
static bool CMRelementIsRow(CMR_ELEMENT element)
Definition: element.h:57
Basic functionality of the software library.