xapian-core  2.0.0
Classes | Public Member Functions | Private Attributes | List of all members
Xapian::Registry Class Reference

Registry for user subclasses. More...

#include <registry.h>

+ Collaboration diagram for Xapian::Registry:

Classes

class  Internal
 

Public Member Functions

 Registry (const Registry &other)
 Copy constructor. More...
 
Registryoperator= (const Registry &other)
 Assignment operator. More...
 
 Registry (Registry &&other)
 Move constructor. More...
 
Registryoperator= (Registry &&other)
 Move assignment operator. More...
 
 Registry ()
 Default constructor. More...
 
 ~Registry ()
 
void register_weighting_scheme (const Xapian::Weight &wt)
 Register a weighting scheme. More...
 
const Xapian::Weightget_weighting_scheme (std::string_view name) const
 Get the weighting scheme given a name. More...
 
void register_posting_source (const Xapian::PostingSource &source)
 Register a user-defined posting source class. More...
 
const Xapian::PostingSourceget_posting_source (std::string_view name) const
 Get a posting source given a name. More...
 
void register_match_spy (const Xapian::MatchSpy &spy)
 Register a user-defined match spy class. More...
 
const Xapian::MatchSpyget_match_spy (std::string_view name) const
 Get a match spy given a name. More...
 
void register_lat_long_metric (const Xapian::LatLongMetric &metric)
 Register a user-defined lat-long metric class. More...
 
const Xapian::LatLongMetricget_lat_long_metric (std::string_view name) const
 Get a lat-long metric given a name. More...
 
void register_key_maker (Xapian::KeyMaker *keymaker)
 Register a user-defined KeyMaker subclass. More...
 
const Xapian::KeyMakerget_key_maker (std::string_view name) const
 Get a KeyMaker given a name. More...
 

Private Attributes

Xapian::Internal::intrusive_ptr_nonnull< Internalinternal
 

Detailed Description

Registry for user subclasses.

This class provides a way for the remote server to look up user subclasses when unserialising.

Definition at line 47 of file registry.h.

Constructor & Destructor Documentation

◆ Registry() [1/3]

Xapian::Registry::Registry ( const Registry other)

Copy constructor.

The internals are reference counted, so copying is cheap.

Parameters
otherThe object to copy.

Definition at line 274 of file registry.cc.

References LOGCALL_CTOR.

◆ Registry() [2/3]

Xapian::Registry::Registry ( Registry &&  other)
default

Move constructor.

Parameters
otherThe object to move.

◆ Registry() [3/3]

Xapian::Registry::Registry ( )

Default constructor.

The registry will contain all standard subclasses of user-subclassable classes.

Definition at line 293 of file registry.cc.

References LOGCALL_CTOR.

◆ ~Registry()

Xapian::Registry::~Registry ( )

Definition at line 299 of file registry.cc.

References LOGCALL_DTOR.

Member Function Documentation

◆ get_key_maker()

const Xapian::KeyMaker * Xapian::Registry::get_key_maker ( std::string_view  name) const

Get a KeyMaker given a name.

Parameters
nameThe name of the KeyMaker to find.
Returns
An object with the requested name, or NULL if the KeyMaker could not be found. The returned object must not be deleted by the caller.
Since
Added in Xapian 2.0.0.

Definition at line 373 of file registry.cc.

References internal, Xapian::Registry::Internal::key_makers, LOGCALL, lookup_object(), and RETURN.

Referenced by RemoteServer::msg_query().

◆ get_lat_long_metric()

const Xapian::LatLongMetric * Xapian::Registry::get_lat_long_metric ( std::string_view  name) const

Get a lat-long metric given a name.

The returned metric is owned by the registry object.

Returns NULL if the metric could not be found.

Definition at line 359 of file registry.cc.

References internal, Xapian::Registry::Internal::lat_long_metrics, LOGCALL, lookup_object(), and RETURN.

Referenced by DEFINE_TESTCASE(), and Xapian::LatLongDistancePostingSource::unserialise_with_registry().

◆ get_match_spy()

const Xapian::MatchSpy * Xapian::Registry::get_match_spy ( std::string_view  name) const

Get a match spy given a name.

Parameters
nameThe name of the match spy to find.
Returns
An object with the requested name, or NULL if the match spy could not be found. The returned object is owned by the registry and so must not be deleted by the caller.

Definition at line 345 of file registry.cc.

References internal, LOGCALL, lookup_object(), Xapian::Registry::Internal::matchspies, and RETURN.

Referenced by DEFINE_TESTCASE(), and RemoteServer::msg_query().

◆ get_posting_source()

const Xapian::PostingSource * Xapian::Registry::get_posting_source ( std::string_view  name) const

Get a posting source given a name.

Parameters
nameThe name of the posting source to find.
Returns
An object with the requested name, or NULL if the posting source could not be found. The returned object is owned by the registry and so must not be deleted by the caller.

Definition at line 331 of file registry.cc.

References internal, LOGCALL, lookup_object(), Xapian::Registry::Internal::postingsources, and RETURN.

Referenced by DEFINE_TESTCASE(), and Xapian::Query::Internal::unserialise().

◆ get_weighting_scheme()

const Xapian::Weight * Xapian::Registry::get_weighting_scheme ( std::string_view  name) const

Get the weighting scheme given a name.

Parameters
nameThe name of the weighting scheme to find.
Returns
An object with the requested name, or NULL if the weighting scheme could not be found. The returned object is owned by the registry and so must not be deleted by the caller.

Definition at line 317 of file registry.cc.

References internal, LOGCALL, lookup_object(), RETURN, and Xapian::Registry::Internal::wtschemes.

Referenced by Xapian::Weight::create(), DEFINE_TESTCASE(), and RemoteServer::msg_query().

◆ operator=() [1/2]

Registry & Xapian::Registry::operator= ( const Registry other)

Assignment operator.

The internals are reference counted, so assignment is cheap.

Parameters
otherThe object to copy.

Definition at line 281 of file registry.cc.

References internal, LOGCALL, and RETURN.

◆ operator=() [2/2]

Registry & Xapian::Registry::operator= ( Registry &&  other)
default

Move assignment operator.

Parameters
otherThe object to move.

◆ register_key_maker()

void Xapian::Registry::register_key_maker ( Xapian::KeyMaker keymaker)

Register a user-defined KeyMaker subclass.

Parameters
keymakerThe KeyMaker subclass to register. The clean up of this object is handled via Xapian's optional reference counting. The simplest way to do so is to allocate it with new and call release() on it before passing it to this method to tell Xapian to manage its lifetime. The alternative approach is for the caller to ensure the KeyMaker object remains valid for the lifetime of the Registry object.
Since
Added in Xapian 2.0.0.

Definition at line 366 of file registry.cc.

References internal, Xapian::Registry::Internal::key_makers, LOGCALL_VOID, Xapian::KeyMaker::name(), and register_object().

◆ register_lat_long_metric()

void Xapian::Registry::register_lat_long_metric ( const Xapian::LatLongMetric metric)

Register a user-defined lat-long metric class.

Definition at line 352 of file registry.cc.

References internal, Xapian::Registry::Internal::lat_long_metrics, LOGCALL_VOID, Xapian::LatLongMetric::name(), and register_object().

◆ register_match_spy()

void Xapian::Registry::register_match_spy ( const Xapian::MatchSpy spy)

Register a user-defined match spy class.

Parameters
spyThe match spy to register.

Definition at line 338 of file registry.cc.

References internal, LOGCALL_VOID, Xapian::Registry::Internal::matchspies, Xapian::MatchSpy::name(), and register_object().

Referenced by DEFINE_TESTCASE().

◆ register_posting_source()

void Xapian::Registry::register_posting_source ( const Xapian::PostingSource source)

Register a user-defined posting source class.

Parameters
sourceThe posting source to register.

Definition at line 324 of file registry.cc.

References internal, LOGCALL_VOID, Xapian::PostingSource::name(), Xapian::Registry::Internal::postingsources, and register_object().

Referenced by DEFINE_TESTCASE().

◆ register_weighting_scheme()

void Xapian::Registry::register_weighting_scheme ( const Xapian::Weight wt)

Register a weighting scheme.

Parameters
wtThe weighting scheme to register.

Definition at line 310 of file registry.cc.

References internal, LOGCALL_VOID, Xapian::Weight::name(), register_object(), and Xapian::Registry::Internal::wtschemes.

Referenced by DEFINE_TESTCASE().

Member Data Documentation

◆ internal

Xapian::Internal::intrusive_ptr_nonnull<Internal> Xapian::Registry::internal
private

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