X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Farray2dfile.cpp;h=49f90f45182c30c656ee2bdb17162cce4e01a059;hp=d0f2d6859051a7fc72c82e065f6560e50dc14345;hb=4076fbc077adfd9ee610beef09b52d9e12c14abb;hpb=7ec2cd66921180a624813dff9f8bac76c6b268cc diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index d0f2d68..49f90f4 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.23 2001/01/01 10:14:34 kevin Exp $ +** $Id: array2dfile.cpp,v 1.26 2001/01/02 07:47:36 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -137,23 +137,53 @@ Array2dFileLabel::operator= (const Array2dFileLabel& rhs) return (*this); } -void -Array2dFileLabel::print (std::ostream& os) const -{ - if (m_labelType == L_HISTORY) { - os << "History: " << std::endl; - os << " " << m_strLabel << std::endl; - os << " calc time = " << m_calcTime << " secs" << std::endl; - os << " Timestamp = " << getDateString() << std::endl; - } else if (m_labelType == L_USER) { - os << "Note: " << m_strLabel << std::endl; - os << " Timestamp = %s" << getDateString() << std::endl; - } else { - os << "Unknown (" << m_labelType << "): " << m_strLabel << std::endl; - os << " Timestamp = %s" << getDateString() << std::endl; - } -} +void +Array2dFileLabel::print (std::ostream& os) const +{ + if (m_labelType == L_HISTORY) { + os << "History: " << std::endl; + os << " " << m_strLabel << std::endl; + os << " calc time = " << m_calcTime << " secs" << std::endl; + os << " Timestamp = " << getDateString() << std::endl; + } else if (m_labelType == L_USER) { + os << "Note: " << m_strLabel << std::endl; + os << " Timestamp = %s" << getDateString() << std::endl; + } else { + os << "Unknown (" << m_labelType << "): " << m_strLabel << std::endl; + os << " Timestamp = %s" << getDateString() << std::endl; + } +} + +void +Array2dFileLabel::printBrief (std::ostream& os) const +{ + if (m_labelType == L_HISTORY) { + os << "History ("; + if (m_calcTime > 0) + os << m_calcTime << " secs, "; + os << getDateString() << "): " << m_strLabel << std::endl; + } else if (m_labelType == L_USER) { + os << "Note (" << getDateString() << "): " << m_strLabel << std::endl; + } else { + os << "Unknown (" << getDateString() << "): " << m_strLabel << std::endl; + } +} +void +Array2dFileLabel::printBrief (std::ostringstream& os) const +{ + if (m_labelType == L_HISTORY) { + os << "History ("; + if (m_calcTime > 0) + os << m_calcTime << " secs, "; + os << getDateString().c_str() << "): " << m_strLabel.c_str() << "\n"; + } else if (m_labelType == L_USER) { + os << "Note (" << getDateString() << "): " << m_strLabel << "\n"; + } else { + os << "Unknown (" << getDateString() << "): " << m_strLabel << "\n"; + } +} + /////////////////////////////////////////////////////////////////////////// // CLASS IMPLEMENTATION @@ -631,7 +661,7 @@ Array2dFile::labelAdd (const Array2dFileLabel& label) } void -Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const pszId) +Array2dFile::labelsCopy (const Array2dFile& copyFile, const char* const pszId) { std::string id; if (pszId) @@ -660,17 +690,37 @@ Array2dFile::arrayDataClear (void) } } +void +Array2dFile::printLabels (std::ostream& os) const +{ + for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { + const Array2dFileLabel& label = **l; + + label.print (os); + os << std::endl; + } +} + +void +Array2dFile::printLabelsBrief (std::ostream& os) const +{ + for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { + const Array2dFileLabel& label = **l; + + label.printBrief (os); + } +} + void -Array2dFile::printLabels (std::ostream& os) const -{ - for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { - const Array2dFileLabel& label = **l; - - label.print (os); - os << std::endl; - } -} - +Array2dFile::printLabelsBrief (std::ostringstream& os) const +{ + for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { + const Array2dFileLabel& label = **l; + + label.printBrief (os); + } +} + const Array2dFileLabel& Array2dFile::labelGet (int i) const