Isis 3.0 Application Source Code Reference |
Home |
00001 #if !defined(HiCalTypes_h) 00002 #define HiCalTypes_h 00003 /** 00004 * @file 00005 * $Revision: 3878 $ 00006 * $Date: 2012-01-18 10:23:13 -0700 (Wed, 18 Jan 2012) $ 00007 * 00008 * Unless noted otherwise, the portions of Isis written by the USGS are 00009 * public domain. See individual third-party library and package descriptions 00010 * for intellectual property information, user agreements, and related 00011 * information. 00012 * 00013 * Although Isis has been used by the USGS, no warranty, expressed or 00014 * implied, is made by the USGS as to the accuracy and functioning of such 00015 * software and related material nor shall the fact of distribution 00016 * constitute any such warranty, and no responsibility is assumed by the 00017 * USGS in connection therewith. 00018 * 00019 * For additional information, launch 00020 * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html 00021 * in a browser or see the Privacy & Disclaimers page on the Isis website, 00022 * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on 00023 * http://www.usgs.gov/privacy.html. 00024 */ 00025 #include <string> 00026 #include <vector> 00027 #include <iostream> 00028 #include <sstream> 00029 00030 #include "tnt_array1d.h" 00031 #include "tnt_array1d_utils.h" 00032 #include "tnt_array2d.h" 00033 #include "tnt_array2d_utils.h" 00034 #include "PvlKeyword.h" 00035 00036 namespace Isis { 00037 00038 typedef TNT::Array1D<double> HiVector; //!< 1-D Buffer 00039 typedef TNT::Array2D<double> HiMatrix; //!< 2-D buffer 00040 00041 /** 00042 * @author ????-??-?? Unknown 00043 * 00044 * @internal 00045 */ 00046 class HiHistory { 00047 public: 00048 /** 00049 * @brief Output operator for history events 00050 * @param o Output stream 00051 * @param h History class to write contents of 00052 * 00053 * @return std::ostream& Returns new state of stream 00054 */ 00055 friend std::ostream &operator<<(std::ostream &o, const HiHistory &h) { 00056 std::copy(h._events.begin(), h._events.end(), 00057 std::ostream_iterator<std::string>(o,"; ")); 00058 return (o); 00059 } 00060 00061 public: 00062 HiHistory() { } 00063 HiHistory(const HiHistory &h) : _events(h._events) { } 00064 virtual ~HiHistory() { } 00065 00066 inline int size() const { return (_events.size()); } 00067 void add(const std::string &event) { _events.push_back(event); } 00068 std::string get(unsigned int index = 0) const { 00069 if (index < _events.size()) { 00070 return (_events[index]); 00071 } 00072 else { 00073 return (std::string("")); 00074 } 00075 } 00076 00077 void clear() { _events.clear(); } 00078 00079 PvlKeyword makekey(const std::string &name = "History") const { 00080 PvlKeyword key(name); 00081 for (unsigned int i = 0 ; i < _events.size() ; i++) { 00082 key.AddValue(_events[i]); 00083 } 00084 return (key); 00085 } 00086 00087 private: 00088 std::vector<std::string> _events; 00089 }; 00090 00091 }; 00092 #endif