00001 // $Header: /nfs/slac/g/glast/ground/cvs/analysis/analysis/TupleTitle.h,v 1.1.1.1 1999/12/20 22:27:04 burnett Exp $ 00002 #ifndef TUPLETITLE_H 00003 #define TUPLETITLE_H 00004 00005 #include <string> 00006 #include <vector> 00007 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00008 // Virtual base class for the templated header client class 00009 class TitleClientBase { 00010 public: 00011 TitleClientBase(){} 00012 virtual std::string addToTitle()const=0; 00013 }; 00014 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00015 // Template class. If a client has a method, it can add 00016 // itself with the statement 00017 // 00018 // TupleTitle::instance()->add(new Titleclient<Client>(this)); 00019 // 00020 template< class T > 00021 class TitleClient : public TitleClientBase { 00022 public: 00023 TitleClient(const T* t):m_t(t){} 00024 std::string addToTitle()const{ return m_t->addToTitle();} 00025 private: 00026 const T* m_t; 00027 }; 00028 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00029 00030 class TupleTitle : private std::vector<TitleClientBase* > { 00031 public: 00032 TupleTitle(std::string head); 00033 ~TupleTitle(); 00034 00035 void add(TitleClientBase* client); 00036 00037 std::string operator()()const; 00038 // return the result 00039 00040 private: 00041 std::string m_head; 00042 }; 00043 #endif
1.2.3 written by Dimitri van Heesch,
© 1997-2000