quick start:g++ [flags ...] file ... #include <Triple.h> Triple(); boolean assign(const Triple<T1, T2, T3>& arg); boolean eq(const Triple<T1, T2, T3>& obj); T1& first(); T2& second(); T3& third();
description:// declare a Triple and insert a character and string in it // Triple<Char, String, Float> Triple0; Char char(L'a'); String str(L"aye"); Float ft = 1.0; Triple0.assign(char, str, ft); // use the copy constructor to create a second Triple // Triple<Char,String> Triple1(Triple0); // test the characters for equality // if (!Triple0.first().eq(Triple1.first())) { Console::put(L"Error in Triple assign"); }
static const String CLASS_NAME = L"Triple";
static const String DEF_PARAM = L"item";
static const String BLOCK_START_STR = L"{";
static const String BLOCK_DELIM_STR = L"}, {";
static const String BLOCK_END_STR = L"}";
static const String BLOCK_TERM_STR = L";\n";
static const long ERR = 41900;
T1 obj1_d;
T2 obj2_d;
T3 obj3_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
static boolean setDebug(Integral::DEBUG debug_level);
~Triple();
Triple();
Triple(const Triple<T1, T2, T3>& arg);
boolean assign(const Triple<T1, T2, T3>& arg);
Triple<T1, T2, T3>& operator=(const Triple<T1, T2, T3>& arg);
boolean eq(const Triple<T1, T2, T3>& compare_node) const;
long sofSize() const;
boolean read(Sof& sof, long tag);
boolean write(Sof& sof, long tag) const;
boolean read(Sof& sof, long tag, const String& name);
boolean write(Sof& sof, long tag, const String& name) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM,long size = SofParser::FULL_OBJECT, boolean param_a = true, boolean nested_a = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);
Triple(const T1& obj1, const T2& obj2, const T3& obj3);
boolean assign(const T1& obj1, const T2& obj2, const T3& obj3);
T1& first();
const T1& first() const;
T2& second();
const T2& second() const;
T2& third();
const T2& third() const;
#include <Triple.h> #include <Char.h> #include <Vector.h> #include <String.h> #include <Float.h> int main () { // we want to keep up with characters and associated strings. we // could do this with parallel vectors, but combining the inner // data is more natural. // Vector< Triple<Char, String, Float> > letters(5); letters(0).first().assign(L'a'); letters(1).first().assign(L'b'); letters(2).first().assign(L'c'); letters(3).first().assign(L'd'); letters(4).first().assign(L'e'); letters(0).second().assign(L"aye"); letters(1).second().assign(L"be"); letters(2).second().assign(L"see"); letters(3).second().assign(L"de"); letters(4).second().assign(L"e"); letters(0).third().assign((float)1); letters(1).third().assign((float)2); letters(2).third().assign((float)3); letters(3).third().assign((float)4); letters(4).third().assign((float)5); // we might also want to weight these, so, Vector <Triple < Long,Long,Triple <Char, String, Float> > > wlet(5); for (long i = 0; i < 5; i++) { wlet(i).first().assign(i * 3); wlet(i).second().assign(letters(i).second()); wlet(i).third().assign(letters(i)); } wlet.debug(L"wlet"); // so far all this can easily be done with parallel arrays, but // if we so desired we could also make a graph out of these. // exit gracefully // Integral::exit(); }