Optika GUI Toolik Version of the Day
Optika_ValidatorFactory.cpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //         Optika: A Tool For Developing Parameter Obtaining GUIs
00005 //                Copyright (2009) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, with Sandia Corporation, the 
00008 // U.S. Government retains certain rights in this software.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Kurtis Nusbaum (klnusbaum@gmail.com) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 #include "Optika_ValidatorFactory.hpp"
00029 #include "Teuchos_ENull.hpp"
00030 namespace Optika{
00031 
00032 Teuchos::RCP<Teuchos::ParameterEntryValidator> ValidatorFactory::createValidator(ValidatorType valiType){
00033   switch(valiType){
00034     case Int:
00035       return Teuchos::RCP<EnhancedNumberValidator<int> >(new EnhancedNumberValidator<int>());
00036       break;
00037     case Short:
00038       return Teuchos::RCP<EnhancedNumberValidator<short> >(new EnhancedNumberValidator<short>());
00039       break;
00040     case Double:
00041       return Teuchos::RCP<EnhancedNumberValidator<double> >(new EnhancedNumberValidator<double>());
00042       break;
00043     case Float:
00044       return Teuchos::RCP<EnhancedNumberValidator<float> >(new EnhancedNumberValidator<float>());
00045       break;
00046     case IntArray:
00047       return Teuchos::RCP<ArrayNumberValidator<int> >( new ArrayNumberValidator<int>( Teuchos::RCP<EnhancedNumberValidator<int> >( new EnhancedNumberValidator<int>())));
00048       break;
00049     case ShortArray:
00050       return Teuchos::RCP<ArrayNumberValidator<short> >( new ArrayNumberValidator<short>( Teuchos::RCP<EnhancedNumberValidator<short> >( new EnhancedNumberValidator<short>())));
00051       break;
00052     case DoubleArray:
00053       return Teuchos::RCP<ArrayNumberValidator<double> >( new ArrayNumberValidator<double>( Teuchos::RCP<EnhancedNumberValidator<double> >( new EnhancedNumberValidator<double>())));
00054       break;
00055     case FloatArray:
00056       return Teuchos::RCP<ArrayNumberValidator<float> >( new ArrayNumberValidator<float>(Teuchos::RCP<EnhancedNumberValidator<float> >( new EnhancedNumberValidator<float>())));
00057       break;
00058     case FileName:
00059       return Teuchos::RCP<FileNameValidator>(new FileNameValidator());
00060       break;
00061     case FileNameArray:
00062       return Teuchos::RCP<ArrayFileNameValidator>(new ArrayFileNameValidator(Teuchos::RCP<FileNameValidator>(new FileNameValidator())));
00063       break;
00064     default:
00065       Teuchos::RCP<Teuchos::ParameterEntryValidator> toReturn;
00066       return toReturn;
00067       break;
00068   }
00069   Teuchos::RCP<Teuchos::ParameterEntryValidator> toReturn;
00070   return toReturn;
00071 }
00072 
00073 Teuchos::RCP<EnhancedNumberValidator<int> > ValidatorFactory::getIntValidator(){
00074   return Teuchos::RCP<EnhancedNumberValidator<int> >(new EnhancedNumberValidator<int>());
00075 }
00076 
00077 Teuchos::RCP<EnhancedNumberValidator<short> > ValidatorFactory::getShortValidator(){
00078   return Teuchos::RCP<EnhancedNumberValidator<short> >(new EnhancedNumberValidator<short>());
00079 }
00080 
00081 Teuchos::RCP<EnhancedNumberValidator<double> > ValidatorFactory::getDoubleValidator(){
00082   return Teuchos::RCP<EnhancedNumberValidator<double> >(new EnhancedNumberValidator<double>());
00083 }
00084 
00085 Teuchos::RCP<EnhancedNumberValidator<float> > ValidatorFactory::getFloatValidator(){
00086   return Teuchos::RCP<EnhancedNumberValidator<float> >(new EnhancedNumberValidator<float>());
00087 }
00088 
00089 Teuchos::RCP<FileNameValidator> ValidatorFactory::getFileNameValidator(){
00090   return Teuchos::RCP<FileNameValidator>(new FileNameValidator());
00091 }
00092 
00093 Teuchos::RCP<ArrayNumberValidator<int> > ValidatorFactory::getArrayIntValidator(){
00094   return Teuchos::RCP<ArrayNumberValidator<int> >( new ArrayNumberValidator<int>( Teuchos::RCP<EnhancedNumberValidator<int> >( new EnhancedNumberValidator<int>())));
00095 }
00096 
00097 Teuchos::RCP<ArrayNumberValidator<short> > ValidatorFactory::getArrayShortValidator(){
00098   return Teuchos::RCP<ArrayNumberValidator<short> >( new ArrayNumberValidator<short>( Teuchos::RCP<EnhancedNumberValidator<short> >( new EnhancedNumberValidator<short>())));
00099 }
00100 
00101 Teuchos::RCP<ArrayNumberValidator<double> > ValidatorFactory::getArrayDoubleValidator(){
00102   return Teuchos::RCP<ArrayNumberValidator<double> >( new ArrayNumberValidator<double>( Teuchos::RCP<EnhancedNumberValidator<double> >( new EnhancedNumberValidator<double>())));
00103 }
00104 
00105 Teuchos::RCP<ArrayNumberValidator<float> > ValidatorFactory::getArrayFloatValidator(){
00106   return Teuchos::RCP<ArrayNumberValidator<float> >( new ArrayNumberValidator<float>( Teuchos::RCP<EnhancedNumberValidator<float> >( new EnhancedNumberValidator<float>())));
00107 }
00108 
00109 Teuchos::RCP<ArrayFileNameValidator> ValidatorFactory::getArrayFileNameValidator(){
00110   return Teuchos::RCP<ArrayFileNameValidator>(new ArrayFileNameValidator(Teuchos::RCP<FileNameValidator>(new FileNameValidator())));
00111 }
00112 
00113 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends