MyClass.cxx
Go to the documentation of this file.
1 // MyClass.cxx
2 
3 #include "MyClass.h"
4 #include <iostream>
5 #include <string>
6 #include "TBuffer.h"
7 #include "TClass.h"
8 
9 using std::cout;
10 using std::endl;
11 using std::string;
12 
14  cout << "Creating object." << endl;
15 }
16 
18  cout << "Deleting object." << endl;
19  delete myobj;
20 }
21 
22 void MyClass::Streamer(TBuffer& buf) {
23  const string myname = "MyClass: ";
24  //TClass* pclass = MyClass::Class(); // With TObject?
25  TClass* pclass = TClass::GetClass("MyClass");
26  if ( buf.IsReading() ) {
27  if ( pclass == nullptr ) {
28  cout << myname << "Dictionary not found for read." << endl;
29  return;
30  }
31  cout << myname << "Reading object." << endl;
32  pclass->ReadBuffer(buf, this);
33  ++readCount;
34  } else {
35  if ( pclass == nullptr ) {
36  cout << myname << "Dictionary not found for write." << endl;
37  return;
38  }
39  cout << myname << "Writing object." << endl;
40  pclass->WriteBuffer(buf, this);
41  }
42 }
MyClass()
Definition: MyClass.cxx:13
std::string string
Definition: nybbler.cc:12
~MyClass()
Definition: MyClass.cxx:17
unsigned int readCount
Definition: MyClass.h:20
void Streamer(TBuffer &rbuf)
Definition: MyClass.cxx:22
TObject * myobj
Definition: MyClass.h:19
QTextStream & endl(QTextStream &s)