Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

ParameterSet.h

00001 // Copyright (C) 1999 Jean-Marc Valin
00002 
00003 #ifndef PARAMETERSET_H
00004 #define PARAMETERSET_H
00005 
00006 #include "Object.h"
00007 #include <map>
00008 #include <string>
00009 #include "BaseException.h"
00010 
00011 namespace FD {
00012 
00018 class ParameterSet : public std::map<std::string,std::pair<ObjectRef,bool> > {
00019 public:
00021    bool exist(const std::string &param) const;
00022 
00024    ObjectRef get(std::string param) const;
00025 
00027    ObjectRef getDefault(std::string param, ObjectRef value);
00028 
00030    void defaultParam(std::string param, ObjectRef value);
00031 
00033    void add(std::string param, ObjectRef value);
00034 
00036    void print(std::ostream &out = std::cerr) const;
00037 
00039    void checkUnused() const;
00040 };
00041 
00048 class ParameterException : public BaseException {
00049 
00050 public:
00052    ParameterException(std::string _message, std::string _param_name, ParameterSet _params)
00053       : param_name(_param_name)
00054       , params(_params)
00055       , message(_message)
00056    {}   
00058    virtual void print(std::ostream &out = std::cerr) 
00059    {
00060       out << message << ": "<< param_name <<std::endl;
00061       out << "Given parameters are:\n";
00062       params.print(out);
00063    }
00064 protected:
00066    std::string param_name;
00068    ParameterSet params;
00070    std::string message;
00071 };
00072 
00073 }//end namespace FD
00074 #endif

Generated on Wed Oct 5 14:28:56 2005 for FlowDesigner by  doxygen 1.4.4