GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DFAgent.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2010 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 #include "FactoryItem.h"
24 
25 #ifndef ADF_DFAgent
26 #include "DFAgent.h"
27 #endif
28 #ifndef ADF_KeyFactory
29 #include "KeyFactory.h"
30 #endif
31 #ifndef ADF_ConfigurationFrame
32 #include "ConfigurationFrame.h"
33 #endif
34 
35 #include <ctime>
36 #include <fstream>
37 #include <cstdlib>
38 
39 using namespace ADF;
40 using namespace std;
41 
42 DFAgent::DFAgent(const Char_t *rid, const Char_t *srid, Bool_t is_record, Bool_t global) :
43  DotConf(rid,srid,is_record),
44  fModel(ConfAgent::kStrict),
45  fEndian(BaseBuffer::kLittle),
46  fPrimaryKey("Default","FS",Version(0,1)) ,
47  fAutoConf(),
48  fListOfFrames(),
49  fListOfRequiredKeyFactories(),
50  fListOfRequiredFrameFactories(),
51  fListOfKeyFactories(),
52  fListOfFrameFactories()
53 {
54  fLog.GetProcessName() = "ADF::DFAgent";
55  SetMaxVersion(1);
56 
57  // keep a list of reference to the global factories by default.
58  LinkFactories(global);
59 
60  // frame for automatic reconfiguration
61  fAutoConf.first = FactoryItem("NONE","NONE",Version(0,0));
62  fAutoConf.second = FactoryItem("NONE","NONE",Version(0,0));
63 }
64 
66 {
67  fListOfFrames.clear(); fListOfRequiredKeyFactories.clear(); fListOfRequiredFrameFactories.clear(); fListOfKeyFactories.clear(); fListOfFrameFactories.clear();
68 }
69 
70 void DFAgent::LinkFactories(Bool_t global)
71 {
72  if ( global ) {
73  // Collect the list of key and frame factories from the MainFactories
74  for (UInt_t i = 0u; i < MainKeyFactory::theMainFactory().ListOfFactories().size(); i++) {
75  // keep the pointer
76  fListOfKeyFactories.push_back(MainKeyFactory::theMainFactory().ListOfFactories()[i]);
77  }
78  }
79  else
80  MainKeyFactory::theMainFactory().Clone(fListOfKeyFactories);
81  // now add they back as configurable objects
82  std::list< KeyFactory * >::iterator
83  key_listed_item;
84  for ( key_listed_item = fListOfKeyFactories.begin() ; key_listed_item != fListOfKeyFactories.end() ; key_listed_item++ ) {
85  // add it the list of reconfigurable objects
86  AddConf((*key_listed_item));
87  }
88 
89  if ( global ) {
90  for (UInt_t i = 0u; i < MainFrameFactory::theMainFactory().ListOfFactories().size(); i++) {
91  // keep the pointer
92  fListOfFrameFactories.push_back(MainFrameFactory::theMainFactory().ListOfFactories()[i]);
93  }
94  }
95  else
96  MainFrameFactory::theMainFactory().Clone(fListOfFrameFactories);
97  // now add as configurable objects
98  std::list< FrameFactory * >::iterator
99  frame_listed_item;
100  for ( frame_listed_item = fListOfFrameFactories.begin() ; frame_listed_item != fListOfFrameFactories.end() ; frame_listed_item++ ) {
101  // add it the list of reconfigurable objects
102  AddConf((*frame_listed_item));
103  }
104 }
105 
107 {
108  KeyFactory *fact = 0x0;
109 
110  std::list< KeyFactory * >::iterator
111  listed_item;
112  for ( listed_item = fListOfKeyFactories.begin(); listed_item != fListOfKeyFactories.end() ; listed_item++ ) {
113  if ( ((*listed_item)->GetName() == item.GetFactoryName()) && ((*listed_item)->GetMaxVersion() >= item.GetFactoryVersion()) ) {
114  fact = (*listed_item);
115  }
116  }
117  return fact;
118 }
119 
121 {
122  FrameFactory *fact = 0x0;
123 
124  std::list< FrameFactory * >::iterator
125  listed_item;
126  for ( listed_item = fListOfFrameFactories.begin(); listed_item != fListOfFrameFactories.end() ; listed_item++ ) {
127  if ( (*listed_item)->GetName() == item.GetFactoryName() && (*listed_item)->GetMaxVersion() >= item.GetFactoryVersion() ) {
128  fact = (*listed_item);
129  }
130  }
131  return fact;
132 }
133 
134 Bool_t DFAgent::SetKnownKeyFactory(const FactoryItem &factory_item)
135 {
136  // check the asked factory is known and compatible with the current version
137  KeyFactory *factory = GetKeyFactory(factory_item);
138  if ( factory == 0x0 )
139  return false;
140 
141  // -1 : new, +1 already in the list and modified for the new conditions, 0 remove because of incompatible version #
142  Short_t what = -1;
143 
144  // if already in the list, just change the version or remove it if incompatible versions
145  std::list< FactoryItem >::iterator
146  listed_item;
147  for ( listed_item = fListOfRequiredKeyFactories.begin() ; listed_item != fListOfRequiredKeyFactories.end() ; listed_item++ ) {
148  if ( (*listed_item).GetFactoryName() == factory_item.GetFactoryName() ) {
149  // already in the list
150  if ( (*listed_item).GetFactoryVersion() >= factory_item.GetFactoryVersion() ) {
151  (*listed_item).SetFactoryVersion(factory_item.GetFactoryVersion());
152  (*listed_item).SetFactoryPtr(factory);
153  //
154  what = 1;
155  }
156  else { // incompatible ==> remove from the list
157  fListOfRequiredKeyFactories.remove((*listed_item));
158  //
159  what = 0;
160  }
161  break;
162  }
163  }
164 
165  if ( what == -1 ) { // not yet known, add a new item in the list
166  FactoryItem l_item(factory_item);
167  //
168  l_item.SetFactoryPtr(factory);
169  fListOfRequiredKeyFactories.push_back(l_item);
170  }
171 
172  return what != 0;
173 }
174 
175 Bool_t DFAgent::SetKnownFrameFactory(const FactoryItem &factory_item)
176 {
177  // check the asked factory is known and compatible with the current version
178  FrameFactory *factory = GetFrameFactory(factory_item);
179  if ( factory == 0x0 )
180  return false;
181 
182  // -1 : new, +1 already in the list and modified for the new conditions, 0 remove because of incompatible version #
183  Short_t what = -1;
184 
185  // if already in the list, just change the version or remove it if incompatible versions
186  std::list< FactoryItem >::iterator
187  listed_item;
188  for ( listed_item = fListOfRequiredFrameFactories.begin() ; listed_item != fListOfRequiredFrameFactories.end() ; listed_item++ ) {
189  if ( (*listed_item).GetFactoryName() == factory_item.GetFactoryName() ) {
190  // already in the list
191  if ( (*listed_item).GetFactoryVersion() >= factory_item.GetFactoryVersion() ) {
192  (*listed_item).SetFactoryVersion(factory_item.GetFactoryVersion());
193  (*listed_item).SetFactoryPtr(factory);
194  //
195  what = 1;
196  }
197  else { // incompatible ==> remove from the list
198  fListOfRequiredFrameFactories.remove((*listed_item));
199  //
200  what = 0;
201  }
202  break;
203  }
204  }
205 
206  if ( what == -1 ) { // not yet known, add a new item in the list
207  FactoryItem l_item(factory_item);
208  //
209  l_item.SetFactoryPtr(factory);
210  fListOfRequiredFrameFactories.push_back(l_item);
211  }
212 
213  return what != 0;
214 }
215 
216 Bool_t DFAgent::SetAsCompatibleKeyItem(FactoryItem &factory_item) const
217 {
218  Bool_t ok = false;
219 
220  std::list< FactoryItem >::iterator
221  listed_item;
222  for ( listed_item = fListOfRequiredKeyFactories.begin() ; listed_item != fListOfRequiredKeyFactories.end() ; listed_item++ ) {
223  if ( (*listed_item).GetFactoryName() == factory_item.GetFactoryName() ) {
224 
225  factory_item.SetFactoryVersion((*listed_item).GetFactoryVersion());
226  factory_item.SetFactoryPtr((*listed_item).GetFactoryPtr());
227 
228  ok = true;
229 
230  break;
231  }
232  }
233  return ok;
234 }
235 
237 {
238  Bool_t ok = false;
239 
240  std::list< FactoryItem >::iterator
241  listed_item;
242  for ( listed_item = fListOfRequiredFrameFactories.begin() ; listed_item != fListOfRequiredFrameFactories.end() ; listed_item++ ) {
243  if ( (*listed_item).GetFactoryName() == factory_item.GetFactoryName() ) {
244 
245  factory_item.SetFactoryVersion((*listed_item).GetFactoryVersion());
246  factory_item.SetFactoryPtr((*listed_item).GetFactoryPtr());
247 
248  ok = true;
249 
250  break;
251  }
252  }
253  return ok;
254 }
255 
257 {
258  return fPrimaryKey;
259 }
260 
262 {
263  fPrimaryKey = item;
264 }
265 
266 void DFAgent::AddKnownFrame(const FactoryItem &item_key, const FactoryItem &item_frame, const Char_t opt)
267 {
268  // in case reset of the known frame is asked
269  if ( opt == 'r' )
270  fListOfFrames.clear();
271 
272  Bool_t ok = false;
273  //
274  std::list< std::pair<FactoryItem,FactoryItem> >::iterator
275  listed_item;
276  for ( listed_item = fListOfFrames.begin() ; listed_item != fListOfFrames.end() ; listed_item++ ) {
277  if ( (*listed_item).first.IsAVersion(item_key) && (*listed_item).second.IsAVersion(item_frame) ) {
278  if ( opt == '-' )
279  fListOfFrames.remove((*listed_item));
280  else {
281  (*listed_item).first.SetVersion(item_key.GetVersion());
282  (*listed_item).second.SetVersion(item_frame.GetVersion());
283  ok = true;
284  }
285  break;
286  }
287  }
288  if ( !ok ) {
289  pair <FactoryItem,FactoryItem> p;
290  p.first = item_key;
291  p.second = item_frame;
292 
293  fListOfFrames.push_back(p);
294  }
295 }
296 
297 void DFAgent::AddKnownFrame(const Frame *frame, const Char_t opt)
298 {
299  if ( frame )
300  AddKnownFrame(frame->GetKey()->GetSignature(),frame->GetSignature(),opt);
301 }
302 
303 void DFAgent::Reset(const Char_t *opt)
304 {
305  // Reset only this not the list of factories associated !
306  std::string option = opt;
307 
308  /*fComment = "Reset"; */ SetLastModif();
309 
310  fEndian = BaseBuffer::kLittle;
311  fPrimaryKey = FactoryItem("Default","FS",Version(0,1));
312 
313  fAutoConf.first = FactoryItem("NONE","NONE",Version(0,0));
314  fAutoConf.second = FactoryItem("NONE","NONE",Version(0,0));
315 
316  fListOfFrames.clear(); fListOfRequiredKeyFactories.clear(); fListOfRequiredFrameFactories.clear();
317 }
318 
320 {
321  if ( fEndian == e )
322  return;
323 
324  // change local
325  fEndian = BaseBuffer::kLittle;
326  // and apply modification to all the key factories related to this agent
327  std::list< KeyFactory * >::iterator
328  listed_item;
329  for ( listed_item = fListOfKeyFactories.begin(); listed_item != fListOfKeyFactories.end() ; listed_item++ ) {
330  (*listed_item)->SetEndian(e);
331  }
332 }
333 
334 UShort_t DFAgent::IsAKnownFrame (const FactoryItem &to_key, const FactoryItem &to_frame, PF_FactoryItemChange pfk, PF_FactoryItemChange pff) const
335 {
336  UShort_t ok; Bool_t ok_key, ok_frame; FactoryItem l_to_key(to_key), l_to_frame(to_frame);
337 
338  // set version and factory instance for the items as known by the Agent
339  SetAsCompatibleItems(l_to_key, l_to_frame);
340  // now look if pure item part is known under the required changes
341  ok = 0u;
342  std::list< std::pair<FactoryItem,FactoryItem> >::iterator
343  listed_item;
344  for ( listed_item = fListOfFrames.begin() ; listed_item != fListOfFrames.end() ; listed_item++ ) {
345  ok_key = pfk ( (*listed_item).first , l_to_key );
346  ok_frame = pff ( (*listed_item).second , l_to_frame );
347  if ( ok_key && ok_frame )
348  { ok++; }
349  }
350  return ok;
351 }
352 
354 {
355  FactoryItem ok; Bool_t ok_key, ok_frame;
356 
357  std::list< pair<FactoryItem,FactoryItem> >::iterator
358  listed_item;
359  for ( listed_item = fListOfFrames.begin() ; listed_item != fListOfFrames.end() ; listed_item++ ) {
360  ok_key = pfk ( (*listed_item).first , to_key );
361  ok_frame = pff ( (*listed_item).second , to_frame );
362  if ( ok_key && ok_frame ) {
363  ok = (*listed_item).first;
364  break;
365  }
366  }
367  return ok;
368 }
369 
371 {
372  FactoryItem ok; Bool_t ok_key, ok_frame;
373 
374  std::list< pair<FactoryItem,FactoryItem> >::iterator
375  listed_item;
376  for ( listed_item = fListOfFrames.begin() ; listed_item != fListOfFrames.end() ; listed_item++ ) {
377  ok_key = pfk ( (*listed_item).first , to_key );
378  ok_frame = pff ( (*listed_item).second , to_frame );
379  if ( ok_key && ok_frame ){
380  ok = (*listed_item).second;
381  break;
382  }
383  }
384  return ok;
385 }
386 
387 Bool_t DFAgent::ProcessLine(const string &aline)
388 {
389  string tmp1, tmp2, tmp3, tmp4, tmp5; UInt_t ui1, ui2, ui3, ui4, ui5; FactoryItem factory_item;
390 
391  // true unless something wrong
392  Bool_t ok_decode = true;
393 
394  //endian of the data flow
395  if ( aline.find("Endian:") == 0 ) {
396  // keyword : endian - actions : change local data member and apply modifications to all the factories linked with this
397  istringstream decode(aline);
398  // just to be sure ...
399  decode.clear();
400  decode >> tmp1 >> tmp2;
401  if ( decode.good() ) { // expected format
402  if ( tmp2 == "kLittle" ) {
404  }
405  if ( tmp2 == "kBig" ) {
407  }
408 
409  }
410  else ok_decode = false;
411  }
412 
413  // check if needed Key factories exist
414  if ( aline.find("KeyFactory:") == 0 ) {
415  // keyword : Keyfactory - action : check the factory exists and in case add it to the list of known factories
416  istringstream decode(aline);
417  // just to be sure ...
418  decode.clear();
419  decode >> tmp1 >> tmp2 ;
420  if ( decode.good() ) { // expected format
421  // now check for KeyFactory version and add to the known list of factory only if the version number is not greater that the registered one
422  Short_t factory_version; decode >> factory_version;
423  //
424  if ( ! decode.good() )
425  factory_version = -1; // if not given means unversionned
426  //
427  factory_item.SetItem(tmp2.data(),factory_version,"",Version(0,0));
428  if ( ! SetKnownKeyFactory(factory_item) ) {
429  fLog << error
430  << "The KeyFactory " << factory_item << " is not registered !! \n";
431  }
432  }
433  else ok_decode = false;
434  }// tmp.find("KeyFactory:") == 0 check if needed factories exist
435 
436  // check needed Frame factories exist
437  if ( aline.find("FrameFactory:") == 0 ) { // keyword : Framefactory - action : check the factory exists and in case add it to the list of known factories
438  istringstream decode(aline);
439  // just to be sure ...
440  decode.clear();
441  decode >> tmp1 >> tmp2 ;
442  if ( decode.good() ) { // expected format
443  // now check for Factory version and add to the known list of factory only if the version number is not greater that the registered one
444  Short_t factory_version; decode >> factory_version;
445  //
446  if ( ! decode.good() )
447  factory_version = -1; // if not given means unversionned
448 
449  factory_item.SetItem(tmp2.data(),factory_version,"",Version(0,0));
450  if ( ! SetKnownFrameFactory(factory_item) ) {
451  fLog << error
452  << "The Frame Factory " << factory_item << " is not registered !! \n";
453  }
454  }
455  else ok_decode = false;
456  }// tmp.find("FrameFactory:") == 0 check needed factories exist
457 
458  if ( aline.find("PrimaryKey:") == 0 ) {
459  // Keyword : PrimaryKey - action : check if the key exist. this should be a simple key, that exists whatever the factory versions and configuration, so check if it exists before changes
460  istringstream decode(aline);
461  // just to be sure ...
462  decode.clear();
463  decode >> tmp1 >> tmp2 >> tmp3 >> ui1 >> ui2;
464 
465  if ( decode.good() ) { // expected format
466  // get the factory version for this particular key
467  FactoryItem factory_item(tmp2.data(),-1,tmp3.data(),Version(ui1,ui2));
468  SetAsCompatibleKeyItem(factory_item);
469  //
470  Key *tmpkey = 0x0;
471  tmpkey =
472  MainKeyFactory::theMainFactory().New(factory_item); // thanks to reference the request goes to the right factory
473 
474  // valid key, otherwise does not change defaults
475  if ( tmpkey ) {
476  fPrimaryKey = factory_item;
477  delete tmpkey;
478  }
479  else {
480  fLog << error
481  << "PrimaryKey " << factory_item << " is not known \n";
482  }
483  }
484  else ok_decode = false;
485  } // this is the primary key (input)
486 
487  if ( aline.find("AutoConf:") == 0 ) {
488  // Keyword : autoconf - action : check if the frame could be created - Autoconf trigs reconfiguration so cannot depend on reconf of factories => must exist as this level
489  //
490  FactoryItem itemkey, itemframe;
491  //
492  istringstream decode(aline);
493  // just to be sure ...
494  decode.clear();
495  decode >> tmp1 >> tmp2 >> tmp3 >> ui2 >> ui3 >> tmp4 >> tmp5 >> ui4 >> ui5 ;
496  //
497  if ( decode.good() ) { // expected format
498  // item of key & frame
499  itemkey.SetItem(tmp2.data(),-1,tmp3.data(),Version(ui2,ui3)); itemframe.SetItem(tmp4.data(),-1,tmp5.data(),Version(ui4,ui5));
500  // prepare they to be compatible with the current definition of the data flow ...
501  SetAsCompatibleItems(itemkey,itemframe);
502  // ... and ask main factory to do the job of allocation
503  SharedFP *tmpframe =
504  MainFrameFactory::theMainFactory().NewSharedFrame(itemkey,itemframe);
505  if ( tmpframe ) {
506  fAutoConf.first = itemkey;
507  fAutoConf.second = itemframe;
508  }
509  else {
510  fLog << warning
511  << "AutoConf " << itemkey << itemframe << " is not known by the system @ this level " << nline;
512  }
513  if ( tmpframe ) {
514  delete tmpframe;
515  }
516  }
517  else ok_decode = false;
518  }// this is the primary key (for output)
519 
520  if ( aline.find("Frame:") == 0 ) {
521  // Keyword : Frame - action : check compatible with known factories: if yes add to the list of frame with its version #. it is unique !
522  // so if a frame with the same factory and type already exists, it changes its version #
523  // As well, a frame with a unknown factory is not added or removed
524  //
525  std::istringstream decode(aline);
526  // just to be sure ...
527  decode.clear();
528  decode >> tmp1 >> tmp2 >> tmp3 >> ui2 >> ui3 >> tmp4 >> tmp5 >> ui4 >> ui5 ;
529  // factory version from the given factories
530  FactoryItem itemkey, itemframe;
531  itemkey.SetItem(tmp2.data(),-1,tmp3.data(),Version(ui2,ui3)); itemframe.SetItem(tmp4.data(),-1,tmp5.data(),Version(ui4,ui5));
532  //
533  if ( decode.good() ) { // expected format and compatible factories
534  if ( SetAsCompatibleItems(itemkey,itemframe) )
535  AddKnownFrame(itemkey, itemframe, '+'); // add or change
536  else {
537  AddKnownFrame(itemkey, itemframe, '-'); // remove
538  fLog << warning
539  << " Frame " << itemkey << itemframe << " is not known by the system, so not added to the DFAgent " << nline;
540  }
541  }
542  else
543  ok_decode = false;
544 
545  } // if ( tmp.find("Frame:") == 0 )
546 
547  return ok_decode;
548 }
549 
550 Bool_t DFAgent::DoConfigure (ostream &out)
551 {
552  out.clear();
553 
554  // add a start record
555  AddRecord(out,'b');
556 
557  out << "# Endian type \n";
558  out << "Endian: ";
559  if ( fEndian == BaseBuffer::kLittle )
560  out << "kLittle \n";
561  else
562  out << "kBig \n";
563  out << "# Factories (and version) for Frames & Keys \n" ;
564  // loop on required factories
565  std::list< FactoryItem >::iterator
566  listed_item;
567  for (listed_item = fListOfRequiredKeyFactories.begin(); listed_item != fListOfRequiredKeyFactories.end() ; listed_item++ ){
568  out << "KeyFactory: " << (*listed_item).GetFactoryName() << " " << (*listed_item).GetFactoryVersion() << " \n";
569  }
570  for (listed_item = fListOfRequiredFrameFactories.begin(); listed_item != fListOfRequiredFrameFactories.end() ; listed_item++ ){
571  out << "FrameFactory: " << (*listed_item).GetFactoryName() << " " << (*listed_item).GetFactoryVersion() << " \n";
572  }
573  out << "# Version of the primary keys that structure the data flow \n";
574  out << "PrimaryKey: " << fPrimaryKey.GetFactoryName() << " " << fPrimaryKey.GetItemName() << " " << fPrimaryKey.GetVersion().GetMajor() << " " << fPrimaryKey.GetVersion().GetMinor() << " \n";
575  out << "AutoConf: " << fAutoConf.first.GetFactoryName() << " " << fAutoConf.first.GetItemName() << " " << fAutoConf.first.GetVersion().GetMajor() << " " << fAutoConf.first.GetVersion().GetMinor() << " "
576  << fAutoConf.second.GetFactoryName() << " " << fAutoConf.second.GetItemName() << " " << fAutoConf.second.GetVersion().GetMajor() << " " << fAutoConf.second.GetVersion().GetMinor() << " \n";
577  out << "# Current Frames going through the data flow \n";
578  // loop on frames defining the data flow
579  std::list< pair<FactoryItem,FactoryItem> >::iterator
580  listed_fitem;
581  for (listed_fitem = fListOfFrames.begin(); listed_fitem != fListOfFrames.end(); listed_fitem++ ){
582  out << "Frame: " << (*listed_fitem).first.GetFactoryName() << " " << (*listed_fitem).first.GetItemName() << " " << (*listed_fitem).first.GetVersion().GetMajor() << " " << (*listed_fitem).first.GetVersion().GetMinor() << " "
583  << (*listed_fitem).second.GetFactoryName() << " " << (*listed_fitem).second.GetItemName() << " " << (*listed_fitem).second.GetVersion().GetMajor() << " " << (*listed_fitem).second.GetVersion().GetMinor() << " " << std::endl;
584  }
585  // add an end of record
586  AddRecord(out,'e');
587 
588  // now call it for the list of DotConf if any i.e in this case for the referenced factories
589  DotConf::DoConfigure(out);
590 
591  out << "# \n";
592 
593  /*
594  {
595  KeyFactory *fact = 0x0;
596 
597  std::list< KeyFactory * >::iterator
598  listed_item;
599  for ( listed_item = fListOfKeyFactories.begin(); listed_item != fListOfKeyFactories.end() ; listed_item++ ) {
600  fact = (*listed_item);
601  std::cout << fact->GetName() << " " << (void*)fact << std::endl;
602  }
603  return fact;
604  }
605 
606  {
607  FrameFactory *fact = 0x0;
608 
609  std::list< FrameFactory * >::iterator
610  listed_item;
611  for ( listed_item = fListOfFrameFactories.begin(); listed_item != fListOfFrameFactories.end() ; listed_item++ ) {
612  fact = (*listed_item);
613  std::cout << fact->GetName() << " " << (void*)fact << std::endl;
614  }
615  return fact;
616  }
617  */
618 
619 
620  return out.good();
621 }
622 
void SetEndian(BaseBuffer::EEndian)
Definition: DFAgent.cpp:319
const FactoryItem & GetPrimaryKey() const
Just to know if the size of the frame is coded on 2 bytes, 4 bytes ... or 8 bytes.
Definition: DFAgent.cpp:256
virtual Key * GetKey()=0
To get the Key associated to this frame.
virtual Bool_t ProcessLine(const std::string &)
decode an input line to configure/reconfigure this DFAgent
Definition: DFAgent.cpp:387
Base class for a Key.
Definition: Key.h:56
static MainFrameFactory & theMainFactory()
the main (global) keyfactory
Base class for a FrameFactory.
Definition: FrameFactory.h:49
header file for FactoryItem.cpp
Base class for a Frame.
Definition: Frame.h:73
header file for KeyFactory.cpp
DotConf : Utility for class configuration from ascii file or Configuration frames.
Definition: DotConf.h:96
const FactoryItem & GetSignature() const
Definition: Key.h:115
Bool_t SetKnownFrameFactory(const FactoryItem &factory_item)
check if the factory is referenced by the agent.
Definition: DFAgent.cpp:175
void SetFactoryVersion(Short_t v)
Change the factory version.
Definition: FactoryItem.h:85
void SetLastModif()
set in last modif string the current date.
Definition: DotConf.cpp:105
Bool_t SetAsCompatibleKeyItem(FactoryItem &factory_item) const
Take the item and prepare it to be an item related to the is agent i.e. set the factory version # and...
Definition: DFAgent.cpp:216
LogMessage & error(LogMessage &)
KeyFactory * GetKeyFactory(const FactoryItem &item)
look in the DFAgent list if this factory exist and with a version # greater that the given one ...
Definition: DFAgent.cpp:106
virtual Bool_t DoConfigure(std::istream &in, Bool_t allow_init)
configure this from an input stream
Definition: DFAgent.h:203
DFAgent(const Char_t *rid, const Char_t *srid, Bool_t is_record=true, Bool_t global=true)
in case global is true, it keeps a list of pointers to the global factories otherwise asked for Clone...
Definition: DFAgent.cpp:42
Bool_t(* PF_FactoryItemChange)(const FactoryItem &, const FactoryItem &)
prototype function to control the evolution of a factory item.
Definition: FactoryItem.h:127
virtual void Reset(const Char_t *opt="")
Reset : all values are set to default.
Definition: DFAgent.cpp:303
UShort_t IsAKnownFrame(const FactoryItem &kit, const FactoryItem &fit, PF_FactoryItemChange kch=ChangeOfVersion, PF_FactoryItemChange fch=ChangeOfVersion) const
To know if a Frame is known by the Agent under the conditions given.
Definition: DFAgent.cpp:334
void AddKnownFrame(const FactoryItem &item_key, const FactoryItem &item_frame, const Char_t opt= '+')
internal use to avoid adding a definition of a Frame that cannot be allocated
Definition: DFAgent.cpp:266
void SetPrimaryKey(const FactoryItem &item)
to set the definition of the Keys for input
Definition: DFAgent.cpp:261
Base class for a buffer.
Definition: BaseBuffer.h:48
Short_t GetFactoryVersion() const
Ask the factory version.
Definition: FactoryItem.h:82
Base class for version numbers.
Definition: Version.h:38
virtual ~DFAgent()
Definition: DFAgent.cpp:65
ConfAgent.
Definition: ConfAgent.h:63
LogMessage & nline(LogMessage &)
LogMessage fLog
the log messenger ... to know the object hae been properly intitialised/modified
Definition: DotConf.h:100
virtual Bool_t DoConfigure(std::istream &, Bool_t allow_init)
configure this from an input stream
virtual SharedFP * NewSharedFrame(const FactoryItem &, const FactoryItem &)
Ask the main for a new Frame.
Bool_t SetAsCompatibleItems(FactoryItem &factory_key_item, FactoryItem &factory_frame_item) const
change both item as the same time
Definition: DFAgent.h:146
FrameFactory * GetFrameFactory(const FactoryItem &item)
look in the DFAgent list if this factory exist and with a version # greater that the given one ...
Definition: DFAgent.cpp:120
const std::string & GetFactoryName() const
Definition: FactoryItem.h:76
void SetItem(const Char_t *whichfactory, const Char_t *whichitem, Version itemversion, Short_t factversion=-1, void *ptr=0x0)
to change an item
Definition: FactoryItem.cpp:84
const std::vector< KeyFactory * > & ListOfFactories() const
direct access to the list of factories
Definition: KeyFactory.h:187
FactoryItem WhichKnownKey(const FactoryItem &kit, const FactoryItem &fit, PF_FactoryItemChange kch=ChangeOfVersion, PF_FactoryItemChange fch=ChangeOfVersion) const
Definition: DFAgent.cpp:353
header file for DFAgent.cpp
Bool_t SetKnownKeyFactory(const FactoryItem &factory_item)
check if the factory is referenced by the agent.
Definition: DFAgent.cpp:134
UShort_t GetMinor() const
Definition: Version.h:61
A Shared Frame Pointer.
Definition: Frame.h:597
Version GetVersion() const
Definition: FactoryItem.h:88
ADF::LogMessage & endl(ADF::LogMessage &log)
void SetMaxVersion(Short_t v)
Definition: DotConf.h:176
void SetFactoryPtr(void *ptr)
change
Definition: FactoryItem.h:97
virtual void AddConf(DotConf *)
add a conf object to this. The added objects are not owned by this so not deleted.
Definition: DotConf.cpp:222
virtual std::string & GetProcessName()
To get the Process name.
static MainKeyFactory & theMainFactory()
the main (global) keyfactory
Definition: KeyFactory.cpp:150
virtual Key * New(const FactoryItem &)
build a key using item.
Definition: KeyFactory.cpp:155
FactoryItem WhichKnownFrame(const FactoryItem &kit, const FactoryItem &fit, PF_FactoryItemChange kch=ChangeOfVersion, PF_FactoryItemChange fch=ChangeOfVersion) const
To get the exact definition of a key and a Frame.
Definition: DFAgent.cpp:370
Bool_t SetAsCompatibleFrameItem(FactoryItem &factory_item) const
Take the item and prepare it to be an item related to the is agent i.e. set the factory version # and...
Definition: DFAgent.cpp:236
Base Key factory.
Definition: KeyFactory.h:44
const std::string & GetItemName() const
Definition: FactoryItem.h:78
Bool_t AddRecord(std::ostream &, char t= 'b')
Add a begin or end of record, return true if done.
Definition: DotConf.cpp:198
Base class that described an item in a Factory.
Definition: FactoryItem.h:52
LogMessage & warning(LogMessage &)
const FactoryItem & GetSignature() const
Signature of that frame.
Definition: Frame.h:127
UShort_t GetMajor() const
Definition: Version.h:60
const std::vector< FrameFactory * > & ListOfFactories() const
direct access to the list of factories
Definition: FrameFactory.h:132