23 #ifndef ADF_KeyFactory
29 #ifndef ADF_ConfigurationFrame
39 fSignature(
"Default",
"",
Version(0,0)),
49 fSignature(
"Default",
"",
Version(0,0)),
60 Bool_t ok; std::string opt = option;
62 std::ifstream filein(name);
63 if ( filein.is_open() == true ) {
71 std::ofstream fileout(name);
72 if ( fileout.is_open() == true ) {
84 Bool_t ok; std::string opt = option;
90 std::istringstream in;
92 in.str((confframe->
String()));
97 std::ostringstream out;
99 confframe->
String() = out.str();
185 dfile = ::fopen(filename,
"wb");
187 dfile = ::fopen(filename,
"ab");
232 UInt_t bwritten, offset, toadd; std::string s, send;
234 send =
"||||||||||||";
251 Reset(); (*fBuffer).Reserve(repetition*UInt_t(s.size())+toadd);
253 for (UInt_t i = 0u; i < repetition; i++ ) {
254 if ( (*fBuffer).Import(s.data(),UInt_t(s.size())) != s.size() )
257 bwritten += UInt_t(s.size());
260 (*fBuffer).Import(send.data(),toadd); bwritten += toadd;
262 fKey->SetDataLength(bwritten);
277 Frame *oldf = fFrame;
virtual const BufferIO * GetRealBuffer() const
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 ...
virtual Bool_t Copy(const Char_t *buf, UInt_t size, const char opt= 'b')
copy a buffer to this Frame
virtual Key * GetKey()=0
To get the Key associated to this frame.
header file for KeyFactory.cpp
Bool_t ChangeOfVersion(const FactoryItem &item_from, const FactoryItem &item_to)
change from item_from to item_to is allowed if they differ only by the item version number ...
const FactoryItem & GetSignature() const
virtual BufferIO * RealBuffer()
Used by specific methods.
A configuration frame is just an encapsulation of a string.
virtual Bool_t Load(FILE *)
load a Frame from a C file (for debugging) - return the number of bytes read
virtual const BufferIO * GetRealBuffer() const =0
give access to the underlying buffer of the data part
virtual void Dump(const Char_t *filename, Bool_t anew=false) const
Dump the content of the frame in a file (for debugging)
virtual Key * GetKey()
To get the Key associated to this frame.
virtual UInt_t GetDataLength() const
virtual Bool_t Link(const Char_t *buf, UInt_t size, const char opt= 'b')
Link a buffer to this Frame.
virtual BaseBuffer::EEndian GetEndian() const
virtual UInt_t Read()
It reads the content of the string from the Frame.
virtual Bool_t Configure(const char *name, const char *option)
configuration from/to a file
virtual void Stallion(UInt_t repetition=4u)
Fill the frame with a given pattern (used for debugging)
header file for Frame.cpp
virtual UInt_t GetKeyLength() const
Unique number corresponding to a type of Key.
virtual void Reset()
copy the sub-frame #i to the Frame given in the second argument
Base class for version numbers.
static EEndian SysEndian()
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.
const std::string & GetFactoryName() const
std::string GetString() const
static BufferIO * New(BaseBuffer::EEndian e, UInt_t s=aByte)
return the right buffer taking Into account the endian argument compared to the underlying endian sys...
Frame()
To avoid direct creation of a Frame.
Version GetVersion() const
virtual Frame * SetFrame(Frame *)
change the frame, returns the current one
UInt_t Import(const Char_t *from, UInt_t size_ext_buf)
Import the given array in this buffer.
virtual Bool_t DoConfigure(std::istream &)
configure this from an input stream
const std::string & GetItemName() const
virtual UInt_t GetFrameLength() const
const FactoryItem & GetSignature() const
Signature of that frame.
UInt_t SetOffset(UInt_t off=0u) const
change the current position.