00001 #ifndef __PXXVAttWritable__H__ 00002 #define __PXXVAttWritable__H__ 00003 00020 00021 #include "payloads-unpacker/base/PXXPointerCasts.h" 00022 #include "payloads-unpacker/base/PXXTypes.h" 00023 #include <ostream> 00024 using namespace std; 00025 00026 class PXXVAttWritable 00027 { 00028 public: 00029 00030 /* 00031 * Static function to open write destination 00032 */ 00033 static void SetOutputStream(ostream &ostr); 00034 //------------------------------------------------------------------------------ 00035 00036 /* 00037 * Destructor 00038 */ 00039 virtual ~PXXVAttWritable(); 00040 //------------------------------------------------------------------------------ 00041 00045 virtual void WriteProperties() = 0; 00046 //------------------------------------------------------------------------------ 00047 00051 virtual void Indent(string label = ""); 00052 //------------------------------------------------------------------------------ 00053 00057 virtual void Undent(string label = ""); 00058 //------------------------------------------------------------------------------ 00059 00063 virtual void WriteBool(const string &label, Bool8b_t b); 00064 //------------------------------------------------------------------------------ 00065 00069 virtual void WriteByte(const string &label, Char8b_t c); 00070 //------------------------------------------------------------------------------ 00071 00075 virtual void WriteShort(const string &label, Short16b_t s); 00076 //------------------------------------------------------------------------------ 00077 00081 virtual void WriteInt(const string &label, Int32b_t i); 00082 //------------------------------------------------------------------------------ 00083 00087 virtual void WriteLong(const string &label, Long64b_t l); 00088 //------------------------------------------------------------------------------ 00089 00093 virtual void WriteFloat(const string &label, Float32b_t f); 00094 //------------------------------------------------------------------------------ 00095 00099 virtual void WriteDouble(const string &label, Double64b_t d); 00100 //------------------------------------------------------------------------------ 00101 00102 protected: 00103 00104 /* 00105 * Constructor. Must be instanciated as an attribute class object so that 00106 * it should be protected. 00107 */ 00108 PXXVAttWritable(); 00109 //------------------------------------------------------------------------------ 00110 00111 /* 00112 * get static output stream 00113 */ 00114 static ostream &GetOutputStream() { return *fOstream_; } 00115 //------------------------------------------------------------------------------ 00116 00117 private: 00118 00119 static ostream* fOstream_; // output stream to destination 00120 static string fWhiteSpaceIndent_; // white spaces for indent 00121 00122 ClassDef(PXXVAttWritable, 0) // attribute class to add writable feature 00123 }; 00124 00125 #ifdef __USEROOT__ // compile with ROOT 00126 typedef PXXVAttWritable* PXXVAttWritablePtr; 00127 #else // compile woth IceTray 00128 typedef shared_ptr<PXXVAttWritable> PXXVAttWritablePtr; 00129 #endif 00130 00131 #endif // __PXXVAttWritable__H__ 00132