GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DefaultKeyFactory.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 
23 #ifndef ADF_DefaultKeyFactory
24 #include "DefaultKeyFactory.h"
25 #endif
26 
27 using namespace ADF;
28 
30 {
31  // cannot deal with request asking for a version greater that this version
32  if ( item.GetFactoryVersion() > GetMaxVersion() )
33  return 0x0;
34 
35  Key *key = 0x0;
36 
37  if( item.GetItemName().find("FS") == 0 ) {
38  if ( item.GetVersion() == Version(0,0) ) {
39  key = new FSKey_0_0(GetEndian()); // Frame length coded with 2 bytes
40  }
41  if ( item.GetVersion() == Version(0,1) ) {
42  key = new FSKey_0_1(GetEndian()); // Frame length coded with 4 bytes
43  }
44  }
45  if( item.GetItemName().find("UID") == 0 ) {
46  if ( item.GetVersion() == Version(0,0) ) {
47  key = new UIDKey_0_0(GetEndian()); // frame length is cst, not coded, id on 4 bytes
48  }
49  if ( item.GetVersion() == Version(0,1) ) {
50  key = new UIDKey_0_1(GetEndian()); // frame length is cst, not coded, id on 8 bytes
51  }
52  if ( item.GetVersion() == Version(1,0) ) {
53  key = new UIDKey_1_0(GetEndian()); // Frame length coded with 2 bytes, id on 4 bytes
54  }
55  if ( item.GetVersion() == Version(1,1) ) {
56  key = new UIDKey_1_1(GetEndian()); // Frame length coded with 2 bytes, id on 8 bytes
57  }
58  }
59  return key;
60 }
61 
62 
63 
Base class for a Key.
Definition: Key.h:56
header file for DefaultKeyFactory.cpp
virtual BaseBuffer::EEndian GetEndian() const
Endian type for the keys delivered by this factory.
Definition: KeyFactory.h:99
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
UIDKey used for sequences of frames with variable length starting associated to an id which could be ...
UIDKey used for sequences of frames with contant length starting with a id which could be event # or ...
FSKey_0_1 The length of the frame is coded on 4 bytes.
Short_t GetFactoryVersion() const
Ask the factory version.
Definition: FactoryItem.h:82
Base class for version numbers.
Definition: Version.h:38
virtual Key * DoNew(const FactoryItem &)
Ask this factory for a new DefaultKeyFactory.
UIDKey used for sequences of frames with contant length starting with a id which could be event # or ...
FSKey_0_0 The length of the frame is coded on 2 bytes (UShort_t, max size: 65534) ...
UIDKey used for sequences of frames with contant length starting with a id which could be event # or ...
Version GetVersion() const
Definition: FactoryItem.h:88
const std::string & GetItemName() const
Definition: FactoryItem.h:78
Base class that described an item in a Factory.
Definition: FactoryItem.h:52