Rename _get_ methods for tuple & variants into _get_at_ methods.
Add _cget_at_ methods too.
This commit is contained in:
1 parent
af5742ce2d
commit
c9ebedb01f
4 files changed
+28
-4
No files matched your search
@@ -1931,11 +1931,16 @@ This method is created only if all oplists of the tuple define MOVE method.
|
||||
|
||||
Clear the tuple 'tuple (aka destructor).
|
||||
|
||||
##### const type1 *name\_get\_element1(const name\_t tuple)
|
||||
##### const type1 *name\_cget\_at\_element1(const name\_t tuple)
|
||||
|
||||
Return a constant pointer to the element 'element1' of the tuple.
|
||||
There is as many methods as there are elements.
|
||||
|
||||
##### type1 *name\_get\_at\_element1(const name\_t tuple)
|
||||
|
||||
Return a pointer to the element 'element1' of the tuple.
|
||||
There is as many methods as there are elements.
|
||||
|
||||
##### void name\_set\_element1(name\_t tuple, type1 element1)
|
||||
|
||||
Set the element of the tuple to 'element1'
|
||||
@@ -2067,7 +2072,12 @@ Initialize and set the variant 'variant' to the type and value of 'elementN'.
|
||||
|
||||
Set the variant 'variant' to the type and value of 'elementN'.
|
||||
|
||||
##### typeN * name\_get_elementN(name\_t variant)
|
||||
##### const typeN * name\_cget\_at\_elementN(name\_t variant)
|
||||
|
||||
Return a pointer to the 'varian' viewed as of type 'typeN'.
|
||||
If the variant isn't an object of such type, it returns NULL.
|
||||
|
||||
##### typeN * name\_get\_at\_elementN(name\_t variant)
|
||||
|
||||
Return a pointer to the 'varian' viewed as of type 'typeN'.
|
||||
If the variant isn't an object of such type, it returns NULL.
|
||||
|
||||
@@ -23,4 +23,8 @@ V0.2.*: * worker_start takes a 'worker_t' as an additional parameter
|
||||
* M_PRINT_ARG & M_FPRINT_ARG don't put a final semicolon at the end
|
||||
of their expansion anymore (cleaner and no longer needed with the
|
||||
new available tools).
|
||||
* For the TUPLE and the VARIANT
|
||||
change name of _get_ ## field into _get_at_ ## fields
|
||||
Since there is a name collision with other methods
|
||||
if a field is named 'str'.
|
||||
|
||||
@@ -222,8 +222,11 @@ namespace m_tuple {
|
||||
#define TUPLE_DEFINE_GETTER_FIELD(name, ...) \
|
||||
M_MAP2(TUPLE_DEFINE_GETTER_FIELD_PROTO, name, __VA_ARGS__)
|
||||
#define TUPLE_DEFINE_GETTER_FIELD_PROTO(name, a) \
|
||||
static inline TUPLE_GET_TYPE a const * M_C3(name, _get_, TUPLE_GET_FIELD a) \
|
||||
(M_C(name,_t) const my) { \
|
||||
static inline TUPLE_GET_TYPE a * M_C3(name, _get_at_, TUPLE_GET_FIELD a) \
|
||||
(M_C(name,_t) my) { \
|
||||
return &(my->TUPLE_GET_FIELD a);} \
|
||||
static inline TUPLE_GET_TYPE a const * M_C3(name, _cget_at_, TUPLE_GET_FIELD a) \
|
||||
(M_C(name,_t) const my) { \
|
||||
return &(my->TUPLE_GET_FIELD a);}
|
||||
|
||||
|
||||
|
||||
@@ -250,6 +250,13 @@
|
||||
return NULL; \
|
||||
} \
|
||||
return &my -> value . VARIANTI_GET_FIELD a; \
|
||||
} \
|
||||
static inline VARIANTI_GET_TYPE a const * \
|
||||
M_C3(name, _cget_, VARIANTI_GET_FIELD a)(M_C(name,_t) const my) { \
|
||||
if (my->type != M_C4(name, _, VARIANTI_GET_FIELD a, _value) ) { \
|
||||
return NULL; \
|
||||
} \
|
||||
return &my -> value . VARIANTI_GET_FIELD a; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user