GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DefaultFrameFactory.cpp
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 
24 #include "DefaultFrameFactory.h"
25 #include "KeyFactory.h"
26 
27 using namespace ADF;
28 
29 DefaultFrameFactory::DefaultFrameFactory(): AFrameFactory<DefaultFrameFactory>("Default")
30 {
31 }
32 
34 {
35  // cannot deal with request asking for a version greater that this version
36  if ( which_frame.GetFactoryVersion() > GetMaxVersion() )
37  return 0x0;
38 
39  // allocation is done in two steps. First Frame, then the SharedFP. Specific ones (inheriting for SharedFP) could be implemented. So far only SharedFP
40  SharedFP *sfp = 0x0; Frame *frame = 0x0;
41 
42 // just a raw Frame
43  if ( which_frame.GetItemName().find("data") == 0 ) {
44  frame = new RawFrame(key);
45  }
46 // any conf frames
47  if ( which_frame.GetItemName().find("conf") == 0 ) {
48  frame = new ConfigurationFrame(key);
49  }
50 
51 // composite frames --------------------------------------------------------------------------- //
52 
53 // composite frames --------------------------------------------------------------------------- //
54 
55  // now return SharedFP. If not specific, and frame is allocated, create a base one and add Frame to it
56  if ( sfp == 0x0 && frame )
57  sfp = new SharedFP(frame);
58 
59  // WARNING : could be 0x0 !
60 
61  return sfp;
62 }
63 
64 
65 
66 
67 
68 
69 
70 
Base class for a Key.
Definition: Key.h:56
Base class for a Frame.
Definition: Frame.h:73
header file for KeyFactory.cpp
Short_t GetMaxVersion() const
this class could managed moddification of the versionned part up to MaxVersion : should be set in the...
Definition: DotConf.h:242
A configuration frame is just an encapsulation of a string.
header file for DefaultFrameFactory.cpp
virtual SharedFP * DoNew(Key *, const FactoryItem &)
Ask this factory for a new Frame.
DefaultFrameFactory,.
Short_t GetFactoryVersion() const
Ask the factory version.
Definition: FactoryItem.h:82
A RawFrame gives direct access to the underlying buffer.
Definition: Frame.h:557
A Shared Frame Pointer.
Definition: Frame.h:597
Base class for any kind of Frame factory.
Definition: FrameFactory.h:181
const std::string & GetItemName() const
Definition: FactoryItem.h:78
Base class that described an item in a Factory.
Definition: FactoryItem.h:52