Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

exotkParameter_Integer.cxx

Go to the documentation of this file.
00001 
00002 //   exotkParameter_Integer.cxx
00004 //    Copyright (C) 2001  Stephane Routelous
00005 //
00006 //    This file is part of exoTK.
00007 //
00008 //    exoTK is free software; you can redistribute it and/or modify
00009 //    it under the terms of the GNU General Public License as published by
00010 //    the Free Software Foundation; either version 2 of the License, or
00011 //    (at your option) any later version.
00012 //
00013 //    exoTK is distributed in the hope that it will be useful,
00014 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //    GNU General Public License for more details.
00017 //
00018 //    You should have received a copy of the GNU General Public License
00019 //    along with exoTK; if not, write to the Free Software
00020 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00029 #include <exotkParameter_Integer.hxx>
00030 #include <stdlib.h>
00031 #ifndef _Standard_TypeDef_HeaderFile
00032 #include <Standard_Integer.hxx>
00033 #endif
00034 #ifndef  _exotkUtils_HeaderFile
00035 #include <exotkUtils.hxx>
00036 #endif
00037 
00038 //
00039 IMPLEMENT_STANDARD_HANDLE(exotkParameter_Integer,exotkParameter_Root)
00040 IMPLEMENT_STANDARD_RTTI(exotkParameter_Integer,exotkParameter_Root)
00041 //
00042 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 
00043 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
00044 // We must respect the order: from the direct ancestor class
00045 // to the base class.
00046 //
00047 
00048 IMPLEMENT_STANDARD_TYPE(exotkParameter_Integer)
00049 IMPLEMENT_STANDARD_SUPERTYPE(exotkParameter_Root) 
00050 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 
00051 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
00052 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
00053 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkParameter_Root)
00054 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
00055 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
00056 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
00057 IMPLEMENT_STANDARD_TYPE_END(exotkParameter_Integer)
00058 
00059 
00060 //==================================================================================
00061 // Function name        : exotkParameter_Integer::exotkParameter_Integer
00062 //==================================================================================
00063 // Written by       : Stephane Routelous - 08/03/2001 01:02:37
00064 // Description      : 
00065 // Return type          : 
00066 //==================================================================================
00067 // Argument         : const Standard_Integer aValue
00068 exotkParameter_Integer::exotkParameter_Integer(const Standard_Integer aValue)
00069 :myValue(aValue)
00070 {
00071         myType = exotkParameter_Type_Integer;
00072         myLowerIntegerLimit = IntegerFirst();
00073         myUpperIntegerLimit = IntegerLast();
00074         myLowerLimit = TCollection_AsciiString(myLowerIntegerLimit);
00075         myUpperLimit = TCollection_AsciiString(myUpperIntegerLimit);
00076 }
00077 
00078 
00079 //==================================================================================
00080 // Function name        : exotkParameter_Integer::~exotkParameter_Integer
00081 //==================================================================================
00082 // Written by       : Stephane Routelous - 08/03/2001 01:02:38
00083 // Description      : 
00084 // Return type          : 
00085 //==================================================================================
00086 exotkParameter_Integer::~exotkParameter_Integer()
00087 {
00088 
00089 }
00090 void exotkParameter_Integer::DeepCopy(const Handle_exotkParameter_Root &aParameterToCopy)
00091 {
00092         exotkParameter_Root::DeepCopy(aParameterToCopy);
00093         if ( aParameterToCopy->IsKind(STANDARD_TYPE(exotkParameter_Integer)) )
00094         {
00095                 Handle_exotkParameter_Integer theIntToCopy = Handle_exotkParameter_Integer::DownCast(aParameterToCopy);
00096                 myValue = theIntToCopy->Value();
00097         }
00098 }
00099 
00100 
00101 
00102 //==================================================================================
00103 // Function name        : exotkParameter_Integer::SetValue
00104 //==================================================================================
00105 // Written by       : Stephane Routelous - 08/03/2001 01:02:41
00106 // Description      : 
00107 // Return type          : Standard_Boolean 
00108 //==================================================================================
00109 // Argument         : const Standard_Integer aValue
00110 Standard_Boolean exotkParameter_Integer::SetValue(const Standard_Integer aValue)
00111 {
00112         if ( (aValue >= myLowerIntegerLimit ) && ( aValue <= myUpperIntegerLimit) )
00113         {
00114                 myValue = aValue;
00115                 return Standard_True;
00116         }
00117         else
00118                 return Standard_False;
00119 }
00120 
00121 //==================================================================================
00122 // Function name        : exotkParameter_Integer::Value
00123 //==================================================================================
00124 // Written by       : Stephane Routelous - 08/03/2001 01:02:44
00125 // Description      : 
00126 // Return type          : Standard_Integer 
00127 //==================================================================================
00128 Standard_Integer exotkParameter_Integer::Value() const
00129 {
00130         return myValue;
00131 }
00132 
00133 //==================================================================================
00134 // Function name        : exotkParameter_Integer::SetParameterAsString
00135 //==================================================================================
00136 // Written by       : Stephane Routelous - 08/03/2001 01:02:45
00137 // Description      : 
00138 // Return type          : Standard_Boolean 
00139 //==================================================================================
00140 // Argument         : const TCollection_AsciiString& aParameter
00141 Standard_Boolean exotkParameter_Integer::SetParameterAsString(const TCollection_AsciiString& aParameter)
00142 {
00143         //return SetValue( atoi(aParameter.ToCString()) );
00144         Standard_Integer theIntegerValue;
00145         if ( !exotkUtils::AsciiStringToInteger(aParameter,theIntegerValue) )
00146         {
00147                 return Standard_False;
00148         }
00149         else
00150         {
00151                 return SetValue(theIntegerValue);
00152         }
00153 }
00154 
00155 //==================================================================================
00156 // Function name        : exotkParameter_Integer::ParameterAsString
00157 //==================================================================================
00158 // Written by       : Stephane Routelous - 08/03/2001 01:02:48
00159 // Description      : 
00160 // Return type          : TCollection_AsciiString 
00161 //==================================================================================
00162 TCollection_AsciiString exotkParameter_Integer::ParameterAsString() const
00163 {
00164         return TCollection_AsciiString(myValue);
00165 }
00166 
00167 //==================================================================================
00168 // Function name        : exotkParameter_Integer::SetUpperIntegerLimit
00169 //==================================================================================
00170 // Written by       : Stephane Routelous - 08/03/2001 01:02:49
00171 // Description      : 
00172 // Return type          : void 
00173 //==================================================================================
00174 // Argument         : const Standard_Integer aValue
00175 void exotkParameter_Integer::SetUpperIntegerLimit(const Standard_Integer aValue)
00176 {
00177         myUpperIntegerLimit = aValue;
00178         myUpperLimit = TCollection_AsciiString(myUpperIntegerLimit);
00179 }
00180 
00181 //==================================================================================
00182 // Function name        : exotkParameter_Integer::SetLowerIntegerLimit
00183 //==================================================================================
00184 // Written by       : Stephane Routelous - 08/03/2001 01:02:53
00185 // Description      : 
00186 // Return type          : void 
00187 //==================================================================================
00188 // Argument         : const Standard_Integer aValue
00189 void exotkParameter_Integer::SetLowerIntegerLimit(const Standard_Integer aValue)
00190 {
00191         myLowerIntegerLimit = aValue;
00192         myLowerLimit = TCollection_AsciiString(myLowerIntegerLimit);
00193 }
00194 
00195 //==================================================================================
00196 // Function name        : exotkParameter_Integer::IntegerLimits
00197 //==================================================================================
00198 // Written by       : Stephane Routelous - 08/03/2001 01:02:52
00199 // Description      : 
00200 // Return type          : void 
00201 //==================================================================================
00202 // Argument         : Standard_Integer& aLowerIntegerLimit
00203 // Argument         : Standard_Integer& anUpperIntegerLimit
00204 void exotkParameter_Integer::IntegerLimits(Standard_Integer& aLowerIntegerLimit,Standard_Integer& anUpperIntegerLimit)
00205 {
00206         aLowerIntegerLimit = myLowerIntegerLimit;
00207         anUpperIntegerLimit = myUpperIntegerLimit;
00208 }

Generated on Wed Jan 23 12:16:43 2002 for exotk by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001