1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
// Copyright (C) 2005, 2006 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// Authors: Andreas Waechter IBM 2005-10-20
#include "RegisteredTNLP.hpp"
#include <cstdio>
std::map<std::string, SmartPtr<RegisteredTNLP> >& RegisteredTNLPListMap()
{
// cppcheck-suppress threadsafety-threadsafety
static std::map<std::string, SmartPtr<RegisteredTNLP> > tnlp_map_;
return tnlp_map_;
}
void RegisteredTNLPs::RegisterTNLP(
const SmartPtr<RegisteredTNLP>& tnlp,
const std::string& name
)
{
RegisteredTNLPListMap()[name] = GetRawPtr(tnlp);
}
SmartPtr<RegisteredTNLP> RegisteredTNLPs::GetTNLP(
const std::string& name
)
{
SmartPtr<RegisteredTNLP> retval = NULL;
std::map<std::string, SmartPtr<RegisteredTNLP> >::iterator it;
it = RegisteredTNLPListMap().find(name);
if( it != RegisteredTNLPListMap().end() )
{
retval = it->second;
}
return retval;
}
void RegisteredTNLPs::PrintRegisteredProblems()
{
for( std::map<std::string, SmartPtr<RegisteredTNLP> >::iterator it = RegisteredTNLPListMap().begin();
it != RegisteredTNLPListMap().end(); ++it )
{
printf("%s\n", it->first.c_str());
}
}
|