CMS 3D CMS Logo

main_txt.cc File Reference

#include <iostream>
#include <fstream>
#include <sstream>
#include "CalibTracker/SiStripRunSummary/interface/GlobalFlagTxt.h"
#include "CalibTracker/SiStripRunSummary/interface/SerializeTxt.h"
#include "CalibTracker/SiStripRunSummary/interface/getFlagTree.h"

Go to the source code of this file.

Functions

void FiletoTXT ()
int main (int nArgc, char *pcArgv[])
void StrtoTXT ()
void TXTtoFile ()
void TXTtoStr ()

Variables

std::string oFlagsStr = ""
const char * pcFILE_TXT = "archive.txt"


Function Documentation

void FiletoTXT (  ) 

Definition at line 55 of file main_txt.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), pcFILE_TXT, and SerializeBase::read().

Referenced by main().

00055                  {
00056   std::cout << "--[ \033[1mFiletoTXT\033[0m ]----------------" << std::endl;
00057 
00058   std::ifstream oSFileIn( pcFILE_TXT);
00059 
00060   SerializeTxt oSerializeTxt;
00061   if( GlobalFlagTxt *poFlag = oSerializeTxt.read<GlobalFlagTxt>( oSFileIn)) {
00062     std::cout << "Read Flags Tree from file: \033[1m"
00063               << pcFILE_TXT << "\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_TXT << "\033[0m" << std::endl;
00068   }
00069 
00070   std::cout << std::endl;
00071 }

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

Definition at line 90 of file main_txt.cc.

References FiletoTXT(), StrtoTXT(), TXTtoFile(), and TXTtoStr().

00090                                      {
00091   TXTtoFile();
00092   TXTtoStr ();
00093   FiletoTXT();
00094   StrtoTXT ();
00095 
00096   return 0;
00097 }

void StrtoTXT (  ) 

Definition at line 73 of file main_txt.cc.

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

Referenced by main().

00073                 {
00074   std::cout << "--[ \033[1mStrtoTXT\033[0m ]----------------" << std::endl;
00075 
00076   std::istringstream oSStrIn( oFlagsStr);
00077 
00078   SerializeTxt oSerializeTxt;
00079   if( GlobalFlagTxt *poFlag = oSerializeTxt.read<GlobalFlagTxt>( 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 TXTtoFile (  ) 

Definition at line 16 of file main_txt.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getTXTFlagTree(), pcFILE_TXT, and SerializeBase::write().

Referenced by main().

00016                  {
00017   std::cout << "--[ \033[1mTXTtoFile\033[0m ]----------------" << std::endl;
00018   GlobalFlagTxt oFlag( getTXTFlagTree());
00019 
00020   std::ofstream oSFileOut( pcFILE_TXT);
00021 
00022   SerializeTxt oSerializeTxt;
00023   if( oSerializeTxt.write( oSFileOut, oFlag)) {
00024     std::cout << "Flags Tree wrote to file: \033[1m" << pcFILE_TXT 
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_TXT << "\033[0m" << std::endl;
00029   }
00030   std::cout << std::endl;
00031 }

void TXTtoStr (  ) 

Definition at line 33 of file main_txt.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getTXTFlagTree(), oFlagsStr, and SerializeBase::write().

Referenced by main().

00033                 {
00034   std::cout << "--[ \033[1mTXTtoStr\033[0m ]----------------" << std::endl;
00035   GlobalFlagTxt oFlag( getTXTFlagTree());
00036 
00037   std::ostringstream oSStrOut;
00038 
00039   SerializeTxt oSerializeTxt;
00040   if( oSerializeTxt.write( oSStrOut, oFlag)) {
00041     oFlagsStr = oSStrOut.str();
00042 
00043     std::cout << "TXT 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_txt.cc.

const char* pcFILE_TXT = "archive.txt"

Definition at line 13 of file main_txt.cc.

Referenced by FiletoTXT(), and TXTtoFile().


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