PLearn 0.1
Public Member Functions | Public Attributes
PLearn::Field Struct Reference

#include <SimpleDB.h>

Collaboration diagram for PLearn::Field:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Field ()
 Field (string name, FieldType t, int p=0)
bool operator== (const Field &x) const

Public Attributes

string name
 mainly for debugging purposes
FieldType field_type
int precision

Detailed Description

Definition at line 115 of file SimpleDB.h.


Constructor & Destructor Documentation

PLearn::Field::Field ( ) [inline]

Definition at line 116 of file SimpleDB.h.

PLearn::Field::Field ( string  name,
FieldType  t,
int  p = 0 
) [inline]

We listen to the precision argument solely when the field type is a string

Definition at line 117 of file SimpleDB.h.

References PLearn::CharacterType, PLearn::DateType, PLearn::DoubleType, PLearn::FloatType, PLearn::IntType, PLERROR, PLearn::ShortType, PLearn::SignedCharType, PLearn::StringType, and PLearn::Unknown.

        : name(name), field_type(t)
    {
        switch(field_type) {
        case Unknown:           precision=0;    break;
        case StringType:        precision=p;    break;
        case CharacterType:     precision=1;    break;
        case SignedCharType:    precision=1;    break;
        case ShortType:         precision=2;    break;
        case IntType:           precision=4;    break;
        case FloatType:         precision=4;    break;
        case DoubleType:        precision=8;    break;
        case DateType:          precision=4;    break;
        default:
            PLERROR("Unknown field type %d with name %s",
                    int(field_type), name.c_str());
        }
        if (sizeof(PDate) != 4)
            PLERROR("A PLearn PDate must have sizeof equal to 4");
    }

Member Function Documentation

bool PLearn::Field::operator== ( const Field x) const [inline]

Definition at line 140 of file SimpleDB.h.

References field_type, name, and precision.

                                          {
        return name==x.name &&
            field_type == x.field_type &&
            precision == x.precision;
    }

Member Data Documentation

Definition at line 147 of file SimpleDB.h.

Referenced by operator==().

mainly for debugging purposes

Definition at line 146 of file SimpleDB.h.

Referenced by operator==().

Definition at line 148 of file SimpleDB.h.

Referenced by operator==().


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