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

📄 cmdline.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*    Context       : Fuzzy Clustering Algorithms  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of class module CmdLine                    History       :      Comment       :     This file was generated automatically. DO NOT EDIT.  Copyright     : Copyright (C) 1999-2000 Frank Hoeppner    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//*  The University of Applied Sciences Oldenburg/Ostfriesland/Wilhelmshaven  hereby disclaims all copyright interests in the program package `fc'   (tool package for fuzzy cluster analysis) written by Frank Hoeppner.    Prof. Haass, President of Vice, 2000-Mar-10*/#ifndef CmdLine_SOURCE#define CmdLine_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "CmdLine.hpp"#include <string>#include "Option.hpp" // shortcut definitions#ifdef HAVE_GETOPT_H#  include <getopt.h> // getopt_long#endif// data#ifdef HAVE_GETOPT_H#define CL_OPTION_HELP 'h'static struct option long_options[] =   {    {"list-options",no_argument,NULL,CL_OPTION_HELP},    {"analysis-name",required_argument,NULL,CL_OPTION_ANALYSISNAME},    {"cluster-range",required_argument,NULL,CL_OPTION_CLUSTERRANGE},    {"constants",required_argument,NULL,CL_OPTION_CONSTANTS},    {"dist-shift",required_argument,NULL,CL_OPTION_DISTSHIFT},    {"fuzzifier",required_argument,NULL,CL_OPTION_FUZZIFIER},    {"postscript",no_argument,NULL,CL_OPTION_POSTSCRIPT},    {"graphics-mode",required_argument,NULL,CL_OPTION_GRAPHMODE},    {"init-by-membership",no_argument,NULL,CL_OPTION_INIT},    {"inter-data-distance",required_argument,NULL,CL_OPTION_INTERDATADIST},    {"interim-output",required_argument,NULL,CL_OPTION_INTERIMOUT},    {"maximum-features",required_argument,NULL,CL_OPTION_MAXFEATURES},    {"quiet-mode",no_argument,NULL,CL_OPTION_QUIETMODE},    {"output",optional_argument,NULL,CL_OPTION_OUTPUT},    {"select",required_argument,NULL,CL_OPTION_PICKSELECT},    {"select-x-axis",required_argument,NULL,CL_OPTION_SELECTXAXIS},    {"select-y-axis",required_argument,NULL,CL_OPTION_SELECTYAXIS},    {"select-z-axis",required_argument,NULL,CL_OPTION_SELECTZAXIS},    {"select-t-axis",required_argument,NULL,CL_OPTION_SELECTTAXIS},    {"select-c-axis",required_argument,NULL,CL_OPTION_SELECTCAXIS},    {"select-a-axis",required_argument,NULL,CL_OPTION_SELECTAAXIS},    {"select-i-axis",required_argument,NULL,CL_OPTION_SELECTIAXIS},    {"select-s-axis",required_argument,NULL,CL_OPTION_SELECTSAXIS},    {"select-dx-axis",required_argument,NULL,CL_OPTION_SELECTDXAXIS},    {"select-dy-axis",required_argument,NULL,CL_OPTION_SELECTDYAXIS},    {"select-dz-axis",required_argument,NULL,CL_OPTION_SELECTDZAXIS},    {"substitute-features",no_argument,NULL,CL_OPTION_SUBSTFEATURES},    {"max-iterations",required_argument,NULL,CL_OPTION_MAXITERATIONS},    {"epsilon",required_argument,NULL,CL_OPTION_CONVERGENCE},    {"unsupervised",optional_argument,NULL,CL_OPTION_UNSUPERVISED},    {"weight-factor",required_argument,NULL,CL_OPTION_WEIGHTFACTOR},    {"input-transformation",required_argument,NULL,CL_OPTION_DATATRANS},    {"output-transformation",required_argument,NULL,CL_OPTION_RESTRANS},    {"data-scale",required_argument,NULL,CL_OPTION_DATASCALE},    {"prefer-local",optional_argument,NULL,CL_OPTION_PREFER_LOCAL},    {"sphere-hierarchy",required_argument,NULL,CL_OPTION_SPHEREHIER},    {"connect",required_argument,NULL,CL_OPTION_CONNECT},    {"compare-name",required_argument,NULL,CL_OPTION_COMPARENAME},    {0,0,NULL,0}  };#endif// implementationtemplate < class ANALYSIS >CmdLine< ANALYSIS >::CmdLine  (  int argc,  char * const * argv,  OnePassAlgorithm<ANALYSIS>* ap_alg  )  : mp_succ_alg(ap_alg)  , m_argc(argc)  , m_argv(argv)  , m_shortcuts("")  , m_elem_funcs_called(false)  , m_emulated_elem_wise(false)  {  #ifdef HAVE_GETOPT_H    int i(0);    while (long_options[i].name!=NULL)      {      m_shortcuts += char(long_options[i].val);      switch (long_options[i].has_arg)        {        case no_argument : break;        case optional_argument : m_shortcuts += ':'; // no break, need "::"        case required_argument : m_shortcuts += ':'; break;        }      ++i;      }    optind = 0;    bool working(true);    int c,option_index(0);    while (working)      {      c = getopt_long(m_argc,m_argv,m_shortcuts.c_str(),long_options,&option_index);      switch (c)        {        case -1  :           working = false;           break;        case '?' :           cerr << "missing value, ambiguous match or extraneous parameter."                << endl;           exit(-1);          break;        case CL_OPTION_HELP :          {            cout << "This program is part of " << PACKAGE << "-" << VERSION                << " Copyright (c) 1999-2000 Frank Hoeppner" << endl << endl               << "It comes with ABSOLUTELY NO WARRANTY. This is free software," << endl               << "and you are welcome to redistribute it under certain conditions;" << endl               << "see the GNU General Public License (GPL) for details." << endl << endl;          cout << "Available options (see docs for detailed info):" << endl;          int i(0);           while (long_options[i].name!=NULL)            {            cout << "-" << char(long_options[i].val)                  << " or --" << long_options[i].name;            switch (long_options[i].has_arg)              {              case no_argument : break;              case optional_argument : cout << " [arg]"; break;              case required_argument : cout << " arg"; break;              }            cout  << endl;            ++i;            }          exit(-1);          }               }      }  #else    if (m_argc>1)      cerr << "*** no command line evaluation, <getopt.h> missing" << endl;  #endif  }template < class ANALYSIS >CmdLine< ANALYSIS >::~CmdLine  (  )  {  FUNCLOG("~CmdLine");    delete mp_succ_alg;  }template < class ANALYSIS >voidCmdLine< ANALYSIS >::operator()  (  ANALYSIS& a_analysis  )  {  FUNCLOG("CmdLine");  if (!m_elem_funcs_called)    {    m_emulated_elem_wise = true;    operator()(a_analysis,a_analysis.option());    for (        typename ANALYSIS::data_iter i_data(a_analysis.data().begin());        i_data != a_analysis.data().end();        ++i_data        )      { operator()(a_analysis,*i_data); }    for (        typename ANALYSIS::prot_iter i_prot(a_analysis.prototypes().begin());        i_prot != a_analysis.prototypes().end();        ++i_prot        )      { operator()(a_analysis,*i_prot); }    for (        typename ANALYSIS::link_iter i_link(a_analysis.links().begin());        i_link != a_analysis.links().end();        ++i_link        )      { operator()(a_analysis,*i_link); }    }  (*mp_succ_alg)(a_analysis);  m_elem_funcs_called=false;  m_emulated_elem_wise=false;  }template < class ANALYSIS >voidCmdLine< ANALYSIS >::operator()  (  ANALYSIS& a_analysis,  CmdLine< ANALYSIS >::opt_type& a_option  )  {  FUNCLOG("CmdLine::operator(opt)");  if (!m_elem_funcs_called) reset(a_analysis);  #ifdef HAVE_GETOPT_H    optind = 0;    bool working(true);    int c,option_index(0);    while (working)      {      c = getopt_long(m_argc,m_argv,m_shortcuts.c_str(),long_options,&option_index);      switch (c)        {        case -1  :           working = false;           break;        case '?' :           cerr << "missing value, ambiguous match or extraneous parameter."                << endl;           exit(-1);          break;        case CL_OPTION_ANALYSISNAME :          {          a_option.analysis_name() = optarg;          a_option.history().erase();          trace("set analysis name to",a_option.analysis_name());          break;          }        case CL_OPTION_CLUSTERRANGE :          {          istrstream is(optarg,strlen(optarg));          is >> a_option.min_no_of_clusters();          if (is_followed_by(is,":",false))             { is >> a_option.max_no_of_clusters(); }          else

⌨️ 快捷键说明

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