⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optionmanager.h

📁 Amis - A maximum entropy estimator 一个最大熵模型统计工具
💻 H
字号:
////////////////////////////////////////////////////////////////////////////  Copyright (c) 2000, Yusuke Miyao///  You may distribute under the terms of the Artistic License.//////  <id>$Id: OptionManager.h,v 1.3 2003/05/14 06:01:53 yusuke Exp $</id>///  <collection>Maximum Entropy Estimator</collection>///  <name>OptionManager.h</name>///  <overview>Maximum entropy model</overview>/////////////////////////////////////////////////////////////////////////#ifndef Amis_OptionManager_h_#define Amis_OptionManager_h_#include <amis/configure.h>#include <amis/Initializer.h>#include <amis/ErrorBase.h>#include <map>AMIS_NAMESPACE_BEGIN///////////////////////////////////////////////////////////////////////// <classdef>/// <name>IllegalOptionError</name>/// <overview>Exception for illegal options</overview>/// <desc>/// The class signals illegal property specifications in/// command-line arguments and in a property file/// </desc>/// <body>class IllegalOptionError : public ErrorBase { public:  IllegalOptionError( const std::string& m ) : ErrorBase( m ) {}  /// Initialize with an error message  IllegalOptionError( const char* m ) : ErrorBase( m ) {}  /// Initialize with an error message};/// </body>/// </classdef>//////////////////////////////////////////////////////////class OptionBase;class OptionManager {protected:  Initializer< OptionManager* >*& queue;  std::vector< OptionBase* > option_vector;  std::map< std::string, OptionBase* > name_hash;  std::map< std::string, OptionBase* > long_hash;  std::map< std::string, OptionBase* > short_hash;  // accumulate non-optional argumens  // comm -o1 <a1> <n1> -o0 <n2> <n3> => [n1, n2, n3]   //std::vector< std::string >  last_vec;public:  OptionManager( Initializer< OptionManager* >*& q ) : queue( q ) {}  virtual ~OptionManager() {}  void initAllOptions( void ) {    Initializer< OptionManager* >::initAll( queue, this );  }  void initOption( OptionBase* opt );  std::string getShortDescription( void ) const;  std::string getFullDescription( void ) const;  std::string getSpecificationStatus( void ) const;  OptionBase* findOption( const std::string& name ) {    std::map< std::string, OptionBase* >::iterator it = name_hash.find( name );    if ( it == name_hash.end() ) {      return NULL;    } else {      return it->second;    }  }  OptionBase* findOptionLongName( const std::string& name ) {    std::map< std::string, OptionBase* >::iterator it = long_hash.find( name );    if ( it == long_hash.end() ) {      return NULL;    } else {      return it->second;    }  }  OptionBase* findOptionShortName( const std::string& name ) {    std::map< std::string, OptionBase* >::iterator it = short_hash.find( name );    if ( it == short_hash.end() ) {      return NULL;    } else {      return it->second;    }  }  void setOption( const std::string& name, const std::string& value );  void setOptionLongName( const std::string& name, const std::string& value );  void setOptionShortName( const std::string& name, const std::string& value );  void resetToInit( void );};AMIS_NAMESPACE_END#endif // Amis_OptionManager_h_// end of OptionManager.h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -