16 #ifndef __CFINGERPRINT_H
17 #define __CFINGERPRINT_H
21 #include "simkerneldefs.h"
25 #include "cmatchexpression.h"
46 virtual void initialize(
const char *expectedFingerprints,
cConfiguration *cfg,
int index=-1) = 0;
50 virtual void addEvent(
cEvent *event) = 0;
51 virtual void addScalarResult(
const cComponent *component,
const char *name,
double value) = 0;
52 virtual void addStatisticResult(
const cComponent *component,
const char *name,
const cStatistic *value) = 0;
53 virtual void registerVectorResult(
void *vechandle,
const cComponent *component,
const char *name) = 0;
54 virtual void addVectorResult(
void *vechandle,
const simtime_t& t,
double value) = 0;
55 virtual void addVisuals() = 0;
57 virtual void addExtraData(
const char *data,
size_t length) = 0;
58 virtual void addExtraData(
char data) = 0;
59 virtual void addExtraData(
short data) = 0;
60 virtual void addExtraData(
int data) = 0;
61 virtual void addExtraData(
long data) = 0;
62 virtual void addExtraData(
long long data) = 0;
63 virtual void addExtraData(
unsigned char data) = 0;
64 virtual void addExtraData(
unsigned short data) = 0;
65 virtual void addExtraData(
unsigned int data) = 0;
66 virtual void addExtraData(
unsigned long data) = 0;
67 virtual void addExtraData(
unsigned long long data) = 0;
68 virtual void addExtraData(
double data) = 0;
69 virtual void addExtraData(
const char *data) = 0;
76 virtual bool checkFingerprint()
const = 0;
113 enum FingerprintIngredient {
115 SIMULATION_TIME =
't',
116 MESSAGE_FULL_NAME =
'n',
117 MESSAGE_CLASS_NAME =
'c',
119 MESSAGE_BIT_LENGTH =
'l',
120 MESSAGE_CONTROL_INFO_CLASS_NAME =
'o',
123 MODULE_FULL_NAME =
'm',
124 MODULE_FULL_PATH =
'p',
125 MODULE_CLASS_NAME =
'a',
126 RANDOM_NUMBERS_DRAWN =
'r',
128 RESULT_STATISTIC =
'z',
130 DISPLAY_STRINGS =
'y',
131 CANVAS_FIGURES =
'f',
140 mutable std::string attributeValue;
143 MatchableObject(
const cObject *
object) : object(
object) {}
145 virtual const char *getAsString()
const;
146 virtual const char *getAsString(
const char *attribute)
const;
150 std::string expectedFingerprints;
151 std::string ingredients;
156 [[deprecated]]
cHasher *hasher = &hasher_;
157 bool addEvents =
false;
158 bool addScalarResults =
false;
159 bool addStatisticResults =
false;
160 bool addVectorResults =
false;
161 bool addExtraData_ =
false;
162 std::set<void*> enabledVecHandles;
165 virtual FingerprintIngredient validateIngredient(
char ch);
166 virtual void parseIngredients(
const char *s);
167 virtual void parseEventMatcher(
const char *s);
168 virtual void parseModuleMatcher(
const char *s);
169 virtual void parseResultMatcher(
const char *s);
170 virtual bool addEventIngredient(
cEvent *event, FingerprintIngredient ingredient);
171 virtual void addModuleVisuals(
cModule *module,
bool displayStrings,
bool figures);
178 virtual std::string str()
const override;
179 virtual void initialize(
const char *expectedFingerprints,
cConfiguration *cfg,
int index=-1)
override;
181 virtual void addEvent(
cEvent *event)
override;
182 virtual void addScalarResult(
const cComponent *component,
const char *name,
double value)
override;
183 virtual void addStatisticResult(
const cComponent *component,
const char *name,
const cStatistic *value)
override;
184 virtual void registerVectorResult(
void *vechandle,
const cComponent *component,
const char *name)
override;
185 virtual void addVectorResult(
void *vechandle,
const simtime_t& t,
double value)
override;
186 virtual void addVisuals()
override;
188 virtual void addExtraData(
const char *buffer,
size_t length)
override {
if (addExtraData_) hasher_.add(buffer, length); }
189 virtual void addExtraData(
char data)
override {
if (addExtraData_) hasher_.add(data); }
190 virtual void addExtraData(
short data)
override {
if (addExtraData_) hasher_.add(data); }
191 virtual void addExtraData(
int data)
override {
if (addExtraData_) hasher_.add(data); }
192 virtual void addExtraData(
long data)
override {
if (addExtraData_) hasher_.add(data); }
193 virtual void addExtraData(
long long data)
override {
if (addExtraData_) hasher_.add(data); }
194 virtual void addExtraData(
unsigned char data)
override {
if (addExtraData_) hasher_.add(data); }
195 virtual void addExtraData(
unsigned short data)
override {
if (addExtraData_) hasher_.add(data); }
196 virtual void addExtraData(
unsigned int data)
override {
if (addExtraData_) hasher_.add(data); }
197 virtual void addExtraData(
unsigned long data)
override {
if (addExtraData_) hasher_.add(data); }
198 virtual void addExtraData(
unsigned long long data)
override {
if (addExtraData_) hasher_.add(data); }
199 virtual void addExtraData(
double data)
override {
if (addExtraData_) hasher_.add(data); }
200 virtual void addExtraData(
const char *data)
override {
if (addExtraData_) hasher_.add(data); }
202 virtual bool checkFingerprint()
const override;
219 std::vector<cFingerprintCalculator *> elements;
226 virtual std::string str()
const override;
227 virtual void initialize(
const char *expectedFingerprints,
cConfiguration *cfg,
int index=-1)
override;
229 virtual void addEvent(
cEvent *event)
override;
230 virtual void addScalarResult(
const cComponent *component,
const char *name,
double value)
override;
231 virtual void addStatisticResult(
const cComponent *component,
const char *name,
const cStatistic *value)
override;
232 virtual void registerVectorResult(
void *vechandle,
const cComponent *component,
const char *name)
override;
233 virtual void addVectorResult(
void *vechandle,
const simtime_t& t,
double value)
override;
234 virtual void addVisuals()
override;
236 virtual void addExtraData(
const char *data,
size_t length)
override {
for (
auto element: elements) element->addExtraData(data, length); }
237 virtual void addExtraData(
char data)
override {
for (
auto element: elements) element->addExtraData(data); }
238 virtual void addExtraData(
short data)
override {
for (
auto element: elements) element->addExtraData(data); }
239 virtual void addExtraData(
int data)
override {
for (
auto element: elements) element->addExtraData(data); }
240 virtual void addExtraData(
long data)
override {
for (
auto element: elements) element->addExtraData(data); }
241 virtual void addExtraData(
long long data)
override {
for (
auto element: elements) element->addExtraData(data); }
242 virtual void addExtraData(
unsigned char data)
override {
for (
auto element: elements) element->addExtraData(data); }
243 virtual void addExtraData(
unsigned short data)
override {
for (
auto element: elements) element->addExtraData(data); }
244 virtual void addExtraData(
unsigned int data)
override {
for (
auto element: elements) element->addExtraData(data); }
245 virtual void addExtraData(
unsigned long data)
override {
for (
auto element: elements) element->addExtraData(data); }
246 virtual void addExtraData(
unsigned long long data)
override {
for (
auto element: elements) element->addExtraData(data); }
247 virtual void addExtraData(
double data)
override {
for (
auto element: elements) element->addExtraData(data); }
248 virtual void addExtraData(
const char *data)
override {
for (
auto element: elements) element->addExtraData(data); }
250 virtual bool checkFingerprint()
const override;