Back to index

salome-med  6.5.0
Public Member Functions | Private Attributes
MEDMEM::OptionManager Class Reference

#include <MEDMEM_OptionManager.hxx>

Collaboration diagram for MEDMEM::OptionManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~OptionManager ()
template<class T >
void registerOption (T *var, const std::string &name, T defaut)
template<class T >
void getOption (const std::string &name, T &var)
template<class T >
void setOption (const std::string &name, T value)
void setOption (const std::string &name, int value)

Private Attributes

std::map< std::string,
OptionGeneric * > 
_optionList

Detailed Description

Definition at line 58 of file MEDMEM_OptionManager.hxx.


Constructor & Destructor Documentation

Definition at line 65 of file MEDMEM_OptionManager.hxx.

    {
                        std::map< std::string, OptionGeneric*>::iterator mi;
      for(mi = _optionList.begin() ; mi != _optionList.end() ; mi++) delete (*mi).second;
    }

Member Function Documentation

template<class T >
void MEDMEM::OptionManager::getOption ( const std::string &  name,
T &  var 
) [inline]

Definition at line 77 of file MEDMEM_OptionManager.hxx.

    {
      if(_optionList.find(name) != _optionList.end())  
                                {
                                        Option<T>* option_ptr = dynamic_cast<Option<T>*>(_optionList.find(name)->second);
                                        var= option_ptr->getValue();
                                }
                        else throw MEDEXCEPTION 
                                ("Option is not listed, please register the option before using the getOption command");
    }

Here is the call graph for this function:

template<class T >
void MEDMEM::OptionManager::registerOption ( T *  var,
const std::string &  name,
defaut 
) [inline]

Definition at line 71 of file MEDMEM_OptionManager.hxx.

    {
      OptionGeneric  * newoption = new Option<T>( defaut, var);
      _optionList.insert(make_pair(name, newoption));                   
    }
template<class T >
void MEDMEM::OptionManager::setOption ( const std::string &  name,
value 
) [inline]

Definition at line 88 of file MEDMEM_OptionManager.hxx.

    {
      if(_optionList.find(name) != _optionList.end())
                                {
                                        Option<T>* option_ptr = dynamic_cast<Option<T>*>(_optionList.find(name)->second);
                                        if (option_ptr != 0 )
                                                option_ptr->setValue(value);
                                        else throw MEDEXCEPTION ("Error setOption: Option is registered with a different type");
                                }
      else throw MEDEXCEPTION 
                                ("Option is not listed, please register the option before using the setOption command");
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MEDMEM::OptionManager::setOption ( const std::string &  name,
int  value 
) [inline]

Definition at line 101 of file MEDMEM_OptionManager.hxx.

    {
      if(_optionList.find(name) != _optionList.end())
                                {
                                        Option<double>* option_double_ptr = dynamic_cast<Option<double>*> (_optionList.find(name)->second);
                                        if (option_double_ptr!=0)
                                                setOption(name,(double) value);
                                        else
                                                {
                                                        Option<int>* option_ptr =dynamic_cast<Option<int>*>(_optionList.find(name)->second);
                                                        if (option_ptr != 0 )
                                                                option_ptr->setValue(value);
                                                        else throw MEDEXCEPTION ("Error setOption: Option is registered with a different type");
                                                }
                                }
      else throw MEDEXCEPTION 
                                ("Option is not listed, please register the option before using the setOption command");
    }

Here is the call graph for this function:


Member Data Documentation

std::map< std::string, OptionGeneric* > MEDMEM::OptionManager::_optionList [private]

Definition at line 61 of file MEDMEM_OptionManager.hxx.


The documentation for this class was generated from the following file: