Lely core libraries 2.3.4
type.c
Go to the documentation of this file.
1
24#include "co.h"
25#include <lely/co/type.h>
26
27int
28co_type_is_basic(co_unsigned16_t type)
29{
30 switch (type) {
31#define LELY_CO_DEFINE_TYPE(a, b, c, d) case CO_DEFTYPE_##a:
32#include <lely/co/def/basic.def>
33#undef LELY_CO_DEFINE_TYPE
34 return 1;
35 default: return 0;
36 }
37}
38
39int
40co_type_is_array(co_unsigned16_t type)
41{
42 switch (type) {
46 case CO_DEFTYPE_DOMAIN: return 1;
47 default: return 0;
48 }
49}
50
51size_t
52co_type_sizeof(co_unsigned16_t type)
53{
54 switch (type) {
55#define LELY_CO_DEFINE_TYPE(a, b, c, d) \
56 case CO_DEFTYPE_##a: \
57 return sizeof(co_##b##_t);
58#include <lely/co/def/type.def>
59#undef LELY_CO_DEFINE_TYPE
60 default: return 0;
61 }
62}
63
64size_t
65co_type_alignof(co_unsigned16_t type)
66{
67 switch (type) {
68#define LELY_CO_DEFINE_TYPE(a, b, c, d) \
69 case CO_DEFTYPE_##a: \
70 return _Alignof(co_##b##_t);
71#include <lely/co/def/type.def>
72#undef LELY_CO_DEFINE_TYPE
73 default: return 1;
74 }
75}
This is the internal header file of the CANopen library.
int co_type_is_array(co_unsigned16_t type)
Returns 1 if the specified (static) data type is an array, and 0 if not.
Definition type.c:40
size_t co_type_alignof(co_unsigned16_t type)
Returns the alignment requirements (in bytes) of a value of the specified data type,...
Definition type.c:65
size_t co_type_sizeof(co_unsigned16_t type)
Returns the native size (in bytes) of a value of the specified data type, or 1 if it is not a static ...
Definition type.c:52
int co_type_is_basic(co_unsigned16_t type)
Returns 1 if the specified (static) data type is a basic type, and 0 if not.
Definition type.c:28
This header file is part of the CANopen library; it contains the CANopen type definitions.
#define CO_DEFTYPE_UNICODE_STRING
The data type (and object index) of an array of (16-bit) Unicode characters.
Definition type.h:62
#define CO_DEFTYPE_VISIBLE_STRING
The data type (and object index) of an array of visible characters.
Definition type.h:56
#define CO_DEFTYPE_DOMAIN
The data type (and object index) of an arbitrary large block of data.
Definition type.h:77
#define CO_DEFTYPE_OCTET_STRING
The data type (and object index) of an array of octets.
Definition type.h:59