equal
deleted
inserted
replaced
|
1 /***************************************************************************** |
|
2 * |
|
3 * $Id$ |
|
4 * |
|
5 ****************************************************************************/ |
|
6 |
|
7 #include "coe_datatypes.h" |
|
8 |
|
9 /****************************************************************************/ |
|
10 |
|
11 static const CoEDataType dataTypes[] = { |
|
12 {"int8", 0x0002, 1}, |
|
13 {"int16", 0x0003, 2}, |
|
14 {"int32", 0x0004, 4}, |
|
15 {"uint8", 0x0005, 1}, |
|
16 {"uint16", 0x0006, 2}, |
|
17 {"uint32", 0x0007, 4}, |
|
18 {"string", 0x0009, 0}, |
|
19 {"raw", 0xffff, 0}, |
|
20 {} |
|
21 }; |
|
22 |
|
23 /****************************************************************************/ |
|
24 |
|
25 const CoEDataType *findDataType(const string &str) |
|
26 { |
|
27 const CoEDataType *d; |
|
28 |
|
29 for (d = dataTypes; d->name; d++) |
|
30 if (str == d->name) |
|
31 return d; |
|
32 |
|
33 return NULL; |
|
34 } |
|
35 |
|
36 /****************************************************************************/ |
|
37 |
|
38 const CoEDataType *findDataType(uint16_t code) |
|
39 { |
|
40 const CoEDataType *d; |
|
41 |
|
42 for (d = dataTypes; d->name; d++) |
|
43 if (code == d->coeCode) |
|
44 return d; |
|
45 |
|
46 return NULL; |
|
47 } |
|
48 |
|
49 /*****************************************************************************/ |