PLearn 0.1
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
PLearn::RemotePLearnServer Class Reference

#include <RemotePLearnServer.h>

Inheritance diagram for PLearn::RemotePLearnServer:
Inheritance graph
[legend]
Collaboration diagram for PLearn::RemotePLearnServer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void killServer ()
void newObject (int objid, const Object &model)
 Builds an object based on the given model on the remote server, assigning it the given id.
void newObject (int objid, PP< Object > model)
void newObject (int objid, const string &description)
 Builds an object on the remote server, from its description in serialised form.
int newObject (const Object &model)
 Builds an object based on the given model on the remote server, returns an assigned id.
int newObject (PP< Object > model)
int newObject (const string &description)
 Builds an object on the remote server, from its description in serialised form.
void newObjectAsync (int objid, const Object &model)
 Builds an object based on the given model on the remote server, assigning it the given id.
void newObjectAsync (int objid, PP< Object > model)
void newObjectAsync (int objid, const string &description)
 Builds an object on the remote server, from its description in serialised form.
void newObjectAsync (const Object &model)
 Builds an object based on the given model on the remote server, id is assigned by the server and returned.
void newObjectAsync (const PP< Object > &model)
void newObjectAsync (const string &description)
 Builds an object on the remote server, from its description in serialised form.
void deleteObject (int objid)
 Deletes an object of the remote server.
void deleteObjectAsync (int objid)
 Deletes an object of the remote server.
void deleteAllObjects ()
 Deletes all objects of the remote server.
void deleteAllObjectsAsync ()
 Deletes all objects of the remote server.
void clearMaps ()
void link (unsigned int objid, void *obj)
void unlink (unsigned int objid)
void unlink (void *obj)
void sendFunctionCallHeader (const string &function_name, int nargs)
 Users generally won't have to call this, but rather one of the callFunction methods.
void sendMethodCallHeader (int objid, const string &method_name, int nargs)
 Users generally won't have to call this, but rather one of the callMethod methods.
void expectResults (int nargs_expected)
 Users generally won't have to call this, but rather one of the getResults methods.
void callFunction (const string &name)
 call a method with 0 input arguments
template<class Arg1 >
void callFunction (const string &name, const Arg1 &arg1)
 call a method with 1 input argument
template<class Arg1 , class Arg2 >
void callFunction (const string &name, const Arg1 &arg1, const Arg2 &arg2)
 call a method with 2 input arguments
template<class Arg1 , class Arg2 , class Arg3 >
void callFunction (const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
 call a method with 3 input arguments
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 >
void callFunction (const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
 call a method with 4 input arguments
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 >
void callFunction (const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
 call a method with 5 input arguments
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 , class Arg6 >
void callFunction (const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5, const Arg6 &arg6)
 call a method with 6 input arguments
void callMethod (int objid, const string &name)
 call a method with 0 input arguments
template<class Arg1 >
void callMethod (int objid, const string &name, const Arg1 &arg1)
 call a method with 1 input argument
template<class Arg1 , class Arg2 >
void callMethod (int objid, const string &name, const Arg1 &arg1, const Arg2 &arg2)
 call a method with 2 input arguments
template<class Arg1 , class Arg2 , class Arg3 >
void callMethod (int objid, const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
 call a method with 3 input arguments
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 >
void callMethod (int objid, const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
 call a method with 4 input arguments
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 >
void callMethod (int objid, const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
 call a method with 5 input arguments
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 , class Arg6 >
void callMethod (int objid, const string &name, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5, const Arg6 &arg6)
 call a method with 6 input arguments
void getResults ()
 Waits for completion of method with no output results and checks its status.
template<class Arg1 >
void getResults (Arg1 &arg1)
 get results for a method with 1 output result These are the results for the just previously called method
template<class Arg1 , class Arg2 >
void getResults (Arg1 &arg1, Arg2 &arg2)
 get results for a method with 2 output results These are the results for the just previously called method
template<class Arg1 , class Arg2 , class Arg3 >
void getResults (Arg1 &arg1, Arg2 &arg2, Arg3 &arg3)
 get results for a method with 3 output results These are the results for the just previously called method
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 >
void getResults (Arg1 &arg1, Arg2 &arg2, Arg3 &arg3, Arg4 &arg4)
 get results for a method with 4 output results These are the results for the just previously called method
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 >
void getResults (Arg1 &arg1, Arg2 &arg2, Arg3 &arg3, Arg4 &arg4, Arg5 &arg5)
 get results for a method with 5 output results These are the results for the just previously called method
template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 , class Arg6 >
void getResults (Arg1 &arg1, Arg2 &arg2, Arg3 &arg3, Arg4 &arg4, Arg5 &arg5, Arg6 &arg6)
 get results for a method with 6 output results These are the results for the just previously called method
 ~RemotePLearnServer ()

Private Types

typedef map< unsigned int, void * > ObjMap
typedef map< void *, unsigned intReverseObjMap

Private Member Functions

 RemotePLearnServer (const PStream &serverio)

Private Attributes

PStream io
ObjMap objmap
ReverseObjMap rev_objmap

Friends

class PLearnService

Detailed Description

Definition at line 57 of file RemotePLearnServer.h.


Member Typedef Documentation

typedef map<unsigned int, void*> PLearn::RemotePLearnServer::ObjMap [private]

Definition at line 64 of file RemotePLearnServer.h.

typedef map<void*, unsigned int> PLearn::RemotePLearnServer::ReverseObjMap [private]

Definition at line 66 of file RemotePLearnServer.h.


Constructor & Destructor Documentation

PLearn::RemotePLearnServer::RemotePLearnServer ( const PStream serverio) [private]

Definition at line 52 of file RemotePLearnServer.cc.

References io, and PLearn::PStream::remote_plearn_comm.

    :io(serverio)
{
    io.remote_plearn_comm= true;
}
PLearn::RemotePLearnServer::~RemotePLearnServer ( )

Definition at line 255 of file RemotePLearnServer.cc.

References DBG_LOG, PLearn::endl(), io, and PLearn::PStream::remote_plearn_comm.

{
    // The PLearnService is responsible for most of RemotePLearnServer destruction 
    DBG_LOG << "ENTERING RemotePLearnServer destructor" << endl;
    io.remote_plearn_comm= false;
    DBG_LOG << "LEAVING RemotePLearnServer destructor" << endl;
}

Here is the call graph for this function:


Member Function Documentation

void PLearn::RemotePLearnServer::callFunction ( const string &  name) [inline]

call a method with 0 input arguments

Definition at line 148 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 0);
        io << endl;
    }

Here is the call graph for this function:

template<class Arg1 >
void PLearn::RemotePLearnServer::callFunction ( const string &  name,
const Arg1 &  arg1 
) [inline]

call a method with 1 input argument

Definition at line 155 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 1);
        io << arg1 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 >
void PLearn::RemotePLearnServer::callFunction ( const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2 
) [inline]

call a method with 2 input arguments

Definition at line 162 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 2);
        io << arg1 << arg2 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 >
void PLearn::RemotePLearnServer::callFunction ( const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3 
) [inline]

call a method with 3 input arguments

Definition at line 169 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 3);
        io << arg1 << arg2 << arg3 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 >
void PLearn::RemotePLearnServer::callFunction ( const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4 
) [inline]

call a method with 4 input arguments

Definition at line 176 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 4);
        io << arg1 << arg2 << arg3 << arg4 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 >
void PLearn::RemotePLearnServer::callFunction ( const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4,
const Arg5 &  arg5 
) [inline]

call a method with 5 input arguments

Definition at line 183 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 5);
        io << arg1 << arg2 << arg3 << arg4 << arg5 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 , class Arg6 >
void PLearn::RemotePLearnServer::callFunction ( const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4,
const Arg5 &  arg5,
const Arg6 &  arg6 
) [inline]

call a method with 6 input arguments

Definition at line 190 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendFunctionCallHeader().

    {
        sendFunctionCallHeader(name, 6);
        io << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << endl;
    }

Here is the call graph for this function:

void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name 
) [inline]

call a method with 0 input arguments

Definition at line 197 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

Referenced by PLearn::BaggingLearner::train().

    {
        sendMethodCallHeader(objid, name, 0);
        io << endl;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Arg1 >
void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name,
const Arg1 &  arg1 
) [inline]

call a method with 1 input argument

Definition at line 204 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

    {
        sendMethodCallHeader(objid, name, 1);
        io << arg1 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 >
void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2 
) [inline]

call a method with 2 input arguments

Definition at line 211 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

    {
        sendMethodCallHeader(objid, name, 2);
        io << arg1 << arg2 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 >
void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3 
) [inline]

call a method with 3 input arguments

Definition at line 218 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

    {
        sendMethodCallHeader(objid, name, 3);
        io << arg1 << arg2 << arg3 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 >
void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4 
) [inline]

call a method with 4 input arguments

Definition at line 225 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

    {
        sendMethodCallHeader(objid, name, 4);
        io << arg1 << arg2 << arg3 << arg4 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 >
void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4,
const Arg5 &  arg5 
) [inline]

call a method with 5 input arguments

Definition at line 232 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

    {
        sendMethodCallHeader(objid, name, 5);
        io << arg1 << arg2 << arg3 << arg4 << arg5 << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 , class Arg6 >
void PLearn::RemotePLearnServer::callMethod ( int  objid,
const string &  name,
const Arg1 &  arg1,
const Arg2 &  arg2,
const Arg3 &  arg3,
const Arg4 &  arg4,
const Arg5 &  arg5,
const Arg6 &  arg6 
) [inline]

call a method with 6 input arguments

Definition at line 239 of file RemotePLearnServer.h.

References PLearn::endl(), io, and sendMethodCallHeader().

    {
        sendMethodCallHeader(objid, name, 6);
        io << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << endl;
    }

Here is the call graph for this function:

void PLearn::RemotePLearnServer::clearMaps ( )

Definition at line 58 of file RemotePLearnServer.cc.

References PLearn::PStream::clearInOutMaps(), PLearn::PStream::copies_map_out, io, and objmap.

Referenced by newObject(), newObjectAsync(), sendFunctionCallHeader(), and sendMethodCallHeader().

{
    io.clearInOutMaps();
    // copy local object map to stream's out map
    for(ObjMap::iterator it= objmap.begin(); it != objmap.end(); ++it)
        io.copies_map_out[it->second]= it->first;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::deleteAllObjects ( )

Deletes all objects of the remote server.

Definition at line 202 of file RemotePLearnServer.cc.

References deleteAllObjectsAsync(), and getResults().

Here is the call graph for this function:

void PLearn::RemotePLearnServer::deleteAllObjectsAsync ( )

Deletes all objects of the remote server.

Definition at line 208 of file RemotePLearnServer.cc.

References DBG_LOG, PLearn::endl(), PLearn::PStream::good(), io, and PLearn::PStream::write().

Referenced by deleteAllObjects().

{
    if(io.good())
    {
        io.write("!Z "); 
        io << endl;
    }
    else
        DBG_LOG << "in RemotePLearnServer::deleteAllObjectsAsync() : stream not good." << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::deleteObject ( int  objid)

Deletes an object of the remote server.

Definition at line 191 of file RemotePLearnServer.cc.

References deleteObjectAsync(), and expectResults().

Here is the call graph for this function:

void PLearn::RemotePLearnServer::deleteObjectAsync ( int  objid)

Deletes an object of the remote server.

Definition at line 197 of file RemotePLearnServer.cc.

References PLearn::endl(), io, and PLearn::PStream::write().

Referenced by deleteObject().

{
    io.write("!D "); io << objid << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::expectResults ( int  nargs_expected)

Users generally won't have to call this, but rather one of the getResults methods.

Reads a 'R' (return) command (expecting to read 'R nargs_expected') If it gets a 'E' (error or exception command) it will thow a PLearnException. If the returned nargs differs from nargs_expected, it will also throw a PLearnException.

Definition at line 220 of file RemotePLearnServer.cc.

References PLearn::PStream::get(), PLearn::PLearnService::getId(), PLearn::PLearnService::instance(), io, PLERROR, PLearn::PStream::skipBlanksAndComments(), and PLearn::PLearnService::waitForResultFrom().

Referenced by deleteObject(), getResults(), and newObject().

{
    PLearnService& service= PLearnService::instance();
    service.waitForResultFrom(this);

    //DBG_LOG << "RemotePLearnServer entering expectResults" << endl;
    io.skipBlanksAndComments();
    int headchar = io.get();
    if(headchar!='!')
        PLERROR(" Answers from plearn server are expected to start with a !, but I received a %c",headchar);
    int command = io.get();
    //DBG_LOG << "RemotePLearnServer expectResults received command: " << (char)command << endl;
    int nreturned;
    string msg;
    switch(command)
    {
    case 'R':
        io >> nreturned;
        //DBG_LOG << "RemotePLearnServer expectResults nreturned= " << nreturned << endl;
        if(nreturned!=nargs_expected)
            PLERROR("RemotePLearnServer: expected %d return arguments, but read R %d",nargs_expected,nreturned);
        break;
    case 'E':
        io >> msg;
        {
            pair<string, int> id= PLearnService::getId(this);
            PLERROR("From server %s %d : %s", id.first.c_str(), id.second, 
                    msg.c_str());
        }
        break;
    default:
        PLERROR("RemotePLearnServer: expected R (return command), but read %c ????",command);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::getResults ( ) [inline]

Waits for completion of method with no output results and checks its status.

(This must be called for 0 output methods!).

Definition at line 247 of file RemotePLearnServer.h.

References expectResults().

Referenced by deleteAllObjects(), and newObject().

    { expectResults(0); };

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Arg1 >
void PLearn::RemotePLearnServer::getResults ( Arg1 &  arg1) [inline]

get results for a method with 1 output result These are the results for the just previously called method

Definition at line 253 of file RemotePLearnServer.h.

References expectResults(), and io.

    {
        expectResults(1);
        //DBG_LOG << "RemotePLearnServer getResults(Arg1& arg1)" << endl;
        io >> arg1;
        //DBG_LOG << "RemotePLearnServer getResults got arg1" << endl;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 >
void PLearn::RemotePLearnServer::getResults ( Arg1 &  arg1,
Arg2 &  arg2 
) [inline]

get results for a method with 2 output results These are the results for the just previously called method

Definition at line 263 of file RemotePLearnServer.h.

References expectResults(), and io.

    {
        expectResults(2);
        io >> arg1 >> arg2;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 >
void PLearn::RemotePLearnServer::getResults ( Arg1 &  arg1,
Arg2 &  arg2,
Arg3 &  arg3 
) [inline]

get results for a method with 3 output results These are the results for the just previously called method

Definition at line 271 of file RemotePLearnServer.h.

References expectResults(), and io.

    {
        expectResults(3);
        io >> arg1 >> arg2 >> arg3;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 >
void PLearn::RemotePLearnServer::getResults ( Arg1 &  arg1,
Arg2 &  arg2,
Arg3 &  arg3,
Arg4 &  arg4,
Arg5 &  arg5 
) [inline]

get results for a method with 5 output results These are the results for the just previously called method

Definition at line 287 of file RemotePLearnServer.h.

References expectResults(), and io.

    {
        expectResults(5);
        io >> arg1 >> arg2 >> arg3 >> arg4 >> arg5;
    }

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 , class Arg5 , class Arg6 >
void PLearn::RemotePLearnServer::getResults ( Arg1 &  arg1,
Arg2 &  arg2,
Arg3 &  arg3,
Arg4 &  arg4,
Arg5 &  arg5,
Arg6 &  arg6 
) [inline]

get results for a method with 6 output results These are the results for the just previously called method

Definition at line 295 of file RemotePLearnServer.h.

References expectResults(), and io.

    {
        expectResults(6);
        io >> arg1 >> arg2 >> arg3 >> arg4 >> arg5 >> arg6;
    }  

Here is the call graph for this function:

template<class Arg1 , class Arg2 , class Arg3 , class Arg4 >
void PLearn::RemotePLearnServer::getResults ( Arg1 &  arg1,
Arg2 &  arg2,
Arg3 &  arg3,
Arg4 &  arg4 
) [inline]

get results for a method with 4 output results These are the results for the just previously called method

Definition at line 279 of file RemotePLearnServer.h.

References expectResults(), and io.

    {
        expectResults(4);
        io >> arg1 >> arg2 >> arg3 >> arg4;
    }

Here is the call graph for this function:

void PLearn::RemotePLearnServer::killServer ( ) [inline]

Definition at line 71 of file RemotePLearnServer.h.

References PLearn::endl(), and io.

{ io << "!K " << endl; }

Here is the call graph for this function:

void PLearn::RemotePLearnServer::link ( unsigned int  objid,
void *  obj 
)

Definition at line 66 of file RemotePLearnServer.cc.

References PLearn::PStream::copies_map_out, DBG_LOG, PLearn::endl(), io, objmap, and rev_objmap.

{ 
    io.copies_map_out[obj]= objid;
    objmap[objid]= obj; 
    rev_objmap[obj]= objid;

    DBG_LOG << "copies map: " << objmap << endl;
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObject ( int  objid,
const string &  description 
)

Builds an object on the remote server, from its description in serialised form.

Definition at line 110 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), expectResults(), io, PLearn::PStream::put(), and PLearn::PStream::write().

{ 
    clearMaps();
    io.write("!N "); io << objid; io.put(' ');
    io.write(description);
    io << endl;
    expectResults(0);
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObject ( int  objid,
const Object model 
)

Builds an object based on the given model on the remote server, assigning it the given id.

Definition at line 96 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), expectResults(), io, and PLearn::PStream::write().

Referenced by newObject(), and PLearn::BaggingLearner::train().

{ 
    clearMaps();
    io.write("!N "); io << objid << model << endl;
    expectResults(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int PLearn::RemotePLearnServer::newObject ( const Object model)

Builds an object based on the given model on the remote server, returns an assigned id.

Definition at line 119 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), getResults(), io, and PLearn::PStream::write().

{ 
    clearMaps();
    io.write("!O "); io << model << endl;
    int objid;
    getResults(objid);
    return objid;
}

Here is the call graph for this function:

int PLearn::RemotePLearnServer::newObject ( const string &  description)

Builds an object on the remote server, from its description in serialised form.

Definition at line 135 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), getResults(), io, and PLearn::PStream::write().

{ 
    clearMaps();
    io.write("!O "); 
    io.write(description);
    io << endl;
    int objid;
    getResults(objid);
    return objid;
}

Here is the call graph for this function:

int PLearn::RemotePLearnServer::newObject ( PP< Object model)

Definition at line 128 of file RemotePLearnServer.cc.

References PLearn::PP< T >::isNull(), newObject(), and PLERROR.

{
    if(model.isNull())
        PLERROR("In RemotePLearnServer::newObject model is a Null pointer");
    return newObject(*model);
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObject ( int  objid,
PP< Object model 
)

Definition at line 103 of file RemotePLearnServer.cc.

References PLearn::PP< T >::isNull(), newObject(), and PLERROR.

{
    if(model.isNull())
        PLERROR("In RemotePLearnServer::newObject model is a Null pointer");
    newObject(objid, *model);
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObjectAsync ( const PP< Object > &  model)

Definition at line 174 of file RemotePLearnServer.cc.

References PLearn::PP< T >::isNull(), newObjectAsync(), and PLERROR.

{
    if(model.isNull())
        PLERROR("In RemotePLearnServer::newObject model is a Null pointer");
    newObjectAsync(*model);
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObjectAsync ( int  objid,
const string &  description 
)

Builds an object on the remote server, from its description in serialised form.

Definition at line 160 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), io, PLearn::PStream::put(), and PLearn::PStream::write().

{ 
    clearMaps();
    io.write("!N "); io << objid; io.put(' ');
    io.write(description);
    io << endl;
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObjectAsync ( int  objid,
PP< Object model 
)

Definition at line 153 of file RemotePLearnServer.cc.

References PLearn::PP< T >::isNull(), newObjectAsync(), and PLERROR.

{
    if(model.isNull())
        PLERROR("In RemotePLearnServer::newObject model is a Null pointer");
    newObjectAsync(objid, *model);
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObjectAsync ( int  objid,
const Object model 
)

Builds an object based on the given model on the remote server, assigning it the given id.

Definition at line 147 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), io, and PLearn::PStream::write().

Referenced by newObjectAsync().

{ 
    clearMaps();
    io.write("!N "); io << objid << model << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::newObjectAsync ( const string &  description)

Builds an object on the remote server, from its description in serialised form.

Definition at line 181 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), io, and PLearn::PStream::write().

{ 
    clearMaps();
    io.write("!O "); 
    io.write(description);
    io << endl;
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::newObjectAsync ( const Object model)

Builds an object based on the given model on the remote server, id is assigned by the server and returned.

Definition at line 168 of file RemotePLearnServer.cc.

References clearMaps(), PLearn::endl(), io, and PLearn::PStream::write().

{ 
    clearMaps();
    io.write("!O "); io << model << endl;
}

Here is the call graph for this function:

void PLearn::RemotePLearnServer::sendFunctionCallHeader ( const string &  function_name,
int  nargs 
) [inline]

Users generally won't have to call this, but rather one of the callFunction methods.

Definition at line 127 of file RemotePLearnServer.h.

References clearMaps(), io, and PLearn::PStream::write().

Referenced by callFunction().

    { 
        clearMaps();
        io.write("!F "); io << function_name << nargs; 
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::sendMethodCallHeader ( int  objid,
const string &  method_name,
int  nargs 
) [inline]

Users generally won't have to call this, but rather one of the callMethod methods.

Definition at line 134 of file RemotePLearnServer.h.

References clearMaps(), io, and PLearn::PStream::write().

Referenced by callMethod().

    { 
        clearMaps();
        io.write("!M "); io << objid << method_name << nargs; 
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::RemotePLearnServer::unlink ( void *  obj)

Definition at line 85 of file RemotePLearnServer.cc.

References PLearn::PStream::copies_map_out, io, objmap, PLERROR, and rev_objmap.

{ 
    ReverseObjMap::iterator it= rev_objmap.find(obj);
    if(it == rev_objmap.end())
        PLERROR("in RemotePLearnServer::unlink : cannot unlink an object which is not linked");
    rev_objmap.erase(it);
    objmap.erase(it->second);
    io.copies_map_out.erase(obj);
}
void PLearn::RemotePLearnServer::unlink ( unsigned int  objid)

Definition at line 75 of file RemotePLearnServer.cc.

References PLearn::PStream::copies_map_out, io, objmap, PLERROR, and rev_objmap.

{ 
    ObjMap::iterator it= objmap.find(objid);
    if(it == objmap.end())
        PLERROR("in RemotePLearnServer::unlink : cannot unlink an object which is not linked");
    objmap.erase(it);
    rev_objmap.erase(it->second);
    io.copies_map_out.erase(it->second);
}

Friends And Related Function Documentation

friend class PLearnService [friend]

Definition at line 60 of file RemotePLearnServer.h.


Member Data Documentation

Definition at line 65 of file RemotePLearnServer.h.

Referenced by clearMaps(), link(), and unlink().

Definition at line 67 of file RemotePLearnServer.h.

Referenced by link(), and unlink().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines