GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConfigurationFrame.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 #ifndef ADF_ConfigurationFrame
25 #include "ConfigurationFrame.h"
26 #endif
27 
28 using namespace ADF;
29 
31 ConcreteFrame(key),
32 fString()
33 {
34  // a configuration rame is evolutive and by default allows of everthing
35  // Migration SharedFP SetFrameChangeFunction(ChangeOfVersion);
36 }
37 
39 {
40  fString = "";
41  const char *buf =
43  fString.assign(buf,fKey->GetDataLength());
44 
45  return UInt_t(fString.size());
46 }
47 
49 {
50  UInt_t size_to_write = UInt_t(fString.size());
51  fBuffer->SetOffset();
52 
53  if ( !fBuffer->Reserve(UInt_t(size_to_write)) ) { // check if enough place
54  fKey->SetDataLength(0u);
55  return 0u;
56  }
57  if ( (*fBuffer).Copy(fString.data(),size_to_write) )
58  fKey->SetDataLength(size_to_write);
59  else
60  fKey->SetDataLength(0u);
61 
62  return fKey->GetDataLength();
63 }
64 
65 /*
66  Bool_t ConfigurationFrame::ChangeFrame(const Version &version)
67  {
68  FactoryItem newitem(GetSignature());
69 
70  newitem.SetVersion(version);
71  SetSignature(newitem);
72 
73  return true;
74  }
75  */
76 
77 
78 
79 
80 
81 
virtual Bool_t Reserve(UInt_t size)
to reserve a given size (from the current position) to be sure one are able to write something ...
Definition: BufferIO.cpp:199
Base class for a Key.
Definition: Key.h:56
virtual UInt_t GetDataLength() const
Definition: Key.h:134
virtual UInt_t Read()
It reads the content of the string from the Frame.
BufferIO * fBuffer
Definition: Frame.h:310
virtual UInt_t Write()
It writes to the Frame the content of the string.
const Char_t * GetAddress() const
Pointer to the current underlying array of bytes.
Definition: BufferIO.h:216
UInt_t SetOffset(UInt_t off=0u) const
change the current position.
Definition: BufferIO.cpp:122