Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TotalTextRep.cxx

Go to the documentation of this file.
00001 
00012 #ifdef HAVE_CONFIG_H
00013 #include "config.h"
00014 #else
00015 #ifdef _MSC_VER
00016 // include max() and min() missing from MicroSoft Visual C++
00017 #include "msdevstudio/MSconfig.h"
00018 #endif //_MSC_VER
00019 #endif
00020 
00021 #include "TotalTextRep.h"
00022 
00023 #include "graphics/ViewBase.h"
00024 #include "projectors/NTupleProjector.h"
00025 
00026 #ifdef SSTREAM_DEFECT
00027 #include <strstream>
00028 using std::ostrstream;
00029 #else
00030 #include <sstream>
00031 using std::ostringstream;
00032 #endif
00033 
00034 using std::string;
00035 
00036 TotalTextRep::TotalTextRep ( )
00037   : TextRepBase ( "Total Entries" )
00038 {
00039 }
00040 
00041 TotalTextRep::TotalTextRep ( const TotalTextRep & rep )
00042   : TextRepBase( rep )
00043 {
00044 }
00045 
00046 /* virtual */
00047 RepBase * TotalTextRep::clone ()
00048 {
00049   return new TotalTextRep ( *this );
00050 }
00051 
00052 void
00053 TotalTextRep::
00054 drawProjectedValues ( ProjectorBase & proj,
00055                       ViewBase & view )
00056 {
00057   int total = proj.getNumberOfEntries ();
00058 #ifdef SSTREAM_DEFECT
00059   ostrstream strm_text;
00060 #else
00061   ostringstream strm_text;
00062 #endif
00063 
00064   strm_text << "Total entries = ";
00065 
00066   if ( total < 0 ) {
00067     strm_text << "meaningless";
00068   } else {
00069     strm_text << total;
00070   }
00071 
00072   strm_text << std::ends;
00073   const string str_text ( strm_text.str () );
00074 
00075   view.drawText ( str_text, 5, 0, m_size, 0, 'l', 't', true );
00076 }

Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3