MetricKnn API
Fast Similarity Search using the Metric Space Approach
mknn_domain.hpp
1 /*
2  * Copyright (C) 2012-2015, Juan Manuel Barrios <juanmanuel@barrios.cl>
3  * All rights reserved.
4  *
5  * This file is part of MetricKnn.
6  * MetricKnn is made available under the terms of the BSD 2-Clause License.
7  */
8 
9 #ifndef MKNN_DOMAIN_HPP_
10 #define MKNN_DOMAIN_HPP_
11 
12 #include "../metricknn_cpp.hpp"
13 
14 namespace mknn {
15 
33 class Domain {
34 public:
40  static const std::string GENERAL_DOMAIN_STRING;
41 
47  static const std::string GENERAL_DOMAIN_VECTOR;
48 
53  static const std::string GENERAL_DOMAIN_MULTIOBJECT;
54 
59  static const std::string GENERAL_DOMAIN_CUSTOMOBJECT;
60 
72  static Domain newString();
73 
90  static Domain newVector(long long num_dimensions,
91  std::string dimension_datatype);
92 
98  long long getVectorNumDimensions();
99 
105  std::string getVectorDimensionDataType();
106 
113  long long getVectorSizeInBytes();
132  static Domain newMultiobject(const std::vector<Domain> &subdomains);
133 
139  long long getMultiobjectLength();
140 
148  Domain &getMultiobjectSubDomain(long long num_subdomain);
149 
166  static Domain newCustomObject(long long custom_id, void *custom_data);
171  long long getCustomObjectId();
176  void *getCustomObjectData();
177 
186  std::string getGeneralDomain();
187 
194  bool isGeneralDomainString();
195 
202  bool isGeneralDomainVector();
203 
211 
219 
232  static bool testEqual(Domain &domain1, Domain &domain2);
233 
246  static bool testEqualExceptDatatype(Domain &domain1, Domain &domain2);
247 
253  std::string toString();
254 
262  static Domain newParseString(std::string string_domain);
263 
270  static Domain newClone(Domain domain);
271 
275  Domain();
279  virtual ~Domain();
283  Domain(const Domain &other);
287  Domain &operator=(const Domain &other);
288 
289 protected:
293  class Impl;
297  std::unique_ptr<Impl> pimpl;
298 
299  friend class Dataset;
300  friend class DatasetLoader;
301  friend class Distance;
302  friend class Printer;
303 };
304 
305 }
306 #endif
static Domain newVector(long long num_dimensions, std::string dimension_datatype)
Creates a new domain object that represents a vector of some fixed dimension and datatype.
bool isGeneralDomainMultiObject()
Returns true if the general domain is multi-object.
static Domain newString()
Creates a new domain object that represents strings.
long long getMultiobjectLength()
The number of objects in the multi-object, i.e., the size of the void** array.
Domain()
Default constructor.
long long getCustomObjectId()
The object printer converts an object from a given domain to its string representation.
Definition: mknn_printer.hpp:20
std::unique_ptr< Impl > pimpl
opaque object
Definition: mknn_domain.hpp:293
bool isGeneralDomainString()
Returns true if the general domain is string.
static bool testEqual(Domain &domain1, Domain &domain2)
Two domains are equal if they coincide in their general domains and all their attributes.
static const std::string GENERAL_DOMAIN_MULTIOBJECT
General Domain of Multi-Object.
Definition: mknn_domain.hpp:53
static Domain newCustomObject(long long custom_id, void *custom_data)
Creates a new domain object that represents a multi-object, i.e., the combination of many objects in ...
Domain & operator=(const Domain &other)
Assignment operator.
Represents a set of objects of any type.
Definition: mknn_dataset.hpp:23
void * getCustomObjectData()
static Domain newParseString(std::string string_domain)
Creates a new domain object by parsing a string representation generated by toString.
bool isGeneralDomainCustomObject()
Returns true if the general domain is custom-object.
static const std::string GENERAL_DOMAIN_VECTOR
General Domain of Vectors.
Definition: mknn_domain.hpp:47
static Domain newClone(Domain domain)
Duplicates a domain.
Definition: mevaluation_answers.hpp:18
Different Loaders.
Definition: mknn_dataset_loader.hpp:105
std::string getGeneralDomain()
Returns the general domain of the given domain object.
static const std::string GENERAL_DOMAIN_STRING
General Domain of Strings.
Definition: mknn_domain.hpp:40
static const std::string GENERAL_DOMAIN_CUSTOMOBJECT
General Domain of Custom Objects.
Definition: mknn_domain.hpp:59
long long getVectorSizeInBytes()
Returns total size in bytes for one vector, which corresponds to dimensions * sizeof(datatype), where the size of a datatype is given by Datatype::getNumBytes.
std::string getVectorDimensionDataType()
Returns the dimension datatype of the vectors.
The Distance is the object with the definition of the method for comparing objects.
Definition: mknn_distance.hpp:59
Domain & getMultiobjectSubDomain(long long num_subdomain)
The domain of each object in the multi-object.
virtual ~Domain()
Default destructor.
static bool testEqualExceptDatatype(Domain &domain1, Domain &domain2)
Two domains are equalExceptDatatype if they coincide in their general domains and all their attribute...
static Domain newMultiobject(const std::vector< Domain > &subdomains)
Creates a new domain object that represents a multi-object, i.e., the combination of many objects in ...
std::string toString()
Creates a text representation of the domain and its attributes.
long long getVectorNumDimensions()
Returns the number of dimensions of the vectors.
bool isGeneralDomainVector()
Returns true if the general domain is vector.
A domain represents the type of object that are contained in a dataset.
Definition: mknn_domain.hpp:33
Powered by Download MetricKnn