Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Validator_SerializationTest.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
19 
21 
23 
24 
25 namespace Teuchos {
26 
28 {
29 
30  public:
31 
32  void printDoc(const std::string& docString, std::ostream& out) const {}
33 
35  return rcp(new Array<std::string>(1,""));
36  }
37 
38  void validate(
39  ParameterEntry const& entry,
40  std::string const& paramName,
41  std::string const& sublistName
42  ) const {}
43 
44  const std::string getXMLTypeName() const{
45  return "UNDEFINEDTYPE";
46  }
47 
48 };
49 
50 TEUCHOS_UNIT_TEST(Teuchos_Validator, exceptionTests)
51 {
53  out << std::endl;
54 
57 
59  missingValidatorList = getParametersFromXmlFile("MissingValidator.xml"),
61 
63  missingPrototypeList = getParametersFromXmlFile("MissingPrototypeValidator.xml"),
65 
67  conflicitingValiIdsList = getParametersFromXmlFile("ConflictingValidatorIDs.xml"),
69 
71  stringValidatorBadTagList = getParametersFromXmlFile("StringValidatorBadTag.xml"),
73 
75  stringValidatorBadTagList = getParametersFromXmlFile("StringToIntegralValidatorBadTag.xml"),
77 
78  #ifdef HAVE_TEUCHOS_DEBUG
79 
80  StringValidatorXMLConverter stringConverter;
81  AnyNumberValidatorXMLConverter anyNumberConverter;
82  ValidatortoIDMap writerDummyMap;
83  IDtoValidatorMap readerDummyMap;
84  RCP<AnyNumberParameterEntryValidator> anyNumberValidator =
85  anyNumberParameterEntryValidator();
86  writerDummyMap.insert(anyNumberValidator);
87  TEST_THROW(
88  stringConverter.fromValidatortoXML(anyNumberValidator, writerDummyMap),
90  XMLObject anyNumberXML =
91  anyNumberConverter.fromValidatortoXML(anyNumberValidator, writerDummyMap);
92  TEST_THROW(
93  stringConverter.fromXMLtoValidator(anyNumberXML, readerDummyMap),
95 
96  #endif
97 
98 }
99 
100 TEUCHOS_UNIT_TEST(Teuchos_Validator, fileNameValidatorConverter)
101 {
102  std::string defaultParameterName = "default";
103  std::string nonDefaultParameterName = "non default";
104 
105  RCP<FileNameValidator> defaultValidator =
106  rcp(new FileNameValidator);
107  RCP<FileNameValidator> nonDefaultValidator =
108  rcp(new FileNameValidator(true));
109  ParameterList myList("FileName Validator List");
110  myList.set("default", "", "parameter for default validator",
111  defaultValidator);
112  myList.set("non default", "blah.txt", "parameter for non default validator",
113  nonDefaultValidator);
114 
115  RCP<ParameterList> readInPL = writeThenReadPL(myList);
116 
117  RCP<const FileNameValidator> readinDefault =
118  rcp_dynamic_cast<const FileNameValidator>(
119  readInPL->getEntry(defaultParameterName).validator(), true);
120  TEST_EQUALITY(readinDefault->fileMustExist(), defaultValidator->fileMustExist());
121 
122  RCP<const FileNameValidator> readinNonDefault =
123  rcp_dynamic_cast<const FileNameValidator>(
124  readInPL->getEntry(nonDefaultParameterName).validator(), true);
125  TEST_EQUALITY(readinNonDefault->fileMustExist(), nonDefaultValidator->fileMustExist());
126 }
127 
128 
129 TEUCHOS_UNIT_TEST(Teuchos_Validator, stringValidatorConverter)
130 {
131  std::string defaultParameterName = "default";
132  std::string nonDefaultParameterName = "non default";
133 
134  RCP<StringValidator> nonDefaultValidator = rcp(
135  new StringValidator(tuple<std::string>("value1", "cheese", "kurtis", "is", "awesome")));
136  ParameterList myList("String Validator List");
137  myList.set("non default", "kurtis", "parameter for non default validator",
138  nonDefaultValidator);
139 
140  RCP<ParameterList> readInPL = writeThenReadPL(myList);
141 
142  RCP<const StringValidator> readinNonDefault =
143  rcp_dynamic_cast<const StringValidator>(
144  readInPL->getEntry(nonDefaultParameterName).validator(), true);
145  TEST_COMPARE_ARRAYS(*(readinNonDefault->validStringValues()),
146  *(nonDefaultValidator->validStringValues()));
147 }
148 
149 
150 TEUCHOS_UNIT_TEST(Teuchos_Validator, boolValidatorConverter)
151 {
152  std::string xmlFileName = "BoolValidatorList.xml";
153  std::string boolParameterName = "boolParameterName";
154  RCP<BoolParameterEntryValidator> boolValidator =
156 
157  ParameterList myList("BoolValidatorList");
158  myList.set(boolParameterName, false,
159  "A parameter with a BoolParameterEntryValidator validator.",
160  boolValidator);
161 
162  RCP<ParameterList> readInPL = writeThenReadPL(myList);
163 
164  RCP<const BoolParameterEntryValidator> readInBoolValidator =
165  rcp_dynamic_cast<const BoolParameterEntryValidator>(
166  readInPL->getEntry(boolParameterName).validator(), true);
167 
168  // to do - check any stuff we want to check
169  // right now it doesn't have any settings
170 }
171 
172 TEUCHOS_UNIT_TEST(Teuchos_Validator, anynumberValidatorConverter)
173 {
174  std::string xmlFileName = "AnyNumberValidatorList.xml";
175  std::string defaultParameterName = "default";
176  std::string nonDefaultParameterName = "preferred and accepted";
177  RCP<AnyNumberParameterEntryValidator> defaultValidator =
180  acceptedTypes.allowDouble(false);
181  RCP<AnyNumberParameterEntryValidator> nonDefaultValidator =
182  rcp(
185  acceptedTypes
186  )
187  );
188 
189  ParameterList myList("AnyNumberValidatorList");
190  myList.set(defaultParameterName, 10.0,
191  "A parameter with the default AnyNumberValidator on it", defaultValidator);
192  myList.set(nonDefaultParameterName, 1,
193  "A prameter with an AnyNumberValidator on it that has the preferred and accepted types differnet from the default",
194  nonDefaultValidator);
195 
196  RCP<ParameterList> readInPL = writeThenReadPL(myList);
197 
198  RCP<const AnyNumberParameterEntryValidator> readinDefaultValidator =
199  rcp_dynamic_cast<const AnyNumberParameterEntryValidator>(
200  readInPL->getEntry(defaultParameterName).validator(), true);
201  TEST_EQUALITY(readinDefaultValidator->isDoubleAllowed(),
202  defaultValidator->isDoubleAllowed());
203  TEST_EQUALITY(readinDefaultValidator->isIntAllowed(),
204  defaultValidator->isIntAllowed());
205  TEST_EQUALITY(readinDefaultValidator->isStringAllowed(),
206  defaultValidator->isStringAllowed());
207  TEST_EQUALITY(readinDefaultValidator->getPreferredType(),
208  defaultValidator->getPreferredType());
209 
210  RCP<const AnyNumberParameterEntryValidator> readinNonDefaultValidator =
211  rcp_dynamic_cast<const AnyNumberParameterEntryValidator>(
212  readInPL->getEntry(nonDefaultParameterName).validator(), true);
213  TEST_EQUALITY(readinNonDefaultValidator->isDoubleAllowed(),
214  nonDefaultValidator->isDoubleAllowed());
215  TEST_EQUALITY(readinNonDefaultValidator->isIntAllowed(),
216  nonDefaultValidator->isIntAllowed());
217  TEST_EQUALITY(readinNonDefaultValidator->isStringAllowed(),
218  nonDefaultValidator->isStringAllowed());
219  TEST_EQUALITY(readinNonDefaultValidator->getPreferredType(),
220  nonDefaultValidator->getPreferredType());
221 }
222 
223 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Teuchos_Validator, EnhancedNumberValidatorConverter, T)
224 {
225  std::string xmlFileName = TypeNameTraits<T>::name() + "EnhancedValidatorList.xml";
226  std::string defaultParameterName = "default";
227  std::string minmaxParameterName = "min max";
228  std::string stepPrecParameterName = "step and prec";
229  ParameterList myList;
230  RCP<EnhancedNumberValidator< T > > defaultValidator =
232  RCP<EnhancedNumberValidator< T > > minMaxValidator =
233  rcp( new EnhancedNumberValidator< T >(0,10));
234  RCP<EnhancedNumberValidator< T > > stepAndPrecValidator =
235  rcp( new EnhancedNumberValidator< T >(0,10,4,4));
236  myList.set(defaultParameterName, ( T )6, "parameter with default validator",
237  defaultValidator);
238  myList.set(minmaxParameterName, ( T )10, "parameter with min and max validator",
239  minMaxValidator);
240  myList.set(stepPrecParameterName, ( T )10, "parameter with min, max, "
241  "step, and prec validator",
242  stepAndPrecValidator);
243 
244  RCP<ParameterList> readInPL = writeThenReadPL(myList);
245 
247  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
248  readInPL->getEntry(defaultParameterName).validator(), true)->getMin(),
249  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
250  myList.getEntry(defaultParameterName).validator(), true)->getMin()
251  );
253  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
254  readInPL->getEntry(defaultParameterName).validator(), true)->getMax(),
255  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
256  myList.getEntry(defaultParameterName).validator(), true)->getMax()
257  );
259  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
260  readInPL->getEntry(defaultParameterName).validator(), true)->getStep()
261  ,
262  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
263  myList.getEntry(defaultParameterName).validator(), true)->getStep()
264  );
266  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
267  readInPL->getEntry(
268  defaultParameterName).validator(), true)->getPrecision(),
269  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
270  myList.getEntry(
271  defaultParameterName).validator(), true)->getPrecision()
272  );
274  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
275  readInPL->getEntry(defaultParameterName).validator(), true)->hasMin(),
276  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
277  myList.getEntry(defaultParameterName).validator(), true)->hasMin()
278  );
280  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
281  readInPL->getEntry(defaultParameterName).validator(), true)->hasMax(),
282  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
283  myList.getEntry(defaultParameterName).validator(), true)->hasMax()
284  );
285 
287  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
288  readInPL->getEntry(minmaxParameterName).validator(), true)->getMin(),
289  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
290  myList.getEntry(minmaxParameterName).validator(), true)->getMin()
291  );
293  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
294  readInPL->getEntry(minmaxParameterName).validator(), true)->getMax(),
295  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
296  myList.getEntry(minmaxParameterName).validator(), true)->getMax()
297  );
299  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
300  readInPL->getEntry(minmaxParameterName).validator(), true)->getStep(),
301  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
302  myList.getEntry(minmaxParameterName).validator(), true)->getStep()
303  );
305  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
306  readInPL->getEntry(
307  minmaxParameterName).validator(), true)->getPrecision(),
308  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
309  myList.getEntry(
310  minmaxParameterName).validator(), true)->getPrecision()
311  );
313  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
314  readInPL->getEntry(minmaxParameterName).validator(), true)->hasMin(),
315  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
316  myList.getEntry(minmaxParameterName).validator(), true)->hasMin()
317  );
319  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
320  readInPL->getEntry(minmaxParameterName).validator(), true)->hasMax(),
321  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
322  myList.getEntry(minmaxParameterName).validator(), true)->hasMax()
323  );
324 
326  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
327  readInPL->getEntry(stepPrecParameterName).validator(), true)->getMin(),
328  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
329  myList.getEntry(stepPrecParameterName).validator(), true)->getMin()
330  );
332  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
333  readInPL->getEntry(stepPrecParameterName).validator(), true)->getMax(),
334  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
335  myList.getEntry(stepPrecParameterName).validator(), true)->getMax()
336  );
338  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
339  readInPL->getEntry(stepPrecParameterName).validator(), true)->getStep()
340  ,
341  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
342  myList.getEntry(stepPrecParameterName).validator(), true)->getStep()
343  );
345  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
346  readInPL->getEntry(
347  stepPrecParameterName).validator(), true)->getPrecision(),
348  rcp_dynamic_cast<const EnhancedNumberValidator< T > >(
349  myList.getEntry(
350  stepPrecParameterName).validator(), true)->getPrecision());
351 
352 }
353 
354 
355 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Teuchos_Validator, NumberArrayValidatorConverterTest, T)
356 {
357  std::string arrayParameterName = "array";
358  ParameterList myList;
359 
360  const T arrayValidatorLen = as<T>(11);
361  RCP<ArrayNumberValidator< T > > arrayValidator =
363  rcp(new EnhancedNumberValidator<T>(as<T>(0), arrayValidatorLen))));
364  myList.set(arrayParameterName,
365  Array< T >(4, 10), "array parameter", arrayValidator);
366 
367  RCP<ParameterList> readInPL = writeThenReadPL(myList);
368 
369  RCP<const EnhancedNumberValidator< T > > readInPrototypeValidator =
370  rcp_dynamic_cast<const ArrayValidator<EnhancedNumberValidator<T>, T > >(
371  readInPL->getEntry(
372  arrayParameterName).validator(), true)->getPrototype();
373  RCP<const EnhancedNumberValidator< T > > actualPrototypeValidator =
374  arrayValidator->getPrototype();
375 
377  readInPrototypeValidator->getMin(),
378  actualPrototypeValidator->getMin()
379  );
381  readInPrototypeValidator->getMax(),
382  actualPrototypeValidator->getMax()
383  );
385  readInPrototypeValidator->getStep(),
386  actualPrototypeValidator->getStep()
387  );
389  readInPrototypeValidator->getPrecision(),
390  actualPrototypeValidator->getPrecision()
391  );
393  readInPrototypeValidator->hasMin(),
394  actualPrototypeValidator->hasMin()
395  );
397  readInPrototypeValidator->hasMax(),
398  actualPrototypeValidator->hasMax()
399  );
400 }
401 
402 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Teuchos_Validator, TwoDArrayNumberValidatorConverterTest, T)
403 {
404  std::string arrayParameterName = "array";
405  ParameterList myList;
406 
407  const T arrayValidatorLen = as<T>(11);
408  RCP<TwoDArrayNumberValidator< T > > arrayValidator =
410  rcp(new EnhancedNumberValidator<T>(as<T>(0), arrayValidatorLen))));
411  myList.set(arrayParameterName,
412  TwoDArray< T >(4,4, 10), "array parameter", arrayValidator);
413 
414  RCP<ParameterList> readInPL = writeThenReadPL(myList);
415 
416  RCP<const EnhancedNumberValidator< T > > readInPrototypeValidator =
417  rcp_dynamic_cast<const TwoDArrayValidator<EnhancedNumberValidator<T>, T > >(
418  readInPL->getEntry(
419  arrayParameterName).validator(), true)->getPrototype();
420  RCP<const EnhancedNumberValidator< T > > actualPrototypeValidator =
421  arrayValidator->getPrototype();
422 
424  readInPrototypeValidator->getMin(),
425  actualPrototypeValidator->getMin()
426  );
428  readInPrototypeValidator->getMax(),
429  actualPrototypeValidator->getMax()
430  );
432  readInPrototypeValidator->getStep(),
433  actualPrototypeValidator->getStep()
434  );
436  readInPrototypeValidator->getPrecision(),
437  actualPrototypeValidator->getPrecision()
438  );
440  readInPrototypeValidator->hasMin(),
441  actualPrototypeValidator->hasMin()
442  );
444  readInPrototypeValidator->hasMax(),
445  actualPrototypeValidator->hasMax()
446  );
447 }
448 
449 
450 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Teuchos_Validator, StringToIntegralConverterTest, T)
451 {
452  std::string defaultStringToIntegralParameterName = "defaultsti";
453  std::string stringToIntegralParameterName = "sti";
454  ParameterList myList;
457  tuple<std::string>("value1", "value2", "value3"), stringToIntegralParameterName));
460  tuple<std::string>("value3", "value4", "value5"),
461  tuple<std::string>("the third value", "the fourth value", "the fifth value"),
462  tuple< T >(3,4,5),
463  stringToIntegralParameterName));
464  myList.set(defaultStringToIntegralParameterName,
465  "value1", "parameter with default sti validator", defaultStiValidator);
466  myList.set(stringToIntegralParameterName, "value3", "parameter with sti validator",
467  stiValidator);
468 
469  RCP<ParameterList> readInPL = writeThenReadPL(myList);
470 
471 
473  readInDefaultStiValidator =
474  rcp_dynamic_cast<const StringToIntegralParameterEntryValidator< T > >(
475  readInPL->getEntry(
476  defaultStringToIntegralParameterName).validator(), true);
478  readInStiValidator =
479  rcp_dynamic_cast<const StringToIntegralParameterEntryValidator< T > >(
480  readInPL->getEntry(
481  stringToIntegralParameterName).validator(), true);
482 
483  Array<std::string> readInDefaultValidStrings =
484  *(readInDefaultStiValidator->validStringValues());
485  Array<std::string> defaultValidStrings =
486  *(defaultStiValidator->validStringValues());
487  TEST_COMPARE_ARRAYS(readInDefaultValidStrings, defaultValidStrings);
488 
489  TEST_ASSERT(readInDefaultStiValidator->getStringDocs().is_null());
490  TEST_EQUALITY( readInDefaultStiValidator->getDefaultParameterName(),
491  defaultStiValidator->getDefaultParameterName());
492  for(int i=0; i<defaultValidStrings.size(); ++i){
493  TEST_EQUALITY(defaultStiValidator->getIntegralValue(defaultValidStrings[i]),
494  readInDefaultStiValidator->getIntegralValue(defaultValidStrings[i]));
495  }
496 
497  Array<std::string> readInValidStrings = *(readInStiValidator->validStringValues());
498  Array<std::string> validStrings = *(stiValidator->validStringValues());
499  TEST_COMPARE_ARRAYS(readInValidStrings, validStrings);
500 
501  TEST_COMPARE_ARRAYS(*(readInStiValidator->getStringDocs()),
502  *(stiValidator->getStringDocs()));
503  TEST_EQUALITY( readInStiValidator->getDefaultParameterName(),
504  stiValidator->getDefaultParameterName());
505  for(int i=0; i<validStrings.size(); ++i){
506  TEST_EQUALITY(stiValidator->getIntegralValue(validStrings[i]),
507  readInStiValidator->getIntegralValue(validStrings[i]));
508  }
509 
510 }
511 
512 TEUCHOS_UNIT_TEST(Teuchos_Validator, existingPrototypeTest){
513  ParameterList pl("ExsitingPrototypeList");
514  RCP<StringValidator> stringVali = rcp(new StringValidator());
517  Array<std::string> strArray = tuple<std::string>("blah", "blah", "blah");
518  pl.set("string param", "hi", "a string param", stringVali);
519  pl.set("string array param", strArray,
520  "a string array parameter", arrayStringVali);
521  RCP<ParameterList> readInPL = writeThenReadPL(pl);
523  inArrayValidator =
524  rcp_dynamic_cast<const ArrayValidator<StringValidator, std::string> >(
525  readInPL->getEntry("string array param").validator(), true);
526  TEST_ASSERT(readInPL->getEntry("string param").validator()
527  == inArrayValidator->getPrototype());
528 }
529 
530 
531 #define FULL_NUMBER_TYPE_TEST( T ) \
532 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(Teuchos_Validator, EnhancedNumberValidatorConverter, T ) \
533 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(Teuchos_Validator, NumberArrayValidatorConverterTest, T ) \
534 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(Teuchos_Validator, StringToIntegralConverterTest, T )
535 
536 #define NONINTEGRAL_NUMBER_TYPE_TEST( T ) \
537 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(Teuchos_Validator, EnhancedNumberValidatorConverter, T ) \
538 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(Teuchos_Validator, NumberArrayValidatorConverterTest, T )
539 
540 typedef unsigned int uint;
541 typedef unsigned short ushort;
542 typedef unsigned long ulong;
543 
544 
548 typedef long long int llint;
550 
551 } // namespace Teuchos
552 
#define FULL_NUMBER_TYPE_TEST(T)
A collection of standard ValidatorXMLConverters.
#define TEST_ASSERT(v1)
Assert the given statement is true.
Maps Validators to integers.
#define NONINTEGRAL_NUMBER_TYPE_TEST(T)
Converts StringValidators to and from XML.
Convience class for EnhancedNumberValidators that are to be applied to arrays.
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
ValidStringsList validStringValues() const
Return an array of strings of valid values if applicable.
Converts AnyNumberParameterEntryValidators to and from XML.
This object is held as the &quot;value&quot; in the Teuchos::ParameterList std::map.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
XMLObject fromValidatortoXML(const RCP< const ParameterEntryValidator > validator, const ValidatortoIDMap &validatorIDsMap, bool assignedID=true) const
Converters a given ParameterEntryValidator to XML.
#define TEST_THROW(code, ExceptType)
Assert that the statement &#39;code&#39; throws the exception &#39;ExceptType&#39; (otherwise the test fails)...
Standard implementation of a ParameterEntryValidator that maps from a list of strings to an enum or i...
static RCP< const ValidatorXMLConverter > getConverter(const ParameterEntryValidator &validator)
Get an appropriate ValidatorXMLConverter given a Validator.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Templated set method.
Simple helper functions that make it easy to read and write XML to and from a parameterlist.
Takes a validator, wraps it, and applies it to a TwoDArray.
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(RCPNodeHandle, basicConstruct_owns_mem, T)
TEUCHOS_UNIT_TEST(ConstNonconstObjectContainer, create)
EPreferredType getPreferredType() const
Lookup the preferred type.
A thin wrapper around the Array class which causes it to be interpreted as a 2D Array.
Thrown when the ValidatorXMLConverterDB can&#39;t find an appropriate converter.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
void printDoc(const std::string &docString, std::ostream &out) const
Print documentation for this parameter.
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
A database for ValidatorXMLConverters.
Writes a ParameterList to an XML object.
Convience class for EnhancedNumberValidators that are to be applied to TwoDArray. ...
Unit testing support.
Standard implementation of a BoolParameterEntryValidator that accepts bool values (true/false) or str...
A class for mapping validators to integers.
const std::string getXMLTypeName() const
Get a string that should be used as a value of the type attribute when serializing it to XML...
void insert(RCP< const ParameterEntryValidator > toInsert)
inserts an IDValidatorPair into the map.
Takes a validator, wraps it, and applies it to an array.
A list of parameters of arbitrary type.
A simple validator that only allows certain string values to be choosen or simply enforces that a par...
Abstract interface for an object that can validate a ParameterEntry&#39;s value.
#define TEST_COMPARE_ARRAYS(a1, a2)
Assert that a1.size()==a2.size() and a[i]==b[i], i=0....
bool isDoubleAllowed() const
Lookup whether or not doubles are allowed.
A collection of Exceptions that can be potentially thrown when converting a ParameterList to and from...
Class uesd to validate a particular type of number.
size_type size() const
void validate(ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
Validate a parameter entry value and throw std::exception (with a great error message) if validation ...
static void printKnownConverters(std::ostream &out)
prints the xml tags associated with all known converters
Constructs a CantFindParameterEntryConverterException.
AcceptedTypes & allowDouble(bool _allowDouble)
Set allow a double value or not.
Smart reference counting pointer class for automatic garbage collection.
bool fileMustExist() const
Gets the variable describing whether or not this validator wants the file that is specified to alread...
Thrown when xml tag is encountered that is either unrecognized or inappropriate for a given context...
bool isStringAllowed() const
Lookup whether or not strings are allowed.
RCP< ParameterEntryValidator > fromXMLtoValidator(const XMLObject &xmlObj, const IDtoValidatorMap &validatorIDsMap) const
Converts a given XMLObject to a ParameterEntryValidator.
Standard implementation of a ParameterEntryValidator that accepts numbers from a number of different ...
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
bool isIntAllowed() const
Lookup whether or not ints are allowed.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< ParameterList > writeThenReadPL(ParameterList &myList)
Write a parameter list to xml and then read that xml back in via a string. The intent of this functio...
Thrown when a bad validator xml converter is used.
Thrown when a referenced validator can&#39;t be found.
bool is_null() const
Returns true if the underlying pointer is null.