ProgClient Class Reference

Implementation of RemoteDatabase using a spawned server. More...

#include <progclient.h>

Inheritance diagram for ProgClient:

Inheritance graph
[legend]
Collaboration diagram for ProgClient:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ProgClient (const std::string &progname, const std::string &arg, int msecs_timeout, bool writable)
 Constructor.
 ~ProgClient ()
 Destructor.

Private Member Functions

void operator= (const ProgClient &)
 Don't allow assignment.
 ProgClient (const ProgClient &)
 Don't allow copying.

Static Private Member Functions

static int run_program (const std::string &progname, const std::string &args, pid_t &pid)
 Start the child process.
static std::string get_progcontext (const std::string &progname, const std::string &args)
 Generate context string for Xapian::Error exception objects.

Private Attributes

pid_t pid
 Process id of the child process.

Detailed Description

Implementation of RemoteDatabase using a spawned server.

ProgClient spawns a child process to connect to the server - for example, an ssh command to run the server on a remote host. Communication with the child process is via a pipe.

Definition at line 34 of file progclient.h.


Constructor & Destructor Documentation

ProgClient::ProgClient ( const ProgClient  )  [private]

Don't allow copying.

ProgClient::ProgClient ( const std::string &  progname,
const std::string &  arg,
int  msecs_timeout,
bool  writable 
)

Constructor.

Parameters:
progname The program used to create the connection.
args Any arguments to the program.
msecs_timeout Timeout for communication (in milliseconds).
writable Is this a WritableDatabase?

ProgClient::~ProgClient (  ) 

Destructor.

Definition at line 239 of file progclient.cc.

References RemoteDatabase::do_close(), and pid.


Member Function Documentation

void ProgClient::operator= ( const ProgClient  )  [private]

Don't allow assignment.

static int ProgClient::run_program ( const std::string &  progname,
const std::string &  args,
pid_t &  pid 
) [static, private]

Start the child process.

Parameters:
progname The program used to create the connection.
args Any arguments to the program.
pid Reference to store the pid of the child process in.
Returns:
filedescriptor for reading from/writing to the child process.
Note: this method is called early on during class construction before any member variables or even the base class have been initialised. To help avoid accidentally trying to use member variables, this method has been deliberately made "static".

static std::string ProgClient::get_progcontext ( const std::string &  progname,
const std::string &  args 
) [static, private]

Generate context string for Xapian::Error exception objects.

Parameters:
progname The program used to create the connection.
args Any arguments to the program.
Note: this method is used from constructors so has been made static to avoid problems with trying to use uninitialised member variables. In particular, it can't be made a virtual method of the base class.


Member Data Documentation

pid_t ProgClient::pid [private]

Process id of the child process.

Definition at line 43 of file progclient.h.

Referenced by ~ProgClient().


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.