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