RoodyXML.h

Go to the documentation of this file.
00001 /********************************************************************
00002   RoodyXML.h, J. Chuma, TRIUMF
00003 
00004 ********************************************************************/
00005 #ifndef RoodyXML_H
00006 #define RoodyXML_H
00007 
00008 #include <fstream>
00009 #include <sstream>
00010 #include <string>
00011 #include <vector>
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016 #include "mxml.h"
00017 #ifdef __cplusplus
00018 }
00019 #endif
00020 
00021 template <typename T>
00022 bool StringTo( T &, std::string const &,
00023                std::ios_base &(*f)(std::ios_base&) );
00024 
00025 template <typename T> class my_cast
00026 {
00027 private:
00028   void const *value;
00029 public:
00030   my_cast( void const *input ) : value(input) {}
00031   operator T () const { return static_cast<T>(value); }
00032 };
00033 
00034 class RoodyXML
00035 {
00036 protected:
00037   unsigned int level_;
00038   bool elementIsOpen_;
00039   std::vector<std::string> names_;
00040   std::ofstream outputFile_;
00041   char const *encoding_;
00042   char const *version_;
00043   std::string onlineHostName_, fileName_;
00044   std::string groupName_, histName_, histSource_;
00045   int refreshRate_, columns_, rows_;
00046   int fileIndex_, canvasIndex_, groupIndex_, histIndex_;
00047   PMXML_NODE documentNode_, roodyNode_, histParent_;
00048   PMXML_NODE zonesNode_, refreshNode_, histNode_;
00049 
00050   int FindNode( PMXML_NODE, int, char const * );
00051   //void PrintTree( int, PMXML_NODE );
00052 
00053 public:
00054   RoodyXML();
00055   virtual ~RoodyXML();
00056   //
00057   // write
00058   //
00059   std::ofstream &OpenFileForWrite( char const * );
00060   std::string Encode( std::string const & );
00061   //
00062   // read
00063   //
00064   bool OpenFileForRead( char const * );
00065   bool GetOnlineNode();
00066   std::string GetOnlineInfo();
00067   bool GetFileNode();
00068   std::string GetFileInfo();
00069   bool GetGraphicsNode();
00070   bool GetCanvasNode();
00071   bool GetHistogramNode();
00072   std::string GetHistogramName();
00073   std::string GetHistogramSource();
00074   bool GetGroupNode();
00075   std::string GetGroupName();
00076   void GetZones( int &, int & );
00077   int GetRefreshRate();
00078 
00079   //void PrintTree( int );
00080 };
00081 
00082 #endif   // RoodyXML_H

Roody DOC Version 1.0.1 ---- TRIUMF ----
Contributions: Pierre-Andre Amaudruz - Joe Chuma - Doxygen - Greg King - Konstantin Olchanski - Matthias Schneebeli