DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
cstring.hpp
Go to the documentation of this file.
1#ifndef OKS_CSTRING_CMP_H
2#define OKS_CSTRING_CMP_H
3
4#include <stdint.h>
5
6namespace dunedaq {
7namespace oks {
8
9 inline bool cmp_str1(const char * s1, const char s2[2]) {
10 return (*(const int16_t *)s1 == *(const int16_t *)s2);
11 }
12
13 inline bool cmp_str2(const char * s1, const char s2[3]) {
14 return cmp_str1(s1,s2) && (s1[2] == 0);
15 }
16
17 inline bool cmp_str2n(const char * s1, const char s2[2]) {
18 return cmp_str1(s1,s2);
19 }
20
21 inline bool cmp_str3(const char * s1, const char s2[4]) {
22 return (*(const int32_t *)s1 == *(const int32_t *)s2);
23 }
24
25 inline bool cmp_str3n(const char * s1, const char s2[3]) {
26 return (s1[0] == s2[0]) && cmp_str1(s1+1,s2+1);
27 }
28
29 inline bool cmp_str4(const char * s1, const char s2[5]) {
30 return (s1[0] == s2[0]) && cmp_str3(s1+1,s2+1);
31 }
32
33 inline bool cmp_str4n(const char * s1, const char s2[4]) {
34 return cmp_str3(s1,s2);
35 }
36
37 inline bool cmp_str5(const char * s1, const char s2[6]) {
38 return cmp_str1(s1,s2) && cmp_str3(s1+2,s2+2);
39 }
40
41 inline bool cmp_str5n(const char * s1, const char s2[5]) {
42 return cmp_str3(s1,s2) && (s1[4] == s2[4]);
43 }
44
45 inline bool cmp_str6(const char * s1, const char s2[7]) {
46 return cmp_str3(s1,s2) && cmp_str2(s1+4,s2+4);
47 }
48
49 inline bool cmp_str6n(const char * s1, const char s2[6]) {
50 return cmp_str3(s1,s2) && cmp_str1(s1+4,s2+4);
51 }
52
53 inline bool cmp_str7(const char * s1, const char s2[8]) {
54 return (*(const int64_t *)s1 == *(const int64_t *)s2);
55 }
56
57 inline bool cmp_str7n(const char * s1, const char s2[8]) {
58 return (cmp_str3(s1,s2) && cmp_str3n(s1+4,s2+4));
59 }
60
61 inline bool cmp_str8(const char * s1, const char s2[9]) {
62 return cmp_str7(s1,s2) && (s1[8] == 0);
63 }
64
65 inline bool cmp_str8n(const char * s1, const char s2[9]) {
66 return (*(const int64_t *)s1 == *(const int64_t *)s2);
67 }
68
69 inline bool cmp_str9(const char * s1, const char s2[10]) {
70 return cmp_str1(s1,s2) && cmp_str7(s1+2,s2+2);
71 }
72
73 inline bool cmp_str10(const char * s1, const char s2[11]) {
74 return cmp_str7(s1,s2) && cmp_str2(s1+8,s2+8);
75 }
76
77 inline bool cmp_str11(const char * s1, const char s2[12]) {
78 return cmp_str7(s1,s2) && cmp_str3(s1+8,s2+8);
79 }
80
81 inline bool cmp_str12(const char * s1, const char s2[13]) {
82 return cmp_str7(s1,s2) && cmp_str4(s1+8,s2+8);
83 }
84
85 inline bool cmp_str13(const char * s1, const char s2[14]) {
86 return cmp_str7(s1,s2) && cmp_str5(s1+8,s2+8);
87 }
88
89 inline bool cmp_str14(const char * s1, const char s2[14]) {
90 return cmp_str7(s1,s2) && cmp_str6(s1+8,s2+8);
91 }
92
93 inline bool cmp_str15(const char * s1, const char s2[16]) {
94 return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8);
95 }
96
97 inline bool cmp_str16(const char * s1, const char s2[17]) {
98 return cmp_str7(s1,s2) && cmp_str7(s1+8,s2+8) && (s1[16] == 0);
99 }
100
101} // namespace oks
102} // namespace dunedaq
103
104#endif
bool cmp_str8(const char *s1, const char s2[9])
Definition cstring.hpp:61
bool cmp_str8n(const char *s1, const char s2[9])
Definition cstring.hpp:65
bool cmp_str2n(const char *s1, const char s2[2])
Definition cstring.hpp:17
bool cmp_str1(const char *s1, const char s2[2])
Definition cstring.hpp:9
bool cmp_str7n(const char *s1, const char s2[8])
Definition cstring.hpp:57
bool cmp_str4(const char *s1, const char s2[5])
Definition cstring.hpp:29
bool cmp_str6(const char *s1, const char s2[7])
Definition cstring.hpp:45
bool cmp_str10(const char *s1, const char s2[11])
Definition cstring.hpp:73
bool cmp_str9(const char *s1, const char s2[10])
Definition cstring.hpp:69
bool cmp_str5n(const char *s1, const char s2[5])
Definition cstring.hpp:41
bool cmp_str3n(const char *s1, const char s2[3])
Definition cstring.hpp:25
bool cmp_str13(const char *s1, const char s2[14])
Definition cstring.hpp:85
bool cmp_str16(const char *s1, const char s2[17])
Definition cstring.hpp:97
bool cmp_str2(const char *s1, const char s2[3])
Definition cstring.hpp:13
bool cmp_str15(const char *s1, const char s2[16])
Definition cstring.hpp:93
bool cmp_str5(const char *s1, const char s2[6])
Definition cstring.hpp:37
bool cmp_str11(const char *s1, const char s2[12])
Definition cstring.hpp:77
bool cmp_str3(const char *s1, const char s2[4])
Definition cstring.hpp:21
bool cmp_str12(const char *s1, const char s2[13])
Definition cstring.hpp:81
bool cmp_str6n(const char *s1, const char s2[6])
Definition cstring.hpp:49
bool cmp_str14(const char *s1, const char s2[14])
Definition cstring.hpp:89
bool cmp_str7(const char *s1, const char s2[8])
Definition cstring.hpp:53
bool cmp_str4n(const char *s1, const char s2[4])
Definition cstring.hpp:33
Including Qt Headers.
Definition __init__.py:1