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

#include <ObjectGenerator.h>

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

List of all members.

Public Member Functions

 ObjectGenerator ()
 Default constructor.
virtual PP< ObjectgenerateNextObject ()=0
 This will generate the next object in the list of all options MUST be define by a subclass.
virtual TVec< PP< Object > > generateAllObjects ()
 This will generate a list of all possible Objects.
virtual void build ()
 simply calls inherited::build() then build_()
virtual void forget ()
virtual ObjectGeneratordeepCopy (CopiesMap &copies) const

Static Public Member Functions

static string _classname_ ()
 Declares name and deepCopy methods.
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Public Attributes

PP< Objecttemplate_object
 The template Object from which we will generate other Objects.

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Protected Attributes

bool generation_began
 Did we begin to generate new Objects???

Private Types

typedef Object inherited

Private Member Functions

void build_ ()
 Object-specific post-constructor.

Detailed Description

Definition at line 47 of file ObjectGenerator.h.


Member Typedef Documentation

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 50 of file ObjectGenerator.h.


Constructor & Destructor Documentation

PLearn::ObjectGenerator::ObjectGenerator ( )

Default constructor.

Definition at line 48 of file ObjectGenerator.cc.

                                 : generation_began(false)
{}

Member Function Documentation

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

Declares name and deepCopy methods.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 46 of file ObjectGenerator.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 46 of file ObjectGenerator.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 46 of file ObjectGenerator.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 46 of file ObjectGenerator.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 46 of file ObjectGenerator.cc.

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

simply calls inherited::build() then build_()

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 57 of file ObjectGenerator.cc.

References PLearn::Object::build(), and build_().

Here is the call graph for this function:

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

Object-specific post-constructor.

This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build() method, and possibly the public virtual read method (which calls its parent's read). build_() can assume that its parent's build_() has already been called.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 51 of file ObjectGenerator.cc.

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

Referenced by build().

{
    if (template_object.isNull())
        PLERROR("An ObjectGenerator MUST contain a template Object");
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Declare options (data fields) for the class.

Redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options). Please call the inherited method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).

  static void MyDerivedClass::declareOptions(OptionList& ol)
  {
      declareOption(ol, "inputsize", &MyObject::inputsize_,
                    OptionBase::buildoption,
                    "The size of the input; it must be provided");
      declareOption(ol, "weights", &MyObject::weights,
                    OptionBase::learntoption,
                    "The learned model weights");
      inherited::declareOptions(ol);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 68 of file ObjectGenerator.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::Object::declareOptions(), and template_object.

{
    declareOption(ol, "template_object", &ObjectGenerator::template_object,
                  OptionBase::buildoption, "The template Object from which all the others will be built. \n");

    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 92 of file ObjectGenerator.h.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 46 of file ObjectGenerator.cc.

void PLearn::ObjectGenerator::forget ( ) [virtual]

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 63 of file ObjectGenerator.cc.

References generation_began.

Referenced by generateAllObjects().

{
    generation_began = false;
}

Here is the caller graph for this function:

TVec< PP< Object > > PLearn::ObjectGenerator::generateAllObjects ( ) [virtual]

This will generate a list of all possible Objects.

By default, just loop over generateNextObject()

Definition at line 76 of file ObjectGenerator.cc.

References PLearn::TVec< T >::append(), forget(), generateNextObject(), generation_began, and PLearn::PP< T >::isNull().

{
    TVec< PP<Object> > all_objs;

    forget();
    while (true)
    {
        PP<Object> next_obj = generateNextObject();
        if (next_obj.isNull()) break; // no new Object
        all_objs.append(next_obj);
    }
    generation_began = true;

    return all_objs;
}

Here is the call graph for this function:

virtual PP<Object> PLearn::ObjectGenerator::generateNextObject ( ) [pure virtual]

This will generate the next object in the list of all options MUST be define by a subclass.

Implemented in PLearn::OracleObjectGenerator.

Referenced by generateAllObjects().

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from PLearn::Object.

Reimplemented in PLearn::OracleObjectGenerator.

Definition at line 92 of file ObjectGenerator.h.

Did we begin to generate new Objects???

Definition at line 55 of file ObjectGenerator.h.

Referenced by forget(), and generateAllObjects().

The template Object from which we will generate other Objects.

Definition at line 60 of file ObjectGenerator.h.

Referenced by build_(), and declareOptions().


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