GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompositeFrame.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef ADF_CompositeFrame
24 #define ADF_CompositeFrame
25 
26 #ifndef ADF_Frame
27 #include "Frame.h"
28 #endif
29 
30 #ifndef ADF_PtrStack
31 #include "PtrStack.h"
32 #endif
33 
34 namespace ADF
35 {
36 
38 
53 {
54 protected:
59 
60 private:
62  PtrStack<Key> fCurrentKeys;
64  PtrStack<Key> fStackOfKeys;
65 
66 protected:
68  CompositeFrame(Key *);
69  CompositeFrame(Key *,const FactoryItem &);
70 
72  Key *NewSubKey();
73 
74 public:
75  virtual ~CompositeFrame();
76 
78 
80  virtual Bool_t IsComposite() const
81  { return true; }
82 
84 
87  virtual UInt_t Read()
88  { return Scan(); }
89 
90  virtual UInt_t Write()
91  { return Scan(); }
92 
94 
96  virtual UInt_t Scan();
97 
99  virtual const Key *GetSubKey(UInt_t which) const {
100  Key *key = fCurrentKeys.At(which);
101  if ( key )
102  return key;
103  return fKey;
104  }
105 
107 
109  virtual UInt_t GetNbSubFrame() const
110  { return fCurrentKeys.GetSize(); }
111 
113 
116  virtual Bool_t IsASubFrame(const Frame &);
117 
119 
122  virtual Bool_t AddSubFrame(const Frame &);
123 
125 
130  virtual Bool_t LinkSubFrame(UInt_t , Frame *) ;
131 
133 
135  //virtual Bool_t CopySubFrame(UInt_t, Frame *) { return false; }
136 
138  virtual Bool_t TransfertSubFrame(const Frame &from, UInt_t whichsub);
139 
141 
148  virtual void Reset()
149  { ConcreteFrame::Reset(); fCurrentKeys.Clear(); }
150 
152  virtual void FastReset()
153  { ConcreteFrame::FastReset(); fCurrentKeys.Clear(); }
154 };
155 
156 // CompositeFrame inline members //////////////////////////////////////////////////////
157 
158 } // namespace ADF
159 #endif
160 
161 
162 
163 
virtual const Key * GetSubKey(UInt_t which) const
to get one of the key composing the buffer. if out of range, return the main key
virtual void Reset()
Reset the current frame.
Base class for a Key.
Definition: Key.h:56
Base class for a Frame.
Definition: Frame.h:73
virtual Bool_t IsASubFrame(const Frame &)
to check if a subframe could be added to the composite frame
Key * fSubKeyConst
ConstKey remains unchanged (unlinked) to be sure the comparison IsAKey is always good.
virtual UInt_t Write()
It writes to the Frame the content of the dedicated structures.
virtual Bool_t AddSubFrame(const Frame &)
Add a subframe to that frame (only if composite)
header file for Frame.cpp
virtual void Reset()
copy the sub-frame #i to the Frame given in the second argument
Definition: Frame.h:522
Base class for a CompositeFrame.
template header file
PtrStack.
Definition: PtrStack.h:59
virtual UInt_t Scan()
Scan this CompositeFrame. If it is a composite frame, it looks for the keys of sub-frames.
Key * NewSubKey()
to get a new subkey
virtual Bool_t LinkSubFrame(UInt_t, Frame *)
Attach the sub-frame corresponding to the given subkey to the Frame given in the second argument...
virtual Bool_t TransfertSubFrame(const Frame &from, UInt_t whichsub)
copy the sub-frame #i to the CompositeFrame given in the second argument
Key * fSubKey
Key used to scan the main frame (link to parts of the main frame)
virtual void FastReset()
FastReset the current frame, means the data part keep the previous values.
virtual void FastReset()
FastReset the current frame, means the data part keep the previous values.
Definition: Frame.h:526
virtual Bool_t IsComposite() const
tells if this frame is a composite frame i.e. if it is composed of sub-frames
virtual UInt_t GetNbSubFrame() const
Returns the number of sub-frames composing this frame. Scan have to be called first.
virtual UInt_t Read()
Reads from the CompositeFrame the content into dedicated structures.
Base class that described an item in a Factory.
Definition: FactoryItem.h:52