00001 // 00002 // EvalCaseResults.cpp 00003 // 00004 00005 #include "EvalCaseResults.hpp" 00006 #include <sstream> 00007 00008 00009 namespace datatypes 00010 { 00011 00012 // 00013 EvalCaseResults::EvalCaseResults () 00014 { 00015 m_datatype = Datatype_EvalCaseResults; 00016 } 00017 00018 00019 00020 EvalCaseResults::EvalCaseResults (UINT8 sourceId) 00021 { 00022 m_datatype = Datatype_EvalCaseResults; 00023 m_sourceId = sourceId; 00024 } 00025 00026 00027 00028 // Default destructor 00029 EvalCaseResults::~EvalCaseResults() 00030 { 00031 } 00032 00033 // Estimate the memory usage of this object. 00034 const UINT32 EvalCaseResults::getUsedMemory() const 00035 { 00036 UINT32 sum = sizeof(*this); 00037 EvalCaseResultVector::const_iterator iter; 00038 for (iter = m_evalCases.begin(); iter != m_evalCases.end(); iter++) 00039 { 00040 sum += iter->getUsedMemory(); 00041 } 00042 return sum; 00043 } 00044 00045 00046 std::string EvalCaseResults::toString() const 00047 { 00048 std::ostringstream os; 00049 os << "There are " << size() << " EvalCaseResults:" << std::endl << std::endl; 00050 for (size_t i = 0; i < size(); i++) 00051 { 00052 os << at(i).toString() << std::endl; 00053 } 00054 00055 return os.str(); 00056 } 00057 00058 // 00059 // 00060 // 00061 bool EvalCaseResults::operator==(const EvalCaseResults& other) 00062 { 00063 bool isTheSame = false; 00064 00065 if (size() == other.size()) 00066 { 00067 EvalCaseResultVector::const_iterator iter1, iter2; 00068 iter1 = m_evalCases.begin(); 00069 iter2 = other.m_evalCases.begin(); 00070 isTheSame = true; 00071 00072 for (; iter1 != m_evalCases.end(); ++iter1, ++iter2) 00073 { 00074 if ((iter1->m_sCaseName != iter2->m_sCaseName) || (iter1->m_eCaseResult != iter2->m_eCaseResult)) 00075 { 00076 isTheSame = false; 00077 break; 00078 } 00079 } 00080 } 00081 00082 return isTheSame; 00083 } 00084 00085 00086 bool EvalCaseResults::operator!=(const EvalCaseResults& other) 00087 { 00088 return ! operator==(other); 00089 } 00090 00091 } // END namespace datatypes