Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
Teuchos_StandardParameterEntryValidators.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Teuchos: Common Tools Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
43 #include "Teuchos_as.hpp"
44 
45 
46 std::string Teuchos::getVerbosityLevelParameterValueName(
47  const EVerbosityLevel verbLevel
48  )
49 {
50  switch(verbLevel) {
51  case VERB_DEFAULT:
52  return "default";
53  case VERB_NONE:
54  return "none";
55  case VERB_LOW:
56  return "low";
57  case VERB_MEDIUM:
58  return "medium";
59  case VERB_HIGH:
60  return "high";
61  case VERB_EXTREME:
62  return "extreme";
63  default:
64  TEUCHOS_TEST_FOR_EXCEPT("Should never get here!");
65  }
66  return ""; // Never get here!
67 }
68 
69 
72  >
73 Teuchos::verbosityLevelParameterEntryValidator(
74  std::string const& defaultParameterName
75  )
76 {
77  return rcp(
78  new StringToIntegralParameterEntryValidator<EVerbosityLevel>(
79  tuple<std::string>(
80  getVerbosityLevelParameterValueName(VERB_DEFAULT),
81  getVerbosityLevelParameterValueName(VERB_NONE),
82  getVerbosityLevelParameterValueName(VERB_LOW),
83  getVerbosityLevelParameterValueName(VERB_MEDIUM),
84  getVerbosityLevelParameterValueName(VERB_HIGH),
85  getVerbosityLevelParameterValueName(VERB_EXTREME)
86  ),
87  tuple<std::string>(
88  "Use level set in code",
89  "Produce no output",
90  "Produce minimal output",
91  "Produce a little more output",
92  "Produce a higher level of output",
93  "Produce the highest level of output"
94  ),
95  tuple<EVerbosityLevel>(
97  VERB_NONE,
98  VERB_LOW,
100  VERB_HIGH,
102  ),
103  defaultParameterName
104  )
105  );
106 }
107 
108 
109 namespace Teuchos {
110 
111 
112 //
113 // AnyNumberParameterEntryValidator
114 //
115 
116 
117 // Constructors
118 
119 
121  : preferredType_(PREFER_DOUBLE), acceptedTypes_(AcceptedTypes())
122 {
124 }
125 
126 
128  EPreferredType const preferredType, AcceptedTypes const& acceptedTypes
129  )
130  : preferredType_(preferredType), acceptedTypes_(acceptedTypes)
131 {
133 }
134 
135 
136 // Local non-virtual validated lookup functions
137 
138 
140  const ParameterEntry &entry, const std::string &paramName,
141  const std::string &sublistName, const bool activeQuery
142  ) const
143 {
144  const any &anyValue = entry.getAny(activeQuery);
145  if( acceptedTypes_.allowInt() && anyValue.type() == typeid(int) )
146  return any_cast<int>(anyValue);
147  if( acceptedTypes_.allowDouble() && anyValue.type() == typeid(double) )
148  return as<int>(any_cast<double>(anyValue));
149  if( acceptedTypes_.allowString() && anyValue.type() == typeid(std::string) )
150  return std::atoi(any_cast<std::string>(anyValue).c_str());
151  throwTypeError(entry,paramName,sublistName);
152  return 0; // Will never get here!
153 }
154 
155 
157  const ParameterEntry &entry, const std::string &paramName,
158  const std::string &sublistName, const bool activeQuery
159  ) const
160 {
161  const any &anyValue = entry.getAny(activeQuery);
162  if( acceptedTypes_.allowInt() && anyValue.type() == typeid(int) )
163  return as<double>(any_cast<int>(anyValue));
164  if( acceptedTypes_.allowDouble() && anyValue.type() == typeid(double) )
165  return any_cast<double>(anyValue);
166  if( acceptedTypes_.allowString() && anyValue.type() == typeid(std::string) )
167  return std::atof(any_cast<std::string>(anyValue).c_str());
168  throwTypeError(entry,paramName,sublistName);
169  return 0.0; // Will never get here!
170 }
171 
172 
174  const ParameterEntry &entry, const std::string &paramName,
175  const std::string &sublistName, const bool activeQuery
176  ) const
177 {
178  const any &anyValue = entry.getAny(activeQuery);
179  if( acceptedTypes_.allowInt() && anyValue.type() == typeid(int) )
180  return Utils::toString(any_cast<int>(anyValue));
181  if( acceptedTypes_.allowDouble() && anyValue.type() == typeid(double) )
182  return Utils::toString(any_cast<double>(anyValue));
183  if( acceptedTypes_.allowString() && anyValue.type() == typeid(std::string) )
184  return any_cast<std::string>(anyValue);
185  throwTypeError(entry,paramName,sublistName);
186  return ""; // Will never get here!
187 }
188 
189 
191  ParameterList &paramList, const std::string &paramName,
192  const int defaultValue
193  ) const
194 {
195  const ParameterEntry *entry = paramList.getEntryPtr(paramName);
196  if(entry) return getInt(*entry,paramName,paramList.name(),true);
197  return paramList.get(paramName,defaultValue);
198 }
199 
200 
202  ParameterList &paramList, const std::string &paramName,
203  const double defaultValue
204  ) const
205 {
206  const ParameterEntry *entry = paramList.getEntryPtr(paramName);
207  if(entry) return getDouble(*entry,paramName,paramList.name(),true);
208  return paramList.get(paramName,defaultValue);
209 }
210 
211 
213  ParameterList &paramList, const std::string &paramName,
214  const std::string &defaultValue
215  ) const
216 {
217  const ParameterEntry *entry = paramList.getEntryPtr(paramName);
218  if(entry) return getString(*entry,paramName,paramList.name(),true);
219  return paramList.get(paramName,defaultValue);
220 }
221 
222 
224 {
225  return acceptedTypes_.allowDouble();
226 }
227 
228 
230 {
231  return acceptedTypes_.allowInt();
232 }
233 
234 
236 {
237  return acceptedTypes_.allowString();
238 }
239 
240 
243 {
244  return preferredType_;
245 }
246 
247 
248 // Overridden from ParameterEntryValidator
249 
250 
252 {
253  return "anynumberValidator";
254 }
255 
256 
258  std::string const & docString,
259  std::ostream & out
260  ) const
261 {
262  StrUtils::printLines(out,"# ",docString);
263  out << "# Accepted types: " << acceptedTypesString_ << ".\n";
264 }
265 
266 
269 {
270  return null;
271 }
272 
273 
275  ParameterEntry const& entry,
276  std::string const& paramName,
277  std::string const& sublistName
278  ) const
279 {
280  // Validate that the parameter exists and can be converted to a double.
281  // NOTE: Even if the target type will be an 'int', we don't know that here
282  // so it will be better to assert that a 'double' can be created. The type
283  // 'double' has a very large exponent range and, subject to digit
284  // truncation, a 'double' can represent every 'int' value.
285  getDouble(entry, paramName, sublistName, false);
286 }
287 
288 
290  std::string const& paramName,
291  std::string const& sublistName,
292  ParameterEntry * entry
293  ) const
294 {
295  TEUCHOS_TEST_FOR_EXCEPT(0==entry);
296  switch(preferredType_) {
297  case PREFER_INT:
298  entry->setValue(
299  getInt(*entry,paramName,sublistName,false),
300  false // isDefault
301  );
302  break;
303  case PREFER_DOUBLE:
304  entry->setValue(
305  getDouble(*entry,paramName,sublistName,false),
306  false // isDefault
307  );
308  break;
309  case PREFER_STRING:
310  entry->setValue(
311  getString(*entry,paramName,sublistName,false),
312  false // isDefault
313  );
314  break;
315  default:
316  TEUCHOS_TEST_FOR_EXCEPT("Error, Invalid EPreferredType value!");
317  }
318 }
319 
320 
321 // private
322 
323 
325 {
326 
327  std::ostringstream oss;
328  bool addedType = false;
329  if(acceptedTypes_.allowInt()) {
330  oss << "\"int\"";
331  addedType = true;
332  }
334  if(addedType) oss << ", ";
335  oss << "\"double\"";
336  addedType = true;
337  }
339  if(addedType) oss << ", ";
340  oss << "\"string\"";
341  addedType = true;
342  }
343  acceptedTypesString_ = oss.str();
344 }
345 
346 
348  ParameterEntry const& entry,
349  std::string const& paramName,
350  std::string const& sublistName
351  ) const
352 {
353  const std::string &entryName = entry.getAny(false).typeName();
356  ,"Error, the parameter {paramName=\""<<paramName<<"\""
357  ",type=\""<<entryName<<"\"}"
358  << "\nin the sublist \"" << sublistName << "\""
359  << "\nhas the wrong type."
360  << "\n\nThe accepted types are: " << acceptedTypesString_ << "!";
361  );
362 }
363 
364 
367 {
371 }
372 
373 
375  : ParameterEntryValidator(), mustAlreadyExist_(mustAlreadyExist)
376 {}
377 
378 
380 {
381  return mustAlreadyExist_;
382 }
383 
384 
385 bool FileNameValidator::setFileMustExist(bool shouldFileExist)
386 {
387  this->mustAlreadyExist_ = shouldFileExist;
388  return mustAlreadyExist_;
389 }
390 
391 
394 {
395  return null;
396 }
397 
398 
399 void FileNameValidator::validate(ParameterEntry const &entry, std::string const &paramName,
400  std::string const &sublistName) const
401 {
402  const std::string &entryName = entry.getAny(false).typeName();
403  any anyValue = entry.getAny(true);
404  TEUCHOS_TEST_FOR_EXCEPTION(!(anyValue.type() == typeid(std::string) ),
406  "The \"" << paramName << "\"" <<
407  " parameter in the \"" << sublistName <<
408  "\" sublist is has an error." << std::endl << std::endl <<
409  "Error: The value that you entered was the wrong type." << std::endl <<
410  "Parameter: " << paramName << std::endl <<
411  "Type specified: " << entryName << std::endl <<
412  "Type accepted: " << typeid(std::string).name() <<
413  std::endl << std::endl);
414  if(mustAlreadyExist_){
415  std::string fileName = getValue<std::string>(entry);
416  TEUCHOS_TEST_FOR_EXCEPTION(!std::ifstream(fileName.c_str()),
418  "The \"" << paramName << "\"" <<
419  " parameter in the \"" << sublistName <<
420  "\" sublist is has an error." << std::endl << std::endl <<
421  "Error: The file must already exists. The value you entered does " <<
422  "not corresspond to an existing file name." << std::endl <<
423  "Parameter: " << paramName << std::endl <<
424  "File name specified: " << fileName << std::endl << std::endl);
425  }
426 }
427 
428 
429 const std::string FileNameValidator::getXMLTypeName() const
430 {
431  return "FilenameValidator";
432 }
433 
434 
436  std::string const &docString, std::ostream &out) const
437 {
438  StrUtils::printLines(out,"# ",docString);
439  out << "# Validator Used: " << std::endl;
440  out << "# FileName Validator" << std::endl;
441 }
442 
443 
445  return rcp(new FileNameValidator(true));
446 }
447 
448 
450  : ParameterEntryValidator(), validStrings_(NULL)
451 {}
452 
453 
456  validStrings_(rcp(new Array<std::string>(validStrings)))
457 {}
458 
459 
462 {
463  validStrings_ = rcp(new Array<std::string>(validStrings));
464  return validStrings_;
465 }
466 
467 
470 {
471  return validStrings_;
472 }
473 
474 
476  ParameterEntry const &entry, std::string const &paramName,
477  std::string const &sublistName) const
478 {
479  any anyValue = entry.getAny(true);
480  const std::string &entryName = entry.getAny(false).typeName();
481  TEUCHOS_TEST_FOR_EXCEPTION(!(anyValue.type() == typeid(std::string)) ,
483  "The \"" << paramName << "\"" <<
484  " parameter in the \"" << sublistName <<
485  "\" sublist is has an error." << std::endl << std::endl <<
486  "Error: The value that you entered was the wrong type." <<
487  "Parameter: " << paramName << std::endl <<
488  "Type specified: " << entryName << std::endl <<
489  "Type accepted: " << Teuchos::TypeNameTraits<std::string>::name() <<
490  std::endl);
491  if(!validStrings_.is_null()){
493  it = std::find(validStrings_->begin(),
494  validStrings_->end(), getValue<std::string>(entry));
497  "The \"" << paramName << "\"" <<
498  " parameter in the \"" << sublistName <<
499  "\" sublist is has an error." << std::endl << std::endl <<
500  "Error: The value that was entered doesn't fall with in "
501  "the range set by the validator." <<
502  "Parameter: " << paramName << std::endl <<
503  "Acceptable Values: " << *validStrings_ << std::endl <<
504  "Value entered: " << getValue<std::string>(entry) << std::endl <<
505  std::endl);
506  }
507 }
508 
509 
510 const std::string StringValidator::getXMLTypeName() const
511 {
512  return "StringValidator";
513 }
514 
515 
516 void StringValidator::printDoc(std::string const &docString,
517  std::ostream &out) const
518 {
519  Teuchos::StrUtils::printLines(out,"# ",docString);
520  out << "# Validator Used: " << std::endl;
521  out << "# String Validator" << std::endl;
522  if (validStrings_.get() && validStrings_->size()){
523  out << "# Acceptable Values: " << *validStrings_ << std::endl;
524  }
525 }
526 
527 
529  return rcp(new StringValidator(tuple<std::string>("")));
530 }
531 
532 
533 } // namespace Teuchos
534 
535 
536 // Nonmmeber helper functions
537 
538 
540 Teuchos::anyNumberParameterEntryValidator()
541 {
543 }
544 
545 
547 Teuchos::anyNumberParameterEntryValidator(
550  )
551 {
552  return rcp(
554  preferredType, acceptedTypes
555  )
556  );
557 }
558 
559 void Teuchos::setIntParameter(
560  std::string const& paramName,
561  int const value, std::string const& docString,
562  ParameterList *paramList,
564  )
565 {
566  TEUCHOS_TEST_FOR_EXCEPT(0==paramList);
567  const RCP<const ParameterEntryValidator> paramEntryValidator =
568  anyNumberParameterEntryValidator(
570  );
571  paramList->set(paramName, value, docString, paramEntryValidator);
572 }
573 
574 
575 void Teuchos::setDoubleParameter(
576  std::string const& paramName,
577  double const& value, std::string const& docString,
578  ParameterList *paramList,
580  )
581 {
582  TEUCHOS_TEST_FOR_EXCEPT(0==paramList);
583  const RCP<const ParameterEntryValidator> paramEntryValidator =
584  anyNumberParameterEntryValidator(
586  );
587  paramList->set(paramName, value, docString, paramEntryValidator);
588 }
589 
590 
591 void Teuchos::setNumericStringParameter(
592  std::string const& paramName,
593  std::string const& value, std::string const& docString,
594  ParameterList *paramList,
596  )
597 {
598  TEUCHOS_TEST_FOR_EXCEPT(0==paramList);
599  const RCP<const ParameterEntryValidator> paramEntryValidator =
600  anyNumberParameterEntryValidator(
602  );
603  paramList->set(paramName, value, docString, paramEntryValidator);
604 }
605 
606 
607 int Teuchos::getIntParameter(
608  ParameterList const& paramList,
609  std::string const& paramName
610  )
611 {
612  const ParameterEntry &entry = paramList.getEntry(paramName);
614  anyNumValidator = rcp_dynamic_cast<const AnyNumberParameterEntryValidator>(
615  entry.validator()
616  );
617  if ( !is_null(anyNumValidator) )
618  return anyNumValidator->getInt(entry,paramName,paramList.name());
619  if ( typeid(int) == entry.getAny().type() )
620  return any_cast<int>(entry.getAny());
621  // Try the do the conversion which might fail!
622  const AnyNumberParameterEntryValidator myAnyNumValidator;
623  return myAnyNumValidator.getInt(entry,paramName,paramList.name());
624 }
625 
626 
627 double Teuchos::getDoubleParameter(
628  ParameterList const& paramList,
629  std::string const& paramName
630  )
631 {
632  const ParameterEntry &entry = paramList.getEntry(paramName);
634  anyNumValidator = rcp_dynamic_cast<const AnyNumberParameterEntryValidator>(
635  entry.validator()
636  );
637  if ( !is_null(anyNumValidator) )
638  return anyNumValidator->getDouble(entry,paramName,paramList.name());
639  if ( typeid(double) == entry.getAny().type() )
640  return any_cast<double>(entry.getAny());
641  // Try the do the conversion which might fail!
642  const AnyNumberParameterEntryValidator myAnyNumValidator;
643  return myAnyNumValidator.getDouble(entry,paramName,paramList.name());
644 }
645 
646 
647 std::string Teuchos::getNumericStringParameter(
648  ParameterList const& paramList,
649  std::string const& paramName
650  )
651 {
652  const ParameterEntry &entry = paramList.getEntry(paramName);
654  anyNumValidator = rcp_dynamic_cast<const AnyNumberParameterEntryValidator>(
655  entry.validator()
656  );
657  if ( !is_null(anyNumValidator) )
658  return anyNumValidator->getString(entry,paramName,paramList.name());
659  if ( typeid(std::string) == entry.getAny().type() )
660  return any_cast<std::string>(entry.getAny());
661  // Try the do the conversion which might fail!
662  const AnyNumberParameterEntryValidator myAnyNumValidator;
663  return myAnyNumValidator.getString(entry,paramName,paramList.name());
664 }
ValidStringsList setValidStrings(const Teuchos::Array< std::string > &validStrings)
Sets the Array of valid strings and returns what the current array of valid string now is...
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object...
void printDoc(std::string const &docString, std::ostream &out) const
const std::string & name() const
The name of this ParameterList.
EVerbosityLevel
Verbosity level.
Generate a high level of output.
static RCP< T > getDummyObject()
Retrieves a dummy object of type T.
bool is_null(const boost::shared_ptr< T > &p)
Returns true if p.get()==NULL.
bool setFileMustExist(bool shouldFileExist)
Sets whether or not the validator requires the file to already exist.
Generate only a minimal amount of output.
void setValue(T value, bool isDefault=false, const std::string &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Templated set method that uses the input value type to determine the type of parameter.
FileNameValidator(bool mustAlreadyExist=mustAlreadyExistDefault())
Constructs a FileNameValidator.
RCP< const ParameterEntryValidator > validator() const
Return the (optional) validator object.
EPreferredType
Determines what type is the preferred type.
T & get(const std::string &name, T def_value)
Return the parameter&#39;s value, or the default value if it is not there.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Set a parameter whose value has type T.
This object is held as the "value" in the Teuchos::ParameterList std::map.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
Standard implementation of a ParameterEntryValidator that maps from a list of strings to some integra...
AcceptedTypes & allowString(bool _allowString)
Set allow an std::string value or not.
std::string getString(const ParameterEntry &entry, const std::string &paramName="", const std::string &sublistName="", const bool activeQuery=true) const
Get a std::string value from a parameter entry.
T * get() const
Get the raw C++ pointer to the underlying object.
static std::ostream & printLines(std::ostream &os, const std::string &linePrefix, const std::string &lines)
Print lines with prefix first.
ValidStringsList validStrings_
An array containing a list of all the valid string values.
Modified boost::any class, which is a container for a templated value.
Definition: Teuchos_any.hpp:86
void validate(ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
AcceptedTypes & allowInt(bool _allowInt)
Set allow an int value or not.
static std::string toString(const double &x)
Write a double as a std::string.
Generate the most output possible.
ParameterEntry * getEntryPtr(const std::string &name)
Retrieves the pointer for an entry with the name name if it exists.
EPreferredType getPreferredType() const
Lookup the preferred type.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
double getDouble(const ParameterEntry &entry, const std::string &paramName="", const std::string &sublistName="", const bool activeQuery=true) const
Get a double value from a parameter entry.
void validate(ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
Generate no output.
A list of parameters of arbitrary type.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< AnyNumberParameterEntryValidator > anyNumberParameterEntryValidator()
Nonmember constructor AnyNumberParameterEntryValidator.
bool mustAlreadyExist_
Whether or not the file specified in the parameter should already exist.
AnyNumberParameterEntryValidator()
Construct with a preferrded type of double and accept all types.
Abstract interface for an object that can validate a ParameterEntry&#39;s value.
any & getAny(bool activeQry=true)
Direct access to the Teuchos::any data value underlying this object. The bool argument activeQry (def...
int getInt(const ParameterEntry &entry, const std::string &paramName="", const std::string &sublistName="", const bool activeQuery=true) const
Get an integer value from a parameter entry.
void validate(ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
bool isDoubleAllowed() const
Lookup whether or not Doubles are allowed.
void printDoc(std::string const &docString, std::ostream &out) const
void throwTypeError(ParameterEntry const &entry, std::string const &paramName, std::string const &sublistName) const
std::string typeName() const
Return the name of the type.
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...
const std::type_info & type() const
Return the type of value being stored.
Generate more output.
void validateAndModify(std::string const &paramName, std::string const &sublistName, ParameterEntry *entry) const
bool isStringAllowed() const
Lookup whether or not strings are allowed.
Standard implementation of a ParameterEntryValidator that accepts numbers from a number of different ...
void printDoc(std::string const &docString, std::ostream &out) const
ParameterEntry & getEntry(const std::string &name)
Retrieves an entry with the name name.
bool isIntAllowed() const
Lookup whether or not ints are allowed.
Definition of Teuchos::as, for conversions between types.
#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...
Generate output as defined by the object.
#define TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool is_null() const
Returns true if the underlying pointer is null.