// @(#)root/meta:$Id$
// Author: Victor Perev and Philippe Canal   08/05/02

/*************************************************************************
 * Copyright (C) 1995-2003, Rene Brun, Fons Rademakers and al.           *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TMemberStreamer
#define ROOT_TMemberStreamer

#include "Rtypes.h"
#include "TClassRef.h"

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TMemberStreamer is used to stream a data member.                     //
//                                                                      //
// The address passed to operator() will be the address of the data     //
// member.                                                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

class TMemberStreamer {
protected:
   TMemberStreamer() : fStreamer(0) {};

public:
   TMemberStreamer(MemberStreamerFunc_t pointer) : fStreamer(pointer) {};
   TMemberStreamer(const TMemberStreamer &rhs) : fStreamer(rhs.fStreamer) {};
   TMemberStreamer &operator=(const TMemberStreamer &rhs) { fStreamer = rhs.fStreamer; return *this; }

   virtual  ~TMemberStreamer(){};

   virtual void SetOnFileClass( const TClass* cl ) { fOnFileClass = const_cast<TClass*>(cl); }
   virtual const TClass* GetOnFileClass() const { return fOnFileClass; }

   virtual void operator()(TBuffer &b, void *pmember, Int_t size=0)
   {
      // The address passed to operator() will be the address of the data member.
      // If the data member is a variable size array, 'size' is the number of elements
      // to read/write

      (*fStreamer)(b,pmember,size);
   }

private:
   MemberStreamerFunc_t fStreamer;
   TClassRef            fOnFileClass;
};

#endif
 TMemberStreamer.h:1
 TMemberStreamer.h:2
 TMemberStreamer.h:3
 TMemberStreamer.h:4
 TMemberStreamer.h:5
 TMemberStreamer.h:6
 TMemberStreamer.h:7
 TMemberStreamer.h:8
 TMemberStreamer.h:9
 TMemberStreamer.h:10
 TMemberStreamer.h:11
 TMemberStreamer.h:12
 TMemberStreamer.h:13
 TMemberStreamer.h:14
 TMemberStreamer.h:15
 TMemberStreamer.h:16
 TMemberStreamer.h:17
 TMemberStreamer.h:18
 TMemberStreamer.h:19
 TMemberStreamer.h:20
 TMemberStreamer.h:21
 TMemberStreamer.h:22
 TMemberStreamer.h:23
 TMemberStreamer.h:24
 TMemberStreamer.h:25
 TMemberStreamer.h:26
 TMemberStreamer.h:27
 TMemberStreamer.h:28
 TMemberStreamer.h:29
 TMemberStreamer.h:30
 TMemberStreamer.h:31
 TMemberStreamer.h:32
 TMemberStreamer.h:33
 TMemberStreamer.h:34
 TMemberStreamer.h:35
 TMemberStreamer.h:36
 TMemberStreamer.h:37
 TMemberStreamer.h:38
 TMemberStreamer.h:39
 TMemberStreamer.h:40
 TMemberStreamer.h:41
 TMemberStreamer.h:42
 TMemberStreamer.h:43
 TMemberStreamer.h:44
 TMemberStreamer.h:45
 TMemberStreamer.h:46
 TMemberStreamer.h:47
 TMemberStreamer.h:48
 TMemberStreamer.h:49
 TMemberStreamer.h:50
 TMemberStreamer.h:51
 TMemberStreamer.h:52
 TMemberStreamer.h:53
 TMemberStreamer.h:54
 TMemberStreamer.h:55