MyPostingSource2 Class Reference

Inheritance diagram for MyPostingSource2:

Inheritance graph
[legend]
Collaboration diagram for MyPostingSource2:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MyPostingSource2 (const std::string &desc_)
MyPostingSource2clone () const
 Clone the posting source.
std::string name () const
 Name of the posting source class.
std::string serialise () const
 Serialise object parameters into a string.
MyPostingSource2unserialise (const std::string &s) const
 Create object given string serialisation returned by serialise().
Xapian::weight get_weight () const
 Return the weight contribution for the current document.
std::string get_description () const
 Return a string describing this object.

Private Attributes

std::string desc


Detailed Description

Definition at line 239 of file api_serialise.cc.


Constructor & Destructor Documentation

MyPostingSource2::MyPostingSource2 ( const std::string &  desc_  )  [inline]

Definition at line 242 of file api_serialise.cc.

Referenced by clone(), and unserialise().


Member Function Documentation

MyPostingSource2* MyPostingSource2::clone (  )  const [inline, virtual]

Clone the posting source.

The clone should inherit the configuration of the parent, but need not inherit the state. ie, the clone does not need to be in the same iteration position as the original: the matcher will always call init() on the clone before attempting to move the iterator, or read the information about the current position of the iterator.

This may return NULL to indicate that cloning is not supported. In this case, the PostingSource may only be used with a single-database search.

The default implementation returns NULL.

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: http://trac.xapian.org/ticket/554#comment:1

Reimplemented from Xapian::PostingSource.

Definition at line 247 of file api_serialise.cc.

References desc, and MyPostingSource2().

std::string MyPostingSource2::get_description (  )  const [inline, virtual]

Return a string describing this object.

This default implementation returns a generic answer. This default it provided to avoid forcing those deriving their own PostingSource subclass from having to implement this (they may not care what get_description() gives for their subclass).

Reimplemented from Xapian::PostingSource.

Definition at line 266 of file api_serialise.cc.

References desc.

Xapian::weight MyPostingSource2::get_weight (  )  const [inline, virtual]

Return the weight contribution for the current document.

This default implementation always returns 0, for convenience when implementing "weight-less" PostingSource subclasses.

This method may assume that it will only be called when there is a "current document". In detail: Xapian will always call init() on a PostingSource before calling this for the first time. It will also only call this if the PostingSource reports that it is pointing to a valid document (ie, it will not call it before calling at least one of next(), skip_to() or check(), and will ensure that the PostingSource is not at the end by calling at_end()).

Reimplemented from Xapian::PostingSource.

Definition at line 264 of file api_serialise.cc.

std::string MyPostingSource2::name (  )  const [inline, virtual]

Name of the posting source class.

This is used when serialising and unserialising posting sources; 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 PostingSource subclass called "FooPostingSource" in the "Xapian" namespace the result of this call should be "Xapian::FooPostingSource".

This should only be implemented if serialise() and unserialise() are also implemented. The default implementation returns an empty string.

If this returns an empty string, Xapian will assume that serialise() and unserialise() are not implemented.

Reimplemented from Xapian::PostingSource.

Definition at line 252 of file api_serialise.cc.

std::string MyPostingSource2::serialise (  )  const [inline, virtual]

Serialise object parameters into a string.

The serialised parameters should represent the configuration of the posting source, but need not (indeed, should not) represent the current iteration state.

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

Reimplemented from Xapian::PostingSource.

Definition at line 256 of file api_serialise.cc.

References desc.

MyPostingSource2* MyPostingSource2::unserialise ( const std::string &  s  )  const [inline, virtual]

Create object given string serialisation returned by serialise().

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: http://trac.xapian.org/ticket/554#comment:1

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

Parameters:
s A serialised instance of this PostingSource subclass.

Reimplemented from Xapian::PostingSource.

Definition at line 260 of file api_serialise.cc.

References MyPostingSource2().


Member Data Documentation

std::string MyPostingSource2::desc [private]

Definition at line 240 of file api_serialise.cc.

Referenced by clone(), get_description(), and serialise().


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

Documentation for Xapian (version 1.2.9).
Generated on 10 May 2012 by Doxygen 1.5.9.