69{
72
74
75 try {
76
77 JParser<> zap(
"Auxiliary program to test object selection methods.");
78
80
81 zap(argc, argv);
82 }
83 catch(const exception &error) {
84 FATAL(error.what() << endl);
85 }
86
88
89 buffer.push_back(__A__(3));
90 buffer.push_back(__A__(4));
91 buffer.push_back(__A__(2));
92 buffer.push_back(__A__(1));
93 buffer.push_back(__A__(5));
94
95
96 print(cout,
debug,
"data:", buffer.begin(), buffer.end());
97
98 JPredicate_t predicate(3);
99
100 {
101 vector<__A__>::const_iterator p = find_if(buffer.begin(), buffer.end(),
make_find_if(&__A__::a, predicate));
102
103 DEBUG(
"has " << predicate.value <<
"? " << (p != buffer.end() ?
"yes" :
"no") << endl);
104
105 ASSERT(p != buffer.end() && p->a == predicate.value);
106 }
107
108 {
109 vector<__A__>::const_iterator p = find_if(buffer.begin(), buffer.end(),
make_find_if(&__A__::get, predicate));
110
111 DEBUG(
"has " << predicate.value <<
"? " << (p != buffer.end() ?
"yes" :
"no") << endl);
112
113 ASSERT(p != buffer.end() && p->get() == predicate.value);
114 }
115
116 return 0;
117}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
Utility class to parse command line options.
JFind_if< JResult_t T::*, JPredicate_t > make_find_if(JResult_t T::*member, const JPredicate_t &predicate)
Helper method to create find_if for data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).