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

The first sentence should be a BRIEF DESCRIPTION of what the class does. More...

#include <InjectionTest.h>

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

List of all members.

Public Member Functions

 InjectionTest ()
 Default constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual InjectionTestdeepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual void perform ()
 The method performing the test.

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 ()

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.

Static Protected Attributes

static string python_code = " sys.stderr.flush()\n"
 Static Python code.

Private Types

typedef PTest inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

The first sentence should be a BRIEF DESCRIPTION of what the class does.

Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html

Todo:
Write class to-do's here if there are any.
Deprecated:
Write deprecated stuff here if there is any. Indicate what else should be used instead.

Definition at line 61 of file InjectionTest.h.


Member Typedef Documentation

Reimplemented from PLearn::PTest.

Definition at line 63 of file InjectionTest.h.


Constructor & Destructor Documentation

PLearn::InjectionTest::InjectionTest ( )

Default constructor.

Definition at line 61 of file InjectionTest.cc.

{
    // ...

    // ### You may (or not) want to call build_() to finish building the object
    // ### (doing so assumes the parent classes' build_() have been called too
    // ### in the parent classes' constructors, something that you must ensure)
}

Member Function Documentation

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

void PLearn::InjectionTest::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::PTest.

Definition at line 74 of file InjectionTest.cc.

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

This does the actual building.

Reimplemented from PLearn::PTest.

Definition at line 120 of file InjectionTest.cc.

{
    // ### This method should do the real building of the object,
    // ### according to set 'options', in *any* situation. 
    // ### Typical situations include:
    // ###  - Initial building of an object from a few user-specified options
    // ###  - Building of a "reloaded" object: i.e. from the complete set of all serialised options.
    // ###  - Updating or "re-building" of an object after a few "tuning" options have been modified.
    // ### You should assume that the parent class' build_() has already been called.
}
string PLearn::InjectionTest::classname ( ) const [virtual]

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Declares the class options.

Reimplemented from PLearn::PTest.

Definition at line 100 of file InjectionTest.cc.

{
    // ### Declare all of this object's options here
    // ### For the "flags" of each option, you should typically specify  
    // ### one of OptionBase::buildoption, OptionBase::learntoption or 
    // ### OptionBase::tuningoption. Another possible flag to be combined with
    // ### is OptionBase::nosave

    // ### ex:
    // declareOption(ol, "myoption", &InjectionTest::myoption, OptionBase::buildoption,
    //               "Help text describing this option");
    // ...

    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}
static const PPath& PLearn::InjectionTest::declaringFile ( ) [inline, static]

Reimplemented from PLearn::PTest.

Definition at line 88 of file InjectionTest.h.

:

InjectionTest * PLearn::InjectionTest::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Reimplemented from PLearn::PTest.

Definition at line 56 of file InjectionTest.cc.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::PTest.

Definition at line 83 of file InjectionTest.cc.

References PLERROR.

{
    inherited::makeDeepCopyFromShallowCopy(copies);

    // ### Call deepCopyField on all "pointer-like" fields 
    // ### that you wish to be deepCopied rather than 
    // ### shallow-copied.
    // ### ex:
    // deepCopyField(trainvec, copies);

    // ### Remove this line when you have fully implemented this method.
    PLERROR("InjectionTest::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}
void PLearn::InjectionTest::perform ( ) [virtual]

The method performing the test.

A typical test consists in some output (to pout and / or perr), and updates of this object's options.

Reimplemented from PLearn::PTest.

Definition at line 181 of file InjectionTest.cc.

References PLearn::X::f(), PLearn::X::g(), PLearn::InjectionTest_basic_function(), python_code, and x.

{
    PP<PythonCodeSnippet> python = new PythonCodeSnippet(python_code);
    python->build();

    X x(13370);
    
    python->inject("injected_c_function", InjectionTest_basic_function);
    python->inject("injected_c_function2", InjectionTest_basic_function);
    python->inject("injected_c_method1", &x, &X::f);
    python->inject("injected_c_method2", &x, &X::g);

    python->invoke("trampoline_function_call", 64);
    python->invoke("trampoline_method_call",   128);
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::PTest.

Definition at line 88 of file InjectionTest.h.

string PLearn::InjectionTest::python_code = " sys.stderr.flush()\n" [static, protected]

Static Python code.

Definition at line 106 of file InjectionTest.h.


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