CMS 3D CMS Logo

main_xml.cc File Reference

#include <iostream>
#include <fstream>
#include <sstream>
#include "CalibTracker/SiStripRunSummary/interface/GlobalFlagXML.h"
#include "CalibTracker/SiStripRunSummary/interface/SerializeXML.h"
#include "CalibTracker/SiStripRunSummary/interface/getFlagTree.h"

Go to the source code of this file.

Functions

void FiletoXML ()
int main (int nArgc, char *pcArgv[])
void StrtoXML ()
void XMLtoFile ()
void XMLtoStr ()

Variables

std::string oFlagsStr = ""
const char * pcFILE_XML = "archive.xml"


Function Documentation

void FiletoXML (  ) 

Definition at line 55 of file main_xml.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), pcFILE_XML, and SerializeXML::read().

Referenced by main().

00055                  {
00056   std::cout << "--[ \033[1mFiletoXML\033[0m ]----------------" << std::endl;
00057 
00058   std::ifstream oSFileIn( pcFILE_XML);
00059 
00060   SerializeXML oSerializeXML;
00061   if( GlobalFlagXML *poFlag = oSerializeXML.read<GlobalFlagXML>( oSFileIn)) {
00062     std::cout << "Read Flags Tree from file: \033[1m"
00063               << pcFILE_XML << "\033[0m" << std::endl;
00064     std::cout << "\033[1;32m" << *poFlag << "\033[0m" << std::endl;
00065   } else {
00066     std::cout << "[\033[31merror\033[0m] Could not read Flags Tree from file: "
00067               << "\033[1m" << pcFILE_XML << "\033[0m" << std::endl;
00068   }
00069 
00070   std::cout << std::endl;
00071 }

int main ( int  nArgc,
char *  pcArgv[] 
)

Definition at line 91 of file main_xml.cc.

References FiletoXML(), StrtoXML(), XMLtoFile(), and XMLtoStr().

00091                                      {
00092   XMLtoFile();
00093   XMLtoStr ();
00094   FiletoXML();
00095   StrtoXML ();
00096 
00097   return 0;
00098 }

void StrtoXML (  ) 

Definition at line 73 of file main_xml.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), oFlagsStr, and SerializeXML::read().

Referenced by main().

00073                 {
00074   std::cout << "--[ \033[1mStrtoXML\033[0m ]----------------" << std::endl;
00075 
00076   std::istringstream oSStrIn( oFlagsStr);
00077 
00078   SerializeXML oSerializeXML;
00079   if( GlobalFlagXML *poFlag = oSerializeXML.read<GlobalFlagXML>( oSStrIn)) {
00080     std::cout << "Read Flags Tree from string" << std::endl;
00081     std::cout << "\033[1;32m" << *poFlag << "\033[0m" << std::endl;
00082   } else {
00083     std::cout << "[\033[31merror\033[0m] Could not read Flags from string "
00084               << std::endl;
00085   }
00086 
00087   std::cout << std::endl;
00088 }

void XMLtoFile (  ) 

Definition at line 16 of file main_xml.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getXMLFlagTree(), pcFILE_XML, and SerializeXML::write().

Referenced by main().

00016                  {
00017   std::cout << "--[ \033[1mXMLtoFile\033[0m ]----------------" << std::endl;
00018   GlobalFlagXML oFlag( getXMLFlagTree());
00019 
00020   std::ofstream oSFileOut( pcFILE_XML);
00021 
00022   SerializeXML oSerializeXML;
00023   if( oSerializeXML.write( oSFileOut, oFlag)) {
00024     std::cout << "Flags Tree wrote to file: \033[1m" << pcFILE_XML 
00025               << "\033[0m" << std::endl;
00026   } else {
00027     std::cout << "[\033[31merror\033[0m] Could not write Flags Tree to file: "
00028               << "\033[1m" << pcFILE_XML << "\033[0m" << std::endl;
00029   }
00030   std::cout << std::endl;
00031 }

void XMLtoStr (  ) 

Definition at line 33 of file main_xml.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getXMLFlagTree(), oFlagsStr, and SerializeXML::write().

Referenced by main().

00033                 {
00034   std::cout << "--[ \033[1mXMLtoStr\033[0m ]----------------" << std::endl;
00035   GlobalFlagXML oFlag( getXMLFlagTree());
00036 
00037   std::ostringstream oSStrOut;
00038 
00039   SerializeXML oSerializeXML;
00040   if( oSerializeXML.write( oSStrOut, oFlag)) {
00041     oFlagsStr = oSStrOut.str();
00042 
00043     std::cout << "XML String representing Falgs Tree..."
00044               << std::endl
00045               << "\033[1;32m"
00046               << oFlagsStr << "\033[0m" << std::endl;
00047   } else {
00048     std::cout << "[\033[31merror\033[0m] Could not write Flags to string "
00049               << std::endl;
00050   }
00051 
00052   std::cout << std::endl;
00053 }


Variable Documentation

std::string oFlagsStr = ""

Definition at line 14 of file main_xml.cc.

const char* pcFILE_XML = "archive.xml"

Definition at line 13 of file main_xml.cc.


Generated on Tue Jun 9 17:51:15 2009 for CMSSW by  doxygen 1.5.4