PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <TupleTest.h>
Public Member Functions | |
TupleTest () | |
Default constructor. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual TupleTest * | deepCopy (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 PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef PTest | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
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
Definition at line 57 of file TupleTest.h.
typedef PTest PLearn::TupleTest::inherited [private] |
Reimplemented from PLearn::PTest.
Definition at line 59 of file TupleTest.h.
PLearn::TupleTest::TupleTest | ( | ) |
string PLearn::TupleTest::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
OptionList & PLearn::TupleTest::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
RemoteMethodMap & PLearn::TupleTest::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
Object * PLearn::TupleTest::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
StaticInitializer TupleTest::_static_initializer_ & PLearn::TupleTest::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
void PLearn::TupleTest::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 64 of file TupleTest.cc.
{ inherited::build(); build_(); }
void PLearn::TupleTest::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::PTest.
Definition at line 99 of file TupleTest.cc.
{}
string PLearn::TupleTest::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
void PLearn::TupleTest::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::PTest.
Definition at line 90 of file TupleTest.cc.
{ // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::TupleTest::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::PTest.
Definition at line 84 of file TupleTest.h.
:
//##### Protected Options ###############################################
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
OptionList & PLearn::TupleTest::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
OptionMap & PLearn::TupleTest::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
RemoteMethodMap & PLearn::TupleTest::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 52 of file TupleTest.cc.
void PLearn::TupleTest::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::PTest.
Definition at line 73 of file TupleTest.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("TupleTest::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
void PLearn::TupleTest::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 105 of file TupleTest.cc.
References PLearn::endl(), m, PLearn::openString(), PLearn::PStream::plearn_ascii, PLearn::PStream::plearn_binary, PLearn::pout, and PLearn::tostring().
{ string srepr; PStream fromsrepr; // first test pair pout << "\n***** Simple pair test *****" << endl; typedef pair<string, pair<int, string> > p1_t; p1_t p1("mot1",make_pair(3,string("mot2"))); pout << "Type: " << TypeTraits<p1_t>::name() << endl; pout << "Value: " << p1 << endl; srepr = tostring(p1,PStream::plearn_ascii); fromsrepr = openString(srepr, PStream::plearn_ascii); p1_t p1_fromascii; fromsrepr >> p1_fromascii; pout << "Value reread from plearn_ascii serialization: " << p1_fromascii << endl; pout << "Same? " << (p1_fromascii==p1) << endl; srepr = tostring(p1,PStream::plearn_binary); fromsrepr = openString(srepr, PStream::plearn_binary); p1_t p1_frombinary; fromsrepr >> p1_frombinary; pout << "Value reread from plearn_binary serialization: " << p1_frombinary << endl; pout << "Same? " << (p1_frombinary==p1) << endl; // test a simple tuple pout << "\n***** Simple tuple test *****" << endl; typedef tuple<int, double, string, char> t1_t; t1_t t1(3,4.5,string("essai"),'X'); pout << "Type: " << TypeTraits<t1_t>::name() << endl; pout << "Value: " << t1 << endl; srepr = tostring(t1,PStream::plearn_ascii); fromsrepr = openString(srepr, PStream::plearn_ascii); t1_t t1_fromascii; fromsrepr >> t1_fromascii; pout << "Value reread from plearn_ascii serialization: " << t1_fromascii << endl; pout << "Same? " << (t1_fromascii==t1) << endl; srepr = tostring(t1,PStream::plearn_binary); fromsrepr = openString(srepr, PStream::plearn_binary); t1_t t1_frombinary; fromsrepr >> t1_frombinary; pout << "Value reread from plearn_binary serialization: " << t1_frombinary << endl; pout << "Same? " << (t1_frombinary==t1) << endl; // test a complex tuple pout << "\n***** Complex tuple test *****" << endl; typedef tuple<int, float, tuple<string, pair<double, int>, map<string, float> >, char> t2_t; map<string, float> m; m["key1"] = 1.0; m["key2"] = 2.0; m["key3"] = 3.0; t2_t t2(36, 3.25, make_tuple(string("mot1"), make_pair(4.5,3), m), 'Z'); pout << "Type: " << TypeTraits<t2_t>::name() << endl; pout << "Value: " << t2 << endl; srepr = tostring(t2,PStream::plearn_ascii); fromsrepr = openString(srepr, PStream::plearn_ascii); t2_t t2_fromascii; fromsrepr >> t2_fromascii; pout << "Value reread from plearn_ascii serialization: " << t2_fromascii << endl; pout << "Same? " << (t2_fromascii==t2) << endl; srepr = tostring(t2,PStream::plearn_binary); fromsrepr = openString(srepr, PStream::plearn_binary); t2_t t2_frombinary; fromsrepr >> t2_frombinary; pout << "Value reread from plearn_binary serialization: " << t2_frombinary << endl; pout << "Same? " << (t2_frombinary==t2) << endl; pout << "\n**** ALL DONE *****" << endl; }
Reimplemented from PLearn::PTest.
Definition at line 84 of file TupleTest.h.