23 #ifndef ADF_KeyFactory
24 #define ADF_KeyFactory
25 #define ADF_KEYFACTORY_H ADF_KeyFactory
94 virtual const std::string &
GetName()
const
152 std::vector <KeyFactory *> fFactories;
154 std::vector <KeyFactory *> fClonedFactories;
160 virtual KeyFactory *Clone(
const std::string &)
166 KeyFactory *GetClonedFactory(std::string which_factory,
void *)
const;
179 Key *Clone(
const Key *key);
182 KeyFactory *Clone(std::string,
const std::string &opt =
"full");
184 Int_t Clone(std::list<KeyFactory *> &,
const std::string &opt =
"full");
188 {
return fFactories; }
193 Bool_t
Register(std::string factory_name);
201 Bool_t
IsKnown(std::string which_factory)
const ;
207 void ls(std::string o)
const;
214 template <
typename Factory_T>
218 static Factory_T *gTheFactory;
223 if ( gTheFactory == 0x0 )
236 Factory_T * newfact =
new Factory_T ();
237 if ( newfact == 0x0 ) {
244 if ( opt.find(
"full") == std::string::npos ) {
246 fLog <<
info <<
"A new empty clone has been created for the factory " <<
GetName() <<
" " <<
nline;
260 std::ostringstream o;
264 std::istringstream i(o.str());
266 newfact->DoConfigure(i,
true);
269 fLog <<
error <<
"the clone configuration has failed, delete it ! " <<
nline;
275 fLog <<
info <<
"the clone configuration has succeded ! " <<
nline;
292 if (0x0 == gTheFactory) {
294 std::clog <<
"[[static]] Creation in Keyfactory ]\n[...\n";
296 gTheFactory =
new Factory_T;
299 std::clog << gTheFactory->GetName() <<
" done\n...]\n";
301 { std::clog <<
" *** ERROR *** \n"; std::clog <<
"...]\n" ;}
306 return (static_cast<Factory_T*> (gTheFactory));
317 template <
typename Factory_T>
318 Factory_T *AKeyFactory<Factory_T>::gTheFactory = 0x0;
virtual void SetLevel(ELevel lev, unsigned short verbosity=0u)
To get the current level of the message.
static Factory_T * theFactory()
to create the main global factory for that type
KeyFactory * GetFactory(std::string which_factory) const
Ask for a particular factory from is name.
header file for FactoryItem.cpp
void ls(std::string o) const
list all factories
DotConf : Utility for class configuration from ascii file or Configuration frames.
virtual Key * DoNew(const FactoryItem &)
Do really the job of allocating the key.
LogMessage & info(LogMessage &)
manipulator to modify the LogMessage
virtual Bool_t DoConfigure(std::ostream &out)
just call DotConf method, may be be overwitten
virtual BaseBuffer::EEndian GetEndian() const
Endian type for the keys delivered by this factory.
LogMessage & error(LogMessage &)
virtual Key * DoNew(const FactoryItem &)=0
Have to be overwritten.
Base class for a MainFactory i.e. a factory composed of factories.
Bool_t IsKnown(std::string which_factory) const
check a factory has been registered
virtual KeyFactory * Clone(const std::string &opt="full")
Clone.
virtual Bool_t DoConfigure(std::istream &in, Bool_t allow_init)
just call DotConf method
virtual KeyFactory * Clone(const std::string &)=0
realised clone of this factory
void SetName(std::string name)
virtual void SetProcessMethod(const char *)
To set the current method.
bool IsDebug(short debug_to_test) const
to test if the required debug level is lower that the global one
LogMessage & nline(LogMessage &)
LogMessage fLog
the log messenger ... to know the object hae been properly intitialised/modified
virtual const std::string & GetName() const
name of the factory
virtual Bool_t DoConfigure(std::istream &, Bool_t allow_init)
configure this from an input stream
AKeyFactory(const char *factory_name, BaseBuffer::EEndian e=BaseBuffer::kLittle)
virtual ~MainKeyFactory()
const std::vector< KeyFactory * > & ListOfFactories() const
direct access to the list of factories
Bool_t Register(KeyFactory *)
Add one factory to this collection of keyfactories: name has to be unique so return false if a factor...
virtual Key * New(const FactoryItem &)
build a key using item.
header file for DotConf.cpp
LogMessage & dolog(LogMessage &)
virtual ~KeyFactory()
destructor
virtual void SetEndian(BaseBuffer::EEndian e)
Set Endian type for the keys delivered by this factory.
static MainKeyFactory & theMainFactory()
the main (global) keyfactory
KeyFactory(std::string factory_name, BaseBuffer::EEndian e=BaseBuffer::kLittle)
Constructor.
virtual Key * New(const FactoryItem &)
build a key using item.
Base class for any KeyFactory implementation.
Base class that described an item in a Factory.