16 #ifndef __CFINGERPRINT_H
17 #define __CFINGERPRINT_H
20 #include "simkerneldefs.h"
24 #include "cmatchexpression.h"
45 virtual void initialize(
const char *expectedFingerprints,
cConfiguration *cfg,
int index=-1) = 0;
49 virtual void addEvent(
cEvent *event) = 0;
50 virtual void addScalarResult(
const cComponent *component,
const char *name,
double value) = 0;
51 virtual void addStatisticResult(
const cComponent *component,
const char *name,
const cStatistic *value) = 0;
52 virtual void addVectorResult(
const cComponent *component,
const char *name,
const simtime_t& t,
double value) = 0;
53 virtual void addVisuals() = 0;
55 virtual void addExtraData(
const char *data,
size_t length) = 0;
56 virtual void addExtraData(
char data) = 0;
57 virtual void addExtraData(
short data) = 0;
58 virtual void addExtraData(
int data) = 0;
59 virtual void addExtraData(
long data) = 0;
60 virtual void addExtraData(
long long data) = 0;
61 virtual void addExtraData(
unsigned char data) = 0;
62 virtual void addExtraData(
unsigned short data) = 0;
63 virtual void addExtraData(
unsigned int data) = 0;
64 virtual void addExtraData(
unsigned long data) = 0;
65 virtual void addExtraData(
unsigned long long data) = 0;
66 virtual void addExtraData(
double data) = 0;
67 virtual void addExtraData(
const char *data) = 0;
74 virtual bool checkFingerprint()
const = 0;
111 enum FingerprintIngredient {
113 SIMULATION_TIME =
't',
114 MESSAGE_FULL_NAME =
'n',
115 MESSAGE_CLASS_NAME =
'c',
117 MESSAGE_BIT_LENGTH =
'l',
118 MESSAGE_CONTROL_INFO_CLASS_NAME =
'o',
121 MODULE_FULL_NAME =
'm',
122 MODULE_FULL_PATH =
'p',
123 MODULE_CLASS_NAME =
'a',
124 RANDOM_NUMBERS_DRAWN =
'r',
126 RESULT_STATISTIC =
'z',
128 DISPLAY_STRINGS =
'y',
129 CANVAS_FIGURES =
'f',
138 mutable std::string attributeValue;
141 MatchableObject(
const cObject *
object) : object(
object) {}
143 virtual const char *getAsString()
const;
144 virtual const char *getAsString(
const char *attribute)
const;
148 std::string expectedFingerprints;
149 std::string ingredients;
154 [[deprecated]]
cHasher *hasher = &hasher_;
155 bool addEvents =
false;
156 bool addScalarResults =
false;
157 bool addStatisticResults =
false;
158 bool addVectorResults =
false;
159 bool addExtraData_ =
false;
162 virtual FingerprintIngredient validateIngredient(
char ch);
163 virtual void parseIngredients(
const char *s);
164 virtual void parseEventMatcher(
const char *s);
165 virtual void parseModuleMatcher(
const char *s);
166 virtual void parseResultMatcher(
const char *s);
167 virtual bool addEventIngredient(
cEvent *event, FingerprintIngredient ingredient);
168 virtual void addModuleVisuals(
cModule *module,
bool displayStrings,
bool figures);
175 virtual std::string str()
const override;
176 virtual void initialize(
const char *expectedFingerprints,
cConfiguration *cfg,
int index=-1)
override;
178 virtual void addEvent(
cEvent *event)
override;
179 virtual void addScalarResult(
const cComponent *component,
const char *name,
double value)
override;
180 virtual void addStatisticResult(
const cComponent *component,
const char *name,
const cStatistic *value)
override;
181 virtual void addVectorResult(
const cComponent *component,
const char *name,
const simtime_t& t,
double value)
override;
182 virtual void addVisuals()
override;
184 virtual void addExtraData(
const char *buffer,
size_t length)
override {
if (addExtraData_) hasher_.add(buffer, length); }
185 virtual void addExtraData(
char data)
override {
if (addExtraData_) hasher_.add(data); }
186 virtual void addExtraData(
short data)
override {
if (addExtraData_) hasher_.add(data); }
187 virtual void addExtraData(
int data)
override {
if (addExtraData_) hasher_.add(data); }
188 virtual void addExtraData(
long data)
override {
if (addExtraData_) hasher_.add(data); }
189 virtual void addExtraData(
long long data)
override {
if (addExtraData_) hasher_.add(data); }
190 virtual void addExtraData(
unsigned char data)
override {
if (addExtraData_) hasher_.add(data); }
191 virtual void addExtraData(
unsigned short data)
override {
if (addExtraData_) hasher_.add(data); }
192 virtual void addExtraData(
unsigned int data)
override {
if (addExtraData_) hasher_.add(data); }
193 virtual void addExtraData(
unsigned long data)
override {
if (addExtraData_) hasher_.add(data); }
194 virtual void addExtraData(
unsigned long long data)
override {
if (addExtraData_) hasher_.add(data); }
195 virtual void addExtraData(
double data)
override {
if (addExtraData_) hasher_.add(data); }
196 virtual void addExtraData(
const char *data)
override {
if (addExtraData_) hasher_.add(data); }
198 virtual bool checkFingerprint()
const override;
215 std::vector<cFingerprintCalculator *> elements;
222 virtual std::string str()
const override;
223 virtual void initialize(
const char *expectedFingerprints,
cConfiguration *cfg,
int index=-1)
override;
225 virtual void addEvent(
cEvent *event)
override;
226 virtual void addScalarResult(
const cComponent *component,
const char *name,
double value)
override;
227 virtual void addStatisticResult(
const cComponent *component,
const char *name,
const cStatistic *value)
override;
228 virtual void addVectorResult(
const cComponent *component,
const char *name,
const simtime_t& t,
double value)
override;
229 virtual void addVisuals()
override;
231 virtual void addExtraData(
const char *data,
size_t length)
override {
for (
auto element: elements) element->addExtraData(data, length); }
232 virtual void addExtraData(
char data)
override {
for (
auto element: elements) element->addExtraData(data); }
233 virtual void addExtraData(
short data)
override {
for (
auto element: elements) element->addExtraData(data); }
234 virtual void addExtraData(
int data)
override {
for (
auto element: elements) element->addExtraData(data); }
235 virtual void addExtraData(
long data)
override {
for (
auto element: elements) element->addExtraData(data); }
236 virtual void addExtraData(
long long data)
override {
for (
auto element: elements) element->addExtraData(data); }
237 virtual void addExtraData(
unsigned char data)
override {
for (
auto element: elements) element->addExtraData(data); }
238 virtual void addExtraData(
unsigned short data)
override {
for (
auto element: elements) element->addExtraData(data); }
239 virtual void addExtraData(
unsigned int data)
override {
for (
auto element: elements) element->addExtraData(data); }
240 virtual void addExtraData(
unsigned long data)
override {
for (
auto element: elements) element->addExtraData(data); }
241 virtual void addExtraData(
unsigned long long data)
override {
for (
auto element: elements) element->addExtraData(data); }
242 virtual void addExtraData(
double data)
override {
for (
auto element: elements) element->addExtraData(data); }
243 virtual void addExtraData(
const char *data)
override {
for (
auto element: elements) element->addExtraData(data); }
245 virtual bool checkFingerprint()
const override;