Jpp
18.2.1
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JLang
JCRC.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <string>
3
4
#include "
JLang/JCRC.hh
"
5
#include "
Jeep/JParser.hh
"
6
#include "
Jeep/JMessage.hh
"
7
8
/**
9
* User function.
10
*
11
* \param value value
12
*/
13
inline
void
fun
(
const
std::string
& value)
14
{
15
using namespace
std;
16
using namespace
JPP;
17
18
switch
(
crc
(value)) {
19
20
case
crc
(
"aap"
):
21
cout <<
"aap"
;
22
break
;
23
24
case
crc
(
"noot"
):
25
cout <<
"noot"
;
26
break
;
27
28
case
crc
(
"mies"
):
29
cout <<
"mies"
;
30
break
;
31
32
default
:
33
cout <<
"default"
;
34
break
;
35
}
36
}
37
38
39
/**
40
* \file
41
*
42
* Example program to test CRC evaluation (see JCRC.hh).
43
* \author mdejong
44
*/
45
int
main
(
int
argc,
char
**argv)
46
{
47
using namespace
std;
48
using namespace
JPP;
49
50
int
debug
;
51
52
try
{
53
54
JParser<>
zap(
"Example program to test CRC evaluation."
);
55
56
zap[
'd'
] =
make_field
(
debug
) = 0;
57
58
zap(argc, argv);
59
}
60
catch
(
const
exception &error) {
61
FATAL
(error.what() << endl);
62
}
63
64
for
(
string
str : {
"aap"
,
"noot"
,
"mies"
,
"hello"
}) {
65
66
cout <<
"test \""
<< str <<
"\" -> "
;
67
68
fun
(str);
69
70
cout << endl;
71
}
72
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
JCRC.hh
fun
void fun(const std::string &value)
User function.
Definition:
JCRC.cc:13
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JLANG::crc
constexpr size_t crc(const char(&buffer)[N])
Get CRC value at compile time.
Definition:
JCRC.hh:97
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
string
then awk string
Definition:
pre-calibration.sh:45
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5