00001 00002 // $Id: testXMLIStack.cc,v 1.4 2008/09/22 18:27:43 fmwk Exp $ 00003 // 00005 // 00006 // messier@indiana.edu 00008 #include <iostream> 00009 #include "XMLInterface/Stack.h" 00010 #include <ctime> 00011 #include <typeinfo> 00012 00013 void gspushi(int i) { xmli::Stack<int> ::Instance().push(i); } 00014 void gspushf(float f) { xmli::Stack<float>::Instance().push(f); } 00015 void gspushTS(time_t ts){xmli::Stack<time_t>::Instance().push(ts); } 00016 00017 int main(void) 00018 { 00019 gspushi(1); 00020 gspushi(2); 00021 gspushi(3); 00022 00023 gspushf(1.1); 00024 gspushf(2.2); 00025 gspushf(3.3); 00026 00027 struct tm t; 00028 t.tm_sec = 0; 00029 t.tm_min = 38; 00030 t.tm_hour = 8; 00031 t.tm_mday = 21; 00032 t.tm_mon = 8; 00033 t.tm_year = 2008-1900; 00034 00035 time_t ts = mktime(&t); 00036 gspushTS(ts); 00037 00038 t.tm_year = 1974-1900; 00039 t.tm_mon = 3; 00040 t.tm_mday = 5; 00041 t.tm_min = 30; 00042 00043 ts = mktime(&t); 00044 gspushTS(ts); 00045 00046 xmli::Stack<int>& si = xmli::Stack<int>::Instance(); 00047 xmli::Stack<float>& sf = xmli::Stack<float>::Instance(); 00048 xmli::Stack<time_t>& sTS = xmli::Stack<time_t>::Instance(); 00049 00050 for (; !si.empty(); si.pop()) { 00051 int i = si.top(); 00052 std::cerr << i << std::endl; 00053 } 00054 for (; !sf.empty(); sf.pop()) { 00055 float f = sf.top(); 00056 std::cerr << f << std::endl; 00057 } 00058 for (; !sTS.empty(); sTS.pop()) { 00059 time_t ts = sTS.top(); 00060 std::cerr << ctime(&ts) << std::endl; 00061 } 00062 } 00063
1.3.9.1