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

#include <SDBVMat.h>

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

List of all members.

Public Member Functions

 SDBVMFieldFunc1 (SDBVMSource source, Func func, real missing_values_mapping=MISSING_VALUE)
virtual void convertField (const SDBWithStats &sdb, const Row &row, const Vec &output) const
virtual int fieldWidth () const
 Width that the field occupies in the VMat.

Protected Attributes

Func func_

Private Types

typedef SDBVMFieldSource1 inherited

Detailed Description

Apply a one-input func to the field: call operator()(const Vec& input) of the func, with the input vector set to the single value resulting from the conversion of the SDB field to a Real. The vector output by the func is kept completely in the output; in other words, fieldWidth() is equal to the size of the vector returned by the func.

Definition at line 454 of file SDBVMat.h.


Member Typedef Documentation

Reimplemented from PLearn::SDBVMFieldSource1.

Definition at line 456 of file SDBVMat.h.


Constructor & Destructor Documentation

PLearn::SDBVMFieldFunc1::SDBVMFieldFunc1 ( SDBVMSource  source,
Func  func,
real  missing_values_mapping = MISSING_VALUE 
) [inline]

Definition at line 459 of file SDBVMat.h.

        : inherited(source,missing_values_mapping,VMField::Continuous), func_(func) {}

Member Function Documentation

void PLearn::SDBVMFieldFunc1::convertField ( const SDBWithStats sdb,
const Row theRow,
const Vec outputField 
) const [virtual]

Given a database row, convert the appropriate parts to a (preallocated) output vector of the correct width (given by fieldWidth). Replace MISSING_VALUEs by missing_values_mapping.

Implements PLearn::SDBVMField.

Definition at line 404 of file SDBVMat.cc.

References PLearn::SDBVMField::convertMissing(), func_, PLearn::SDBVMSource::getValue(), and PLearn::SDBVMFieldSource1::source_.

{
    Vec input(1);
    input[0] = source_.getValue(sdb,row);
    output << func_(input);
    convertMissing(output);
}

Here is the call graph for this function:

int PLearn::SDBVMFieldFunc1::fieldWidth ( ) const [virtual]

Width that the field occupies in the VMat.

Implements PLearn::SDBVMField.

Definition at line 413 of file SDBVMat.cc.

References func_.

{
    return func_->outputsize;
}

Member Data Documentation

Func PLearn::SDBVMFieldFunc1::func_ [mutable, protected]

Definition at line 469 of file SDBVMat.h.

Referenced by convertField(), and fieldWidth().


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