23 #ifndef ADF_FrameFactory
24 #define ADF_FrameFactory
25 #define ADF_FRAMEFACTORY_H ADF_FrameFactory
27 #ifndef ADF_KeyFactory
44 class MainFrameFactory;
88 virtual const std::string &
GetName()
const
113 std::vector <FrameFactory *> fFactories;
115 std::vector <FrameFactory *> fClonedFactories;
118 virtual FrameFactory *Clone(
const std::string & =
"full")
124 FrameFactory *GetClonedFactory(std::string which_factory,
void *)
const;
133 {
return fFactories; }
155 FrameFactory *Clone(std::string which_factory,
const std::string &opt =
"full");
157 Int_t Clone(std::list<FrameFactory *> &,
const std::string &opt =
"full");
162 Bool_t
Register(std::string factory_name);
170 Bool_t
IsKnown(std::string which_factory)
const ;
180 template <
typename Factory_T>
184 static Factory_T *gTheFactory;
189 if ( gTheFactory == 0x0 )
208 Factory_T * newfact =
new Factory_T ();
209 if ( newfact == 0x0 ) {
216 if ( opt.find(
"full") == std::string::npos ) {
218 fLog <<
info <<
"A new empty clone has been created for the factory " <<
GetName() <<
" " <<
nline;
232 std::ostringstream o;
238 std::istringstream i(o.str());
240 newfact->DoConfigure(i,
true);
243 fLog <<
error <<
"the clone configuration has failed, delete it ! " <<
nline;
249 fLog <<
info <<
"the clone configuration has succeded ! " <<
nline;
267 if (gTheFactory == 0x0) {
269 std::clog <<
"[[static]] Creation in Framefactory ]\n[...\n";
271 gTheFactory =
new Factory_T;
274 std::clog << gTheFactory->GetName() <<
" done\n...]\n";
276 { std::clog <<
" *** ERROR *** \n"; std::clog <<
"...]\n"; }
281 return (static_cast<Factory_T*> (gTheFactory));
291 template <
typename Factory_T>
292 Factory_T *AFrameFactory<Factory_T>::gTheFactory = 0x0;
virtual void SetLevel(ELevel lev, unsigned short verbosity=0u)
To get the current level of the message.
Bool_t IsKnown(std::string which_factory) const
check a factory has been registered
AFrameFactory(const char *factory_name)
static MainFrameFactory & theMainFactory()
the main (global) keyfactory
Base class for a FrameFactory.
void SetName(std::string name)
header file for KeyFactory.cpp
MainFrameFactory(std::string factory_name)
DotConf : Utility for class configuration from ascii file or Configuration frames.
virtual Frame * New(const FactoryItem &key_item, const FactoryItem &frame_item)
just a frame
LogMessage & info(LogMessage &)
manipulator to modify the LogMessage
LogMessage & error(LogMessage &)
static Factory_T * theFactory()
to create the main (singleton) factory of that type
virtual SharedFP * DoNew(Key *, const FactoryItem &)
Do really the job of allocating the frame.
virtual FrameFactory * Clone(const std::string &opt="full")
Clone.
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 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.
virtual SharedFP * DoNew(Key *, const FactoryItem &)=0
Do really the job of allocating the frame.
virtual Bool_t DoConfigure(std::ostream &out)
Call Configure for all the registered factories.
virtual Bool_t DoConfigure(std::istream &in, Bool_t allow_init)
Call Configure for all the registered factories.
header file for DotConf.cpp
FrameFactory * GetFactory(std::string which_factory) const
Ask for a particular factory from is name.
Bool_t Register(FrameFactory *)
Add one factory to this collection of keyfactories: name has to be unique so return false if a factor...
virtual Frame * New(const FactoryItem &key_item, const FactoryItem &frame_item)
virtual FrameFactory * Clone(const std::string &="full")=0
realised clone of this factory
LogMessage & dolog(LogMessage &)
Base class for any kind of Frame factory.
virtual const std::string & GetName() const
name of the factory
virtual SharedFP * NewSharedFrame(const FactoryItem &, const FactoryItem &)
Ask this factory for a new Frame.
virtual ~MainFrameFactory()
Base class that described an item in a Factory.
const std::vector< FrameFactory * > & ListOfFactories() const
direct access to the list of factories
Base class for a MainFactory i.e. a factory composed of factories.