#ifndef JOURNAL_CLASS_12_01_2006 #define JOURNAL_CLASS_12_01_2006 /** @class Journal @author Brian Magill @date 12/1/2006 $Date:$ $Revision:$ @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @brief Class for logging processing comments */ #include #include //#include #include #include #include class Journal { typedef std::vector vectString; private: vectString LogArray; public: Journal():LogArray(0) {}; explicit Journal(std::string const &inital):LogArray(0) { LogArray.push_back(inital); }; explicit Journal(vectString const &inVec):LogArray(inVec){ }; Journal(Journal const &rhs):LogArray(rhs.LogArray) { }; Journal const & operator= (Journal const &rhs) { if(this == &rhs) return *this; LogArray = rhs.LogArray; return *this; }; ~Journal() {}; /// /// @brief Add a single string to end of journal /// void append(std::string const &item) { LogArray.push_back(item); }; /// /// @brief Add a contents of another journal to end of journal /// void append(Journal const &input) { vectString inVect = input.retrieve(); copy(inVect.begin(), inVect.end(), back_inserter(LogArray) ); }; /// /// @brief Retrieve contents of journal to a vector of strings. /// vectString retrieve() const { return LogArray; }; /// /// @brief Retrieve contents of journal to one string. Entries separated by new lines. /// std::string dump() const { std::string outputStr; vectString::const_iterator Indx; for(Indx = LogArray.begin(); Indx != LogArray.end(); Indx++) outputStr = outputStr + *Indx + std::string("\n"); return outputStr; }; /// /// @brief Writes journal data to an output stream /// void print(std::ostream &output) const { vectString::const_iterator Indx; for(Indx = LogArray.begin(); Indx != LogArray.end(); Indx++) output << *Indx << std::endl; }; /// /// @brief Writes journal to standard output /// void print( ) const {print(std::cout); }; }; #endif