GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GenericFrame.h
Go to the documentation of this file.
1 
2 #ifndef ADF_ProxyFrame
3 #define ADF_ProxyFrame
4 
5 #ifndef ADF_Frame
6 #include "Frame.h"
7 #endif
8 #ifndef ADF_ConfigurationFrame
9 #include "ConfigurationFrame.h"
10 #endif
11 #ifndef ADF_FrameFactory
12 #include "FrameFactory.h"
13 #endif
14 
15 namespace ADF
16 {
17 
19 
22 template <typename Data_T>
23 class DataFrame
24 {
25 public:
27  {;}
28  virtual ~DataFrame()
29  {;}
30 
31  virtual const Data_T *GetData() const = 0;
32  virtual Data_T *Data() = 0;
33 };
34 
36 
38 template <typename Data_T>
39 class ConcreteDataFrame : public RawFrame, public DataFrame<Data_T>, protected Data_T
40 //class ConcreteDataFrame : public ConcreteFrame, public DataFrame<Data_T>, public Data_T
41 {
42 public:
44  RawFrame(key), DataFrame<Data_T>(), Data_T() {;}
46  {;}
47 
48  virtual const Data_T *GetData() const
49  { return this; }
50 
51  virtual Data_T *Data()
52  { return this; }
53 };
54 
56 template <class Data_T>
57 Data_T *GetDataPointer(Frame *f)
58 {
59  Data_T *data = 0x0;
60 
61  if ( f == 0x0 )
62  return data;
63 
64  DataFrame<Data_T> *dataframe = dynamic_cast< DataFrame<Data_T> * >(f) ;
65  if ( dataframe )
66  data = dataframe->Data();
67 
68  return data;
69 }
70 template <class Data_T>
71 const Data_T *GetCstDataPointer(Frame *f)
72 {
73  const Data_T *data = 0x0;
74 
75  if ( f == 0x0 )
76  return data;
77 
78  DataFrame<Data_T> *dataframe = dynamic_cast< DataFrame<Data_T> * >(f) ;
79  if ( dataframe )
80  data = dataframe->GetData();
81 
82  return data;
83 }
84 template <class Data_T>
86 {
87  Data_T *data = 0x0;
88 
89  if ( fp == 0x0 )
90  return data;
91  else
92  if ( fp->GetFrame() == 0x0 )
93  return data;
94 
95  DataFrame<Data_T> *dataframe = dynamic_cast< DataFrame<Data_T> * >(fp->GetFrame()) ;
96  if ( dataframe )
97  data = dataframe->Data();
98 
99  return data;
100 }
101 template <class Data_T>
102 const Data_T *GetCstDataPointer(SharedFP *fp)
103 {
104  const Data_T *data = 0x0;
105 
106  if ( fp == 0x0 )
107  return data;
108  else
109  if ( fp->GetFrame() == 0x0 )
110  return data;
111 
112  DataFrame<Data_T> *dataframe = dynamic_cast< DataFrame<Data_T> * >(fp->GetFrame()) ;
113  if ( dataframe )
114  data = dataframe->Data();
115 
116  return data;
117 }
118 
119 } // namespace ADF
120 #endif
121 
virtual Data_T * Data()
Definition: GenericFrame.h:51
virtual Frame * GetFrame() const
Definition: Frame.h:625
Base class for a Key.
Definition: Key.h:56
Base class for a Frame.
Definition: Frame.h:73
virtual const Data_T * GetData() const =0
ConcreteDataFrame(Key *key)
Definition: GenericFrame.h:43
A DataFrame has a Data Interace that helps streaming ADF objects from/to the underlying Frame...
Definition: GenericFrame.h:23
virtual const Data_T * GetData() const
Definition: GenericFrame.h:48
ConcreteDataFrame : a RawFrame with a data interface.
Definition: GenericFrame.h:39
virtual ~ConcreteDataFrame()
Definition: GenericFrame.h:45
Data_T * GetDataPointer(Frame *f)
to get the data part of a DataFrame
Definition: GenericFrame.h:57
header file for Frame.cpp
A RawFrame gives direct access to the underlying buffer.
Definition: Frame.h:557
virtual Data_T * Data()=0
A Shared Frame Pointer.
Definition: Frame.h:597
virtual ~DataFrame()
Definition: GenericFrame.h:28
header file for FrameFactory.cpp
const Data_T * GetCstDataPointer(Frame *f)
Definition: GenericFrame.h:71