PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Private Types | Private Member Functions
PLearn::RPPath Class Reference

#include <RPPath.h>

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

List of all members.

Public Member Functions

 RPPath ()
 Default constructor.
PP< RPPathabsolute ()
 Return the RPPath object that represents the same path, but in its absolute form.
string canonical ()
 Forwarded to the underlying PPath.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual RPPathdeepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.

Static Public Member Functions

static string _classname_ ()
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Public Attributes

PPath path

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.
static void declareMethods (RemoteMethodMap &rmm)
 Declare methods that are intended to be remote-callable.

Private Types

typedef Object inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 48 of file RPPath.h.


Member Typedef Documentation

typedef Object PLearn::RPPath::inherited [private]

Reimplemented from PLearn::Object.

Definition at line 50 of file RPPath.h.


Constructor & Destructor Documentation

PLearn::RPPath::RPPath ( )

Default constructor.

Definition at line 59 of file RPPath.cc.

{}

Member Function Documentation

string PLearn::RPPath::_classname_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

OptionList & PLearn::RPPath::_getOptionList_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

RemoteMethodMap & PLearn::RPPath::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

bool PLearn::RPPath::_isa_ ( const Object o) [static]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

Object * PLearn::RPPath::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

StaticInitializer RPPath::_static_initializer_ & PLearn::RPPath::_static_initialize_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

PP< RPPath > PLearn::RPPath::absolute ( )

Return the RPPath object that represents the same path, but in its absolute form.

Definition at line 107 of file RPPath.cc.

Referenced by declareMethods().

{
    PP<RPPath> abs_path = new RPPath();
    abs_path->path = path.absolute();
    abs_path->build();
    return abs_path;
}

Here is the caller graph for this function:

void PLearn::RPPath::build ( ) [virtual]

Post-constructor.

The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::Object.

Definition at line 92 of file RPPath.cc.

void PLearn::RPPath::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::Object.

Definition at line 101 of file RPPath.cc.

{}
string PLearn::RPPath::canonical ( )

Forwarded to the underlying PPath.

Definition at line 118 of file RPPath.cc.

Referenced by declareMethods().

{
    return path.canonical();
}

Here is the caller graph for this function:

string PLearn::RPPath::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

void PLearn::RPPath::declareMethods ( RemoteMethodMap rmm) [static, protected]

Declare methods that are intended to be remote-callable.

If you use this mechanism, you don't usually need to override the call method in derived classes. The typical form of this method is as follows:

  static void MyDerivedClass::declareMethods(RemoteMethodMap& rmm)
  {
      // Insert a backpointer to inherited methods; note that this
      // mechanism is different from that of declareOptions()
      rmm.inherited(inherited::_getRemoteMethodMap_());

      // Mind the extra pair of parenthesis around the docstrings.
      // They are necessary for proper construction of documentation.
      declareMethod(rmm, "method1", &MyDerivedClass::method1,
                    (BodyDoc("Main documentation for the method"),
                     ArgDoc ("arg1_name", "Documentation for argument1"),
                     ArgDoc ("arg2_name", "Documentation for argument2"),
                     // ... other ArgDoc here ...
                     RetDoc ("Documentation for the return value")));

      // Other calls to declareMethod() as appropriate to expose the
      // public remote-callable interface
  }

IMPORTANT REMARKS:

The types of methods that can be directly declared in this manner is restricted to methods that don't have any "result-arguments" (and are either void, or *return* their result). But in C/C++ it is customary to implement "multiple results" by passing them as "result-arguments" to the call. You can't use declareMethod on such a method: you'll first have to write a wrapper method of the correct form that you can declare with declareMethod. To *return* multiple results, you should actually return a *tuple*.

Ex: if you have a method of class PLearner with 2 "result arguments" like:

  virtual void computeOutputAndCosts(const Vec& input, const Vec& target,
                                     Vec& output, Vec& costs) const;

you can't declare it directly with declareMethod, so you'll have to write a wrapper-method that you can declare, like the following:

  tuple<Vec,Vec> PLearner::remote_computeOutputAndCosts(const Vec& input, 
                                                        const Vec& target) const
  {
    Vec output;
    Vec costs;
    computeOutputAndCosts(input,target,output,costs);
    return make_tuple(output, costs);
  }

The policy is to name such wapper methods destined for the remote method mechanism by prepending the suffix remote_, and usually to keep them private and non-virtual.

Note that from the calling-convention perspective of a C++ process remote-calling such a tuple-returning method, the results will be received as "multiple results" corresponding to the elements of the tuple, rather than as a "single result" of type tuple. If instead you *really* want your tuple to be received as a single tuple then you should return a tuple of your tuple.

Also beware, if you have several C++ methods with the same name, overloaded for different types of arguments, and you want to make them all remote callable, you should declare them with *different* corresponding string names in declareMethods. Indeed, the remote method mechanism can only distinguish methods based on their string name and number of arguments, but not on the types of the arguments.

Parameters:
rmmRemoteMethodMap to be constructed for the current class.

Reimplemented from PLearn::Object.

Definition at line 78 of file RPPath.cc.

References absolute(), canonical(), PLearn::declareMethod(), and PLearn::RemoteMethodMap::inherited().

{
    rmm.inherited(inherited::_getRemoteMethodMap_());

    declareMethod(rmm, "absolute", &RPPath::absolute,
            (BodyDoc("Return the absolute path as a RPPath object.")));

    declareMethod(rmm, "canonical", &RPPath::canonical,
            (BodyDoc("Return the canonic path.")));
}

Here is the call graph for this function:

void PLearn::RPPath::declareOptions ( OptionList ol) [static, protected]

Declares the class options.

Reimplemented from PLearn::Object.

Definition at line 65 of file RPPath.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), and path.

{
    declareOption(ol, "path", &RPPath::path,
            OptionBase::buildoption,
        "Path (to file or directory) that is being manipulated.");

    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

static const PPath& PLearn::RPPath::declaringFile ( ) [inline, static]

Reimplemented from PLearn::Object.

Definition at line 73 of file RPPath.h.

:
    //#####  Protected Options  ###############################################
RPPath * PLearn::RPPath::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

OptionList & PLearn::RPPath::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

OptionMap & PLearn::RPPath::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

RemoteMethodMap & PLearn::RPPath::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 54 of file RPPath.cc.

void PLearn::RPPath::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Object.

Definition at line 126 of file RPPath.cc.


Member Data Documentation

Reimplemented from PLearn::Object.

Definition at line 73 of file RPPath.h.

Definition at line 55 of file RPPath.h.

Referenced by declareOptions().


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