Back to index

salome-kernel  6.5.0
SALOMEDSImpl_GenericVariable.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 //  File   : SALOMEDSImpl_GenericVariable.hxx
00021 //  Author : Roman NIKOLAEV, Open CASCADE S.A.S.
00022 //  Module : SALOME
00023 //
00024 #ifndef _GENERICIMPL_VARIABLE_HXX_
00025 #define _GENERICIMPL_VARIABLE_HXX_
00026 
00027 #include "SALOMEDSImpl_Defines.hxx"
00028 
00029 #include <string>
00030 
00031 //This is base class for all variable of the Salome notebook
00032 
00033 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_GenericVariable
00034 {
00035  public:
00036   
00037   //Supported types of the nootebook variables
00038   enum VariableTypes{REAL_VAR, INTEGER_VAR, BOOLEAN_VAR, STRING_VAR};
00039 
00040   SALOMEDSImpl_GenericVariable(VariableTypes theType, const std::string& theName);
00041   ~SALOMEDSImpl_GenericVariable();
00042 
00043   VariableTypes Type() const;
00044 
00045   std::string Name() const;
00046 
00047   static VariableTypes String2VariableType(const std::string& theStrType);
00048   
00049   bool setType(const VariableTypes theType);
00050 
00051   bool setName(const std::string& theName);
00052 
00053   virtual std::string Save() const;
00054   virtual std::string SaveToScript() const;
00055   virtual std::string SaveType() const;
00056 
00057   virtual void Load(const std::string& theStrValue);
00058   
00059  private:
00060   VariableTypes _type;
00061   std::string _name;
00062 };
00063 
00064 #endif //_GENERICIMPL_VARIABLE_HXX_