#include <utilities.h>
#include <stdio.h>
+SALOME_Parameter::SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, bool theValue )
+: myNotebook( theNotebook ), myName( theName ), myResult( theValue ), myIsAnonimous( false ), myIsCalculable( false )
+{
+}
+
+SALOME_Parameter::SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, int theValue )
+: myNotebook( theNotebook ), myName( theName ), myResult( theValue ), myIsAnonimous( false ), myIsCalculable( false )
+{
+}
+
SALOME_Parameter::SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, double theValue )
: myNotebook( theNotebook ), myName( theName ), myResult( theValue ), myIsAnonimous( false ), myIsCalculable( false )
{
}
-SALOME_Parameter::SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, const std::string& theExpr )
-: myNotebook( theNotebook ), myName( theName ), myExpr( theExpr ), myIsAnonimous( false ), myIsCalculable( true )
+SALOME_Parameter::SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, const std::string& theData, bool isExpr )
+: myNotebook( theNotebook ), myName( theName ), myIsAnonimous( false ), myIsCalculable( isExpr )
{
- Update( SALOME::Notebook_ptr() );
+ if( isExpr )
+ {
+ myExpr.setExpression( theData );
+ Update( SALOME::Notebook_ptr() );
+ }
+ else
+ myResult = theData;
}
SALOME_Parameter::SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theExpr )
return myResult.isValid();
}
+void SALOME_Parameter::SetParameters( SALOME::Notebook_ptr /*theNotebook*/, const SALOME::StringArray& /*theParameters*/ )
+{
+}
+
void SALOME_Parameter::Update( SALOME::Notebook_ptr /*theNotebook*/ )
{
//printf( "Update of %s\n", GetEntry() );
for( ; it!=last; it++ )
{
std::string aName = *it;
- SALOME_Parameter* aParam = myNotebook->ParamPtr( const_cast<char*>( aName.c_str() ) );
+ SALOME_Parameter* aParam = myNotebook->GetParameterPtr( const_cast<char*>( aName.c_str() ) );
if( aParam )
{
//printf( "\tset %s = %lf\n", aName.c_str(), aParam->AsReal() );
}
}
-void SALOME_Parameter::SetExpr( const char* theExpr )
+void SALOME_Parameter::SetExpression( const char* theExpr )
{
if( myIsAnonimous )
- myNotebook->AddExpr( theExpr );
+ myNotebook->AddExpression( theExpr );
else
{
}
}
+void SALOME_Parameter::SetBoolean( CORBA::Boolean theValue )
+{
+ if( myIsAnonimous )
+ {
+ }
+ else
+ {
+ myResult = theValue;
+ myIsCalculable = false;
+ myNotebook->SetToUpdate( _this() );
+ }
+}
+
+void SALOME_Parameter::SetInteger( CORBA::Long theValue )
+{
+ if( myIsAnonimous )
+ {
+ }
+ else
+ {
+ myResult = (int)theValue;
+ myIsCalculable = false;
+ myNotebook->SetToUpdate( _this() );
+ }
+}
+
void SALOME_Parameter::SetReal( CORBA::Double theValue )
{
if( myIsAnonimous )
}
}
+void SALOME_Parameter::SetString( const char* theValue )
+{
+ if( myIsAnonimous )
+ {
+ }
+ else
+ {
+ myResult = theValue;
+ myIsCalculable = false;
+ myNotebook->SetToUpdate( _this() );
+ }
+}
+
SALOME::ParamType SALOME_Parameter::GetType()
{
switch( myResult.type() )
{
return 0;
}
+
+bool SALOME_Parameter::IsAnonimous() const
+{
+ return myIsAnonimous;
+}
+
+bool SALOME_Parameter::IsCalculable() const
+{
+ return myIsCalculable;
+}
+
+std::string SALOME_Parameter::Expression() const
+{
+ return myExpr.expression();
+}
{
public:
//! standard constructor
+ SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, bool theValue );
+ SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, int theValue );
SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, double theValue );
- SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, const std::string& theExpr );
+ SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theName, const std::string& theData, bool isExpr );
SALOME_Parameter( SALOME_Notebook* theNotebook, const std::string& theExpr );
//! standard destructor
virtual ~SALOME_Parameter();
virtual char* GetEntry();
-
virtual char* GetComponent();
-
virtual CORBA::Boolean IsValid();
virtual void Update( SALOME::Notebook_ptr theNotebook );
+ virtual void SetParameters ( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters );
- virtual void SetExpr( const char* theExpr );
-
+ virtual void SetExpression( const char* theExpr );
+ virtual void SetBoolean( CORBA::Boolean theValue );
+ virtual void SetInteger( CORBA::Long theValue );
virtual void SetReal( CORBA::Double theValue );
+ virtual void SetString( const char* theValue );
virtual SALOME::ParamType GetType();
std::string Save() const;
static SALOME_Parameter* Load( const std::string& theData );
+ bool IsAnonimous() const;
+ bool IsCalculable() const;
+
+ std::string Expression() const;
+
private:
SALOME_Notebook* myNotebook;
std::string myName;