24 #ifndef ADF_KeyFactory
27 #ifndef ADF_DefaultKeyFactory
30 #ifndef ADF_AgataKeyFactory
48 key->fSignature = l_item;
50 key->SetDataLength(0u);
72 for (
size_t i = 0; i < fFactories.size(); i++) {
77 for (
size_t i = 0; i < fClonedFactories.size(); i++) {
78 delete fClonedFactories[i];
80 fClonedFactories.clear();
87 for (
size_t i = 0; i < fFactories.size(); i++) {
88 if ( fFactories[i]->
GetName() == which_factory )
90 factory = fFactories[i];
97 KeyFactory *MainKeyFactory::GetClonedFactory(std::string which_factory,
void *ptr)
const
101 for (
size_t i = 0; i < fClonedFactories.size(); i++) {
102 if ( fClonedFactories[i]->
GetName() == which_factory && fClonedFactories[i] == ptr )
104 factory = fClonedFactories[i];
122 fFactories.push_back(anewfactory);
139 if ( factory_name ==
"Default" ) {
143 if ( factory_name ==
"Agata" ) {
152 return gTheMainFactory;
169 key = factory->
New(item);
173 Key *MainKeyFactory::Clone(
const Key *key)
190 KeyFactory *MainKeyFactory::Clone(std::string which_factory,
const std::string &opt)
193 if ( factory == 0x0 )
198 fClonedFactories.push_back(cloned);
203 Int_t MainKeyFactory::Clone(std::list<KeyFactory *> &cloned_list,
const std::string &opt)
205 Int_t nb_cloned = 0; std::vector< KeyFactory * >
tmp(fFactories);
207 for (
size_t i = 0; i < tmp.size(); i++) {
213 cloned_list.push_back(newfact);
222 std::cout <<
" list of global key factories : " <<
std::endl;
223 for (
size_t i = 0; i < fFactories.size(); i++) {
224 std::cout <<
" [g] " << fFactories[i]->GetName() <<
" @ " << std::hex << (
void*)fFactories[i] << std::dec << std::endl;
226 if ( o.find(
"clones") != std::string::npos ) {
227 std::cout <<
" list of cloned key factories : " <<
std::endl;
228 for (
size_t i = 0; i < fClonedFactories.size(); i++) {
229 std::cout <<
" [c] " << fClonedFactories[i]->GetName() <<
" @ " << std::hex << (
void*)fClonedFactories[i] << std::dec << std::endl;
static Factory_T * theFactory()
to create the main global factory for that type
header file for DefaultKeyFactory.cpp
KeyFactory * GetFactory(std::string which_factory) const
Ask for a particular factory from is name.
void ls(std::string o) const
list all factories
header file for KeyFactory.cpp
virtual Key * DoNew(const FactoryItem &)
Do really the job of allocating the key.
const FactoryItem & GetSignature() const
virtual Bool_t Copy(const Char_t *, UInt_t)
Copy an external buffer to this key.
Base class for a MainFactory i.e. a factory composed of factories.
virtual BaseBuffer::EEndian GetEndian() const
Bool_t IsKnown(std::string which_factory) const
check a factory has been registered
virtual KeyFactory * Clone(const std::string &)=0
realised clone of this factory
virtual const std::string & GetName() const
name of the factory
header file for AgataKeyFactory.cpp
const std::string & GetFactoryName() const
virtual ~MainKeyFactory()
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.
ADF::LogMessage & endl(ADF::LogMessage &log)
void SetFactoryPtr(void *ptr)
change
virtual void AddConf(DotConf *)
add a conf object to this. The added objects are not owned by this so not deleted.
static MainKeyFactory & theMainFactory()
the main (global) keyfactory
void * GetFactoryPtr() const
virtual Key * New(const FactoryItem &)
build a key using item.
Base class that described an item in a Factory.