xapian-core  2.0.0
Public Member Functions | Private Member Functions | List of all members
Xapian::KeyMaker Class Referenceabstract

Virtual base class for key making functors. More...

#include <keymaker.h>

+ Inheritance diagram for Xapian::KeyMaker:
+ Collaboration diagram for Xapian::KeyMaker:

Public Member Functions

 KeyMaker ()
 Default constructor. More...
 
virtual std::string operator() (const Xapian::Document &doc) const =0
 Build a key string for a Document. More...
 
virtual ~KeyMaker ()
 Virtual destructor, because we have virtual methods. More...
 
virtual std::string name () const
 Return the name of this KeyMaker. More...
 
virtual std::string serialise () const
 Return this object's parameters serialised as a single string. More...
 
virtual KeyMakerunserialise (const std::string &serialised, const Registry &context) const
 Unserialise parameters. More...
 
KeyMakerrelease ()
 Start reference counting this object. More...
 
const KeyMakerrelease () const
 Start reference counting this object. More...
 
- Public Member Functions inherited from Xapian::Internal::opt_intrusive_base
 opt_intrusive_base (const opt_intrusive_base &)
 
opt_intrusive_baseoperator= (const opt_intrusive_base &)
 
 opt_intrusive_base ()
 Construct object which is initially not reference counted. More...
 
virtual ~opt_intrusive_base ()
 
void ref () const
 
void unref () const
 

Private Member Functions

void operator= (const KeyMaker &)=delete
 Don't allow assignment. More...
 
 KeyMaker (const KeyMaker &)=delete
 Don't allow copying. More...
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::opt_intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base
void release () const
 Start reference counting. More...
 

Detailed Description

Virtual base class for key making functors.

Definition at line 43 of file keymaker.h.

Constructor & Destructor Documentation

◆ KeyMaker() [1/2]

Xapian::KeyMaker::KeyMaker ( const KeyMaker )
privatedelete

Don't allow copying.

◆ KeyMaker() [2/2]

Xapian::KeyMaker::KeyMaker ( )
inline

Default constructor.

Definition at line 53 of file keymaker.h.

◆ ~KeyMaker()

Xapian::KeyMaker::~KeyMaker ( )
virtual

Virtual destructor, because we have virtual methods.

Definition at line 38 of file keymaker.cc.

Member Function Documentation

◆ name()

string Xapian::KeyMaker::name ( ) const
virtual

Return the name of this KeyMaker.

This name is used by the remote backend. It is passed with the serialised parameters to the remote server so that it knows which class to create.

Return the full namespace-qualified name of your class here - if your class is called MyApp::FooKeyMaker, return "MyApp::FooKeyMaker" from this method.

If you don't want to support the remote backend in your KeyMaker, you can use the default implementation which simply throws Xapian::UnimplementedError.

Reimplemented in Xapian::MultiValueKeyMaker.

Definition at line 48 of file keymaker.cc.

References Xapian::throw_unimplemented().

Referenced by Xapian::Registry::Internal::add_defaults(), Xapian::Registry::register_key_maker(), and RemoteDatabase::send_global_stats().

◆ operator()()

virtual std::string Xapian::KeyMaker::operator() ( const Xapian::Document doc) const
pure virtual

Build a key string for a Document.

These keys can be used for sorting or collapsing matching documents.

Parameters
docDocument object to build a key for.

Implemented in Xapian::MultiValueKeyMaker, Xapian::LatLongDistanceKeyMaker, NeverUseMeKeyMaker, and TestKeyMaker.

◆ operator=()

void Xapian::KeyMaker::operator= ( const KeyMaker )
privatedelete

Don't allow assignment.

◆ release() [1/2]

KeyMaker* Xapian::KeyMaker::release ( )
inline

Start reference counting this object.

You can transfer ownership of a dynamically allocated KeyMaker object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.

Definition at line 123 of file keymaker.h.

Referenced by Xapian::Registry::Internal::add_defaults(), and DEFINE_TESTCASE().

◆ release() [2/2]

const KeyMaker* Xapian::KeyMaker::release ( ) const
inline

Start reference counting this object.

You can transfer ownership of a dynamically allocated KeyMaker object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.

Definition at line 135 of file keymaker.h.

◆ serialise()

string Xapian::KeyMaker::serialise ( ) const
virtual

Return this object's parameters serialised as a single string.

If there are no parameters, just return an empty string.

If you don't want to support the remote backend in your KeyMaker, you can use the default implementation which simply throws Xapian::UnimplementedError.

Reimplemented in Xapian::MultiValueKeyMaker.

Definition at line 55 of file keymaker.cc.

References Xapian::throw_unimplemented().

Referenced by RemoteDatabase::send_global_stats().

◆ unserialise()

KeyMaker * Xapian::KeyMaker::unserialise ( const std::string &  serialised,
const Registry context 
) const
virtual

Unserialise parameters.

This method unserialises parameters serialised by the serialise() method and allocates and returns a new object initialised with them.

If you don't want to support the remote backend in your KeyMaker, you can use the default implementation which simply throws Xapian::UnimplementedError.

Note that the returned object will be deallocated by Xapian after use with "delete". If you want to handle the deletion in a special way (for example when wrapping the Xapian API for use from another language) then you can define a static operator delete method in your subclass as shown here: https://trac.xapian.org/ticket/554#comment:1

Parameters
serialisedA string containing the serialised results.
contextRegistry object to use for unserialisation to permit KeyMaker subclasses with sub-KeyMaker objects to be implemented.

Reimplemented in Xapian::MultiValueKeyMaker.

Definition at line 62 of file keymaker.cc.

References Xapian::throw_unimplemented().

Referenced by RemoteServer::msg_query().


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