Public Member Functions | List of all members
Xapian::LatLongMetric Class Referenceabstract

Base class for calculating distances between two lat/long coordinates. More...

+ Inheritance diagram for Xapian::LatLongMetric:

Public Member Functions

virtual ~LatLongMetric ()
 Destructor.
 
virtual double pointwise_distance (const LatLongCoord &a, const LatLongCoord &b) const =0
 Return the distance between two coordinates, in metres.
 
double operator() (const LatLongCoords &a, const LatLongCoords &b) const
 Return the distance between two coordinate lists, in metres. More...
 
double operator() (const LatLongCoords &a, const std::string &b) const
 Return the distance between two coordinate lists, in metres. More...
 
double operator() (const LatLongCoords &a, const char *b_ptr, size_t b_len) const
 Return the distance between two coordinate lists, in metres. More...
 
virtual LatLongMetricclone () const =0
 Clone the metric. More...
 
virtual std::string name () const =0
 Return the full name of the metric. More...
 
virtual std::string serialise () const =0
 Serialise object parameters into a string. More...
 
virtual LatLongMetricunserialise (const std::string &serialised) const =0
 Create object given string serialisation returned by serialise(). More...
 

Detailed Description

Base class for calculating distances between two lat/long coordinates.

Experimental - see https://xapian.org/docs/deprecation#experimental-features

Member Function Documentation

virtual LatLongMetric* Xapian::LatLongMetric::clone ( ) const
pure virtual

Clone the metric.

Implemented in Xapian::GreatCircleMetric.

virtual std::string Xapian::LatLongMetric::name ( ) const
pure virtual

Return the full name of the metric.

This is used when serialising and unserialising metrics; for example, for performing remote searches.

If the subclass is in a C++ namespace, the namespace should be included in the name, using "::" as a separator. For example, for a LatLongMetric subclass called "FooLatLongMetric" in the "Xapian" namespace the result of this call should be "Xapian::FooLatLongMetric".

Implemented in Xapian::GreatCircleMetric.

double Xapian::LatLongMetric::operator() ( const LatLongCoords a,
const LatLongCoords b 
) const

Return the distance between two coordinate lists, in metres.

The distance between the coordinate lists is defined to be the minimum pairwise distance between coordinates in the lists.

Exceptions
InvalidArgumentErroreither of the lists is empty.
Parameters
aThe first coordinate list.
bThe second coordinate list.
double Xapian::LatLongMetric::operator() ( const LatLongCoords a,
const std::string &  b 
) const
inline

Return the distance between two coordinate lists, in metres.

One of the coordinate lists is supplied in serialised form.

The distance between the coordinate lists is defined to be the minimum pairwise distance between coordinates in the lists.

Exceptions
InvalidArgumentErroreither of the lists is empty.
Parameters
aThe first coordinate list.
bThe second coordinate list, in serialised form.

References Xapian::LatLongCoords::size().

double Xapian::LatLongMetric::operator() ( const LatLongCoords a,
const char *  b_ptr,
size_t  b_len 
) const

Return the distance between two coordinate lists, in metres.

One of the coordinate lists is supplied in serialised form.

The distance between the coordinate lists is defined to be the minimum pairwise distance between coordinates in the lists.

Exceptions
InvalidArgumentErroreither of the lists is empty.
Parameters
aThe first coordinate list.
b_ptrThe start of the serialised form of the second coordinate list.
b_lenThe length of the serialised form of the second coordinate list.
virtual std::string Xapian::LatLongMetric::serialise ( ) const
pure virtual

Serialise object parameters into a string.

The serialised parameters should represent the configuration of the metric.

Implemented in Xapian::GreatCircleMetric.

virtual LatLongMetric* Xapian::LatLongMetric::unserialise ( const std::string &  serialised) const
pure virtual

Create object given string serialisation returned by serialise().

Parameters
serialisedA serialised instance of this LatLongMetric subclass.

Implemented in Xapian::GreatCircleMetric.


The documentation for this class was generated from the following file:

Documentation for Xapian (version 1.4.0).
Generated on Wed Oct 12 2016 by Doxygen 1.8.11.