Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_ValidatorFactory.cpp
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 
10 #include "Teuchos_ValidatorFactory.hpp"
11 
12 
13 namespace Teuchos {
14 
15 
16 RCP<ParameterEntryValidator>
17 ValidatorFactory::createValidator(ValidatorType valiType)
18 {
19  switch (valiType){
20  case Int:
21  return rcp(new EnhancedNumberValidator<int>());
22  case Short:
23  return rcp(new EnhancedNumberValidator<short>());
24  case Double:
26  case Float:
27  return rcp(new EnhancedNumberValidator<float>());
28  case IntArray:
30  case ShortArray:
32  case DoubleArray:
34  case FloatArray:
36  case FileName:
37  return rcp(new FileNameValidator());
38  case FileNameArray:
39  return rcp(new ArrayFileNameValidator(rcp(new FileNameValidator())));
40  // 2010/07/30: Don't put a default clause in that does this! This will hide defects!
41  }
42  // Default return!
44  return toReturn;
45 
46 }
47 
48 
50  return rcp(new EnhancedNumberValidator<int>());
51 }
52 
53 
55  return rcp(new EnhancedNumberValidator<short>());
56 }
57 
58 
61 }
62 
63 
65  return rcp(new EnhancedNumberValidator<float>());
66 }
67 
68 
70  return rcp(new FileNameValidator());
71 }
72 
73 
76 }
77 
78 
81 }
82 
83 
86 }
87 
88 
91 }
92 
93 
95  return rcp(new ArrayFileNameValidator(rcp(new FileNameValidator())));
96 }
97 
98 
99 } // namespace Teuchos
static RCP< ArrayNumberValidator< short > > getArrayShortValidator()
Creates and returns an Array Number Validator of type short.
static RCP< EnhancedNumberValidator< double > > getDoubleValidator()
Creates and returns a Enhanced Number Validator of type double.
static RCP< ArrayFileNameValidator > getArrayFileNameValidator()
Creates and returns an Array File Name Validator.
Convience class for EnhancedNumberValidators that are to be applied to arrays.
static RCP< EnhancedNumberValidator< int > > getIntValidator()
Creates and returns a Enhanced Number Validator of type int.
static RCP< ArrayNumberValidator< double > > getArrayDoubleValidator()
Creates and returns an Array Number Validator of type double.
static RCP< EnhancedNumberValidator< float > > getFloatValidator()
Creates and returns a Enhanced Number Validator of type float.
static RCP< ParameterEntryValidator > createValidator(ValidatorType valiType)
Creates a validator of the given type.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
static RCP< ArrayNumberValidator< float > > getArrayFloatValidator()
Creates and returns an Array Number Validator of type float.
static RCP< ArrayNumberValidator< int > > getArrayIntValidator()
Creates and returns an Array Number Validator of type int.
static RCP< FileNameValidator > getFileNameValidator()
Creates and returns FileNameValidator.
Class uesd to validate a particular type of number.
Convience class for FileNameValidators that are to be applied to arrays.
Smart reference counting pointer class for automatic garbage collection.
static RCP< EnhancedNumberValidator< short > > getShortValidator()
Creates and returns a Enhanced Number Validator of type short.