100 pl->set(
"String",
foo_ );
129 pl->set(
"String",
foo_ );
158 pl->set(
"String",
foo_ );
188 TEST_THROW( ob->setObjectName(
""), std::logic_error );
189 TEST_THROW( ob->setObjectTypeName(
""), std::logic_error );
199 ob->setObjectName(
"Foo");
200 ob->setObjectTypeName(
"Foo Type");
206 "Determines the type of Foo object that will be built.\nThe parameters for each Foo Type are specified in this sublist"
216 "Determines the type of Foo object that will be built.\nThe parameters for each Foo Type are specified in this sublist"
245 pl = ob->getValidParameters();
260 TEST_THROW( ob->getValidParameters(), std::logic_error );
280 pl->setParameters(*ob->getValidParameters());
281 pl->set(
"Foo Type",
"Foo A");
285 ob->setParameterList(pl);
313 out <<
"op.getValidParamters():\n";
316 pl->setParameters(*ob->getValidParameters());
317 pl->set(
"Foo Type",
"None");
318 ob->setParameterList(pl);
320 pl->set(
"Foo Type",
"Foo B");
321 pl->sublist(
"Foo B").set(
"String",
"BB");
322 pl->sublist(
"Foo C").set(
"String",
"CC");
329 ob->unsetParameterList();
337 const RCP<Foo> foo = ob->create(
"Foo A");
341 ob->setParameterList(pl);
343 const RCP<Foo> foo = ob->create(
"Foo A");
349 TEST_THROW( foo = ob->create(
"Foo D"), std::logic_error );
354#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 8) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 9) && !(__GNUC__ == 5 && __GNUC_MINOR__ == 3) && !(__GNUC__ == 6 && __GNUC_MINOR__ == 2)
371 pl->set(
"Hello",
"World");
372 TEST_THROW( ob->setParameterList(pl), std::logic_error );
374 TEST_THROW( ob->unsetParameterList(), std::logic_error );
404 nonconstPL->set(
"Object Type",
"None");
419 pl->set(
"Object Type",
"None");
423 newPL = ob->getNonconstParameterList();
428#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 8) && !(__GNUC__ == 4 && __GNUC_MINOR__ == 9) && !(__GNUC__ == 5 && __GNUC_MINOR__ == 3) && !(__GNUC__ == 6 && __GNUC_MINOR__ == 2)
440 pl->set(
"Object Type",
"None");
441 ob->setParameterList(pl);
449 ob->setParameterList(pl);
450 pl->set(
"Hello",
"World");
453 TEST_THROW( newPL = ob->unsetParameterList(), std::logic_error );
474 pl->set(
"Object Type",
"Foo B");
475 TEST_THROW( ob->setParameterList(pl), std::logic_error );
483 validPL->set(
"Object Type",
"Foo C");
484 validPL->sublist(
"Foo A").set(
"String",
"A");
485 validPL->sublist(
"Foo B").set(
"String",
"B");
486 validPL->sublist(
"Foo C").set(
"String",
"C");
493 objectValidator =
rcp(
495 validObjectNames,
"Object Type"
499 "Object Type",
"Foo C"
500 ,(std::string(
"Determines the type of Object object that will be built.\n")
501 +
"The parameters for each Object Type are specified in this sublist"
507 validPL->set(
"Object Type",
"Foo A");
509 validPL->set(
"Object Type",
"Foo B");
511 validPL->set(
"Object Type",
"None");
529 ob->setParameterList(pl);
530 const RCP<Foo> foo = ob->create(
"Foo A");
534 const ParameterEntry& pe = pl->sublist(
"Foo A").getEntry(
"String");
540 ob->unsetParameterList();
544 pl->setParameters(*ob->getValidParameters());
545 pl->sublist(
"Foo A").set(
"String",
"AA");
546 ob->setParameterList(pl);
548 const RCP<Foo> foo = ob->create(
"Foo A");
553 const ParameterEntry& pe = outPL->sublist(
"Foo A").getEntry(
"String");
559 ob->unsetParameterList();
570 ob->setParameterList(pl);
577 ob->setParameterList(pl);
578 ob->setDefaultObject(
"Foo A");
585 ob->setParameterList(pl);
586 ob->setDefaultObject(
"None");
592 TEST_THROW(ob->setDefaultObject(
"Foo D"), std::logic_error);
594 ob->setDefaultObject(
"Foo D");
595 TEST_THROW(ob->getValidParameters(), std::logic_error);
605 ob->setParameterList(pl);
614 ob->setDefaultObject(
"Foo A");
620 ob->setDefaultObject(
"None");
637 ob->setDefaultObject(
"Foo A");
643 ob->setDefaultObject(
"None");
#define TEST_ASSERT(v1)
Assert the given statement is true.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
#define TEST_NOTHROW(code)
Asserr that the statement 'code' does not thrown any excpetions.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails).
Templated Parameter List class.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
RCP< const AbstractFactory< T_itfc > > abstractFactoryStd()
Nonmember constructor for an standar abstract factory object.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
void push_back(const value_type &x)
RCP< const ParameterList > getValidParameters() const
Return a ParameterList containing all of the valid parameters that this->setParameterList(....
std::string getString() const
RCP< const ParameterList > getValidParameters() const
Return a ParameterList containing all of the valid parameters that this->setParameterList(....
std::string getString() const
RCP< const ParameterList > getValidParameters() const
Return a ParameterList containing all of the valid parameters that this->setParameterList(....
std::string getString() const
RCP< ParameterList > unsetParameterList()
Unset the parameter list that was set using setParameterList().
virtual void setDefaults()=0
RCP< const ParameterList > getParameterList() const
Get const version of the parameter list that was set using setParameterList().
RCP< ParameterList > getNonconstParameterList()
Get a nonconst version of the parameter list that was set using setParameterList().
void setParameterList(const RCP< ParameterList > ¶mList)
Set parameters from a parameter list and return with default values.
RCP< ParameterList > paramList_
virtual std::string getString() const =0
This object is held as the "value" in the Teuchos::ParameterList std::map.
bool isUsed() const
Return whether or not the value has been used; i.e., whether or not the value has been retrieved via ...
std::string docString() const
Return the (optional) documentation std::string.
bool isDefault() const
Indicate whether this entry takes on the default value.
Interface for objects that can accept a ParameterList.
virtual RCP< const ParameterList > getValidParameters() const
Return a ParameterList containing all of the valid parameters that this->setParameterList(....
RCP< ParameterList > parameterList()
Nonmember constructor.
Smart reference counting pointer class for automatic garbage collection.
RCP< T2 > rcp_dynamic_cast(const RCP< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying RCP type from T1* to T2*.
T * get() const
Get the raw C++ pointer to the underlying object.
Standard implementation of a ParameterEntryValidator that maps from a list of strings to an enum or i...
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.
const std::string ObjectType_name
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void printValidParameters(const ParameterListAcceptor ¶mListAccpetor, std::ostream &out, const bool showDoc=true)
Pretty print the valid parameters from a ParameterListAccpetor object.