42#ifndef Teuchos_OBJECT_BUILDER_H
43#define Teuchos_OBJECT_BUILDER_H
88template<
class ObjectType>
101 const std::string &objectName
106 const std::string &objectTypeName
112 const std::string &objectFactoryName
128 const std::string &objectName =
""
183template<
class ObjectType>
191template<
class ObjectType>
193objectBuilder(
const std::string& objectName,
const std::string& objectTypeName)
196 ob->setObjectName(objectName);
197 ob->setObjectTypeName(objectTypeName);
207template<
class ObjectType>
214template<
class ObjectType>
220template<
class ObjectType>
223 const std::string &objectName
237template<
class ObjectType>
256template<
class ObjectType>
268template<
class ObjectType>
276template<
class ObjectType>
291template<
class ObjectType>
299template<
class ObjectType>
314 (std::string(
"Determines the type of " +
object_name_ +
" object that will be built.\n")
315 +
"The parameters for each " +
objectType_name_ +
" are specified in this sublist"
319 for(
int i = 0; i < static_cast<int>(
objectArray_.size()); ++i ) {
324 validParamList->sublist(sname).setParameters(
325 *object->getValidParameters()).disableRecursiveValidation();
332template<
class ObjectType>
334 const std::string &defaultObject_name
348template<
class ObjectType>
351 const std::string &objectName
358 sname = ( objectName.length()
369 (std::string(
"Error! ObjectBuilder attempted to create an object of type ")
387 object->setParameterList(pl);
393template<
class ObjectType>
395 const std::string &objectName
404template<
class ObjectType>
406 const std::string &objectTypeName
415template<
class ObjectType>
Templated Parameter List class.
Smart reference counting pointer class for automatic garbage collection.
Simple, universal "Abstract Factory" interface for the dynamic creation of objects.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
Generic parameterlist driven bulider class.
RCP< const ParameterList > getValidParameters() const
RCP< const AbstractFactory< ObjectType > > object_fcty_t
Array< std::string > validObjectNames_
RCP< ObjectType > create(const std::string &objectName="") const
std::string defaultObject_name_
RCP< const ParameterList > validParamList_
RCP< const ParameterList > getParameterList() const
void setObjectFactory(const RCP< const AbstractFactory< ObjectType > > &objectFactory, const std::string &objectFactoryName)
Set a new Object factory object.
void initializeDefaults_()
RCP< const StringToIntegralParameterEntryValidator< int > > objectValidator_
RCP< ParameterList > paramList_
void setObjectTypeName(const std::string &objectTypeName)
Set the name of the parameterlist selector, e.g. "Object Type".
RCP< ParameterList > getNonconstParameterList()
void setObjectName(const std::string &objectName)
Set the name of the object this will be a builder for, e.g. "Object".
std::string objectType_name_
Array< object_fcty_t > objectArray_
void setDefaultObject(const std::string &defaultObject_name)
Set the name of the desired object to be created when the parameter list does not specify which objec...
std::string getObjectName() const
Get the name of the Object that will be created on the next call to this->create().
RCP< ParameterList > unsetParameterList()
void setParameterList(const RCP< ParameterList > ¶mList)
Interface for objects that can accept a ParameterList.
RCP< ParameterList > sublist(const RCP< ParameterList > ¶mList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Return a RCP to a sublist in another RCP-ed parameter list.
RCP< ParameterList > parameterList()
Nonmember constructor.
Smart reference counting pointer class for automatic garbage collection.
Standard implementation of a ParameterEntryValidator that maps from a list of strings to an enum or i...
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
RCP< ObjectBuilder< ObjectType > > objectBuilder()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.