JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
IJSONSimilarityMeasure.h
Go to the documentation of this file.
1 //
2 // Created by Nico Schäfer on 09/07/18.
3 //
4 
5 #ifndef JODA_IJSONSIMILARITYMEASURE_H
6 #define JODA_IJSONSIMILARITYMEASURE_H
7 #include <joda/misc/RJFwd.h>
8 #include <string>
9 #include <type_traits>
10 
11 //
12 // To add new Similarity measures the following steps have to be done
13 // 1: Create the Class
14 // 2: Create the similarityRepresentation for the class
15 // 3: Add the similarity measure to the config::Sim_Measures enum
16 // 4: In ReaderParser add the measure to the Constructor
17 // 5: In the responsible Parsers, add the template instantiation
18 // This can most probably be simplified by c++ magic
19 //
20 
25  public:
32  virtual double measure(const RJDocument &lhs, const RJDocument &rhs) = 0;
33 };
34 
35 template <typename T>
37  static_assert(std::is_base_of<IJSONSimilarityMeasure, T>::value,
38  "T must derive from IJSONSimilarityMeasure");
39  typedef void *Representation;
46  Representation getRepresentation(const RJDocument &lhs) { return nullptr; }
47 
54  Representation getRepresentation(const std::string &lhs) { return nullptr; }
55 
56  bool is_implemented = false;
57 };
58 
59 #endif // JODA_IJSONSIMILARITYMEASURE_H
rapidjson::GenericDocument< RJChar, RJMemoryPoolAlloc, RJBaseAlloc > RJDocument
Definition: RJFwd.h:28
Definition: IJSONSimilarityMeasure.h:24
virtual double measure(const RJDocument &lhs, const RJDocument &rhs)=0
Definition: IJSONSimilarityMeasure.h:36
Representation getRepresentation(const RJDocument &lhs)
Definition: IJSONSimilarityMeasure.h:46
void * Representation
Definition: IJSONSimilarityMeasure.h:38
bool is_implemented
Definition: IJSONSimilarityMeasure.h:56
Representation getRepresentation(const std::string &lhs)
Definition: IJSONSimilarityMeasure.h:54