rtcASCIIOutputHandler.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009
00003  * Robert Bosch LLC
00004  * Research and Technology Center North America
00005  * Palo Alto, California
00006  *
00007  * All rights reserved.
00008  *
00009  *------------------------------------------------------------------------------
00010  * project ....: Autonomous Technologies
00011  * file .......: rtcASCIIOutputHandler.cpp
00012  * authors ....: Benjamin Pitzer
00013  * organization: Robert Bosch LLC
00014  * creation ...: 01/20/2009
00015  * modified ...: $Date: 2009-01-21 18:19:16 -0800 (Wed, 21 Jan 2009) $
00016  * changed by .: $Author: benjaminpitzer $
00017  * revision ...: $Revision: 14 $
00018  */
00019 
00020 //== INCLUDES =================================================================
00021 #include "rtc/rtcASCIIOutputHandler.h"
00022 
00023 //== NAMESPACES ===============================================================
00024 namespace rtc {
00025 
00026 //== IMPLEMENTATION ==========================================================
00027 
00029 ASCIIOutputHandler::ASCIIOutputHandler()
00030 : OutputHandler()
00031 {
00032 }
00033 
00035 ASCIIOutputHandler::ASCIIOutputHandler(std::ostream& os)
00036 : OutputHandler(os)
00037 {
00038 }
00039 
00041 ASCIIOutputHandler::~ASCIIOutputHandler()
00042 {
00043 }
00044 
00046 bool ASCIIOutputHandler::binary() const
00047 {
00048   return false;
00049 }
00050 
00052 bool ASCIIOutputHandler::writeName(const std::string& name)
00053 {
00054   if(!outStream) return false;
00055   *outStream << name;
00056   return outStream->good();
00057 }
00059 bool ASCIIOutputHandler::writeSeparator()
00060 {
00061   if(!outStream) return false;
00062   *outStream << SEPARATOR;
00063   return outStream->good();
00064 }
00065 
00067 bool ASCIIOutputHandler::writeEOL()
00068 {
00069   if(!outStream) return false;
00070   *outStream << std::endl;
00071   return outStream->good();
00072 }
00073 
00074 bool ASCIIOutputHandler::write(const std::string& data) {
00075   if(!outStream) return false;
00076   *outStream << data;
00077   return outStream->good();
00078 };
00079 
00080 bool ASCIIOutputHandler::write(const double& data) {
00081   if(!outStream) return false;
00082   *outStream << data;
00083   return outStream->good();
00084 }
00085 
00086 bool ASCIIOutputHandler::write(const float& data) {
00087   if(!outStream) return false;
00088   *outStream << data;
00089   return outStream->good();
00090 }
00091 
00092 bool ASCIIOutputHandler::write(const int& data) {
00093   if(!outStream) return false;
00094   *outStream << data;
00095   return outStream->good();
00096 }
00097 
00098 bool ASCIIOutputHandler::write(const unsigned int& data) {
00099   if(!outStream) return false;
00100   *outStream << data;
00101   return outStream->good();
00102 }
00103 
00104 bool ASCIIOutputHandler::write(const char& data) {
00105   if(!outStream) return false;
00106   *outStream << data;
00107   return outStream->good();
00108 }
00109 
00110 bool ASCIIOutputHandler::write(const unsigned char& data) {
00111   if(!outStream) return false;
00112   *outStream << data;
00113   return outStream->good();
00114 }
00115 
00116 bool ASCIIOutputHandler::write(const bool& data) {
00117   if(!outStream) return false;
00118   if (data) {
00119     return ASCIIOutputHandler::write(char(1));
00120   } else {
00121     return ASCIIOutputHandler::write(char(0));
00122   }
00123 }
00124 
00125 bool ASCIIOutputHandler::write(const long& data) {
00126   if(!outStream) return false;
00127   *outStream << data;
00128   return outStream->good();
00129 }
00130 
00131 bool ASCIIOutputHandler::write(const unsigned long& data) {
00132   if(!outStream) return false;
00133   *outStream << data;
00134   return outStream->good();
00135 }
00136 
00137 bool ASCIIOutputHandler::write(const short& data) {
00138   if(!outStream) return false;
00139   *outStream << data;
00140   return outStream->good();
00141 }
00142 
00143 bool ASCIIOutputHandler::write(const unsigned short& data) {
00144   if(!outStream) return false;
00145   *outStream << data;
00146   return outStream->good();
00147 }
00148 
00149 bool ASCIIOutputHandler::write(const char* data, long n) {
00150   if(!outStream) return false;
00151   outStream->write(data,n);
00152   return outStream->good();
00153 }
00154 
00155 //=============================================================================
00156 } // namespace rtc
00157 //=============================================================================


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:34