00001 /*!@file Component/ModelOptionDef.H Types for defining command-line options. */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Component/ModelOptionDef.H $ 00035 // $Id: ModelOptionDef.H 6117 2006-01-19 23:16:28Z rjpeters $ 00036 // 00037 00038 #ifndef MODELOPTIONDEF_H_DEFINED 00039 #define MODELOPTIONDEF_H_DEFINED 00040 00041 #include <typeinfo> 00042 00043 // ###################################################################### 00044 //! Model option kinds -- either flag, alias, or argument-requiring option 00045 enum ModelOptionKind { 00046 MOK_ARG, 00047 MOK_FLAG, 00048 MOK_OBSOLETE, 00049 MOK_ALIAS 00050 }; 00051 00052 // ###################################################################### 00053 //! ModelOptionType -- represents a ModelOptionKind plus type info 00054 struct ModelOptionType { 00055 ModelOptionKind kind; 00056 const std::type_info* argtype; //! type of argument expected, or null 00057 }; 00058 00059 /*! @name ModelOptionType initializers */ 00060 //@{ 00061 00062 //! Builds a ModelOptionType initializer for an option with argument-type T 00063 #define MODOPT_ARG(T) { MOK_ARG, &(typeid(T)) } 00064 00065 //! ModelOptionType initializer for flag options 00066 extern const ModelOptionType MODOPT_FLAG; 00067 00068 //! ModelOptionType initializer for obsolete options 00069 extern const ModelOptionType MODOPT_OBSOLETE; 00070 00071 //! ModelOptionType initializer for alias options 00072 extern const ModelOptionType MODOPT_ALIAS; 00073 00074 //! ModelOptionType initializer for string options 00075 extern const ModelOptionType MODOPT_ARG_STRING; 00076 00077 //@} 00078 00079 // ###################################################################### 00080 //! Sort-priority levels for ModelOptionCateg (lower number == higher priority) 00081 enum ModelOptionCategPriority { 00082 MOC_SORTPRI_1, 00083 MOC_SORTPRI_2, 00084 MOC_SORTPRI_3, 00085 MOC_SORTPRI_4, 00086 MOC_SORTPRI_5 00087 }; 00088 00089 // ###################################################################### 00090 //! Holds information about a group of command-line options; used for printing --help message 00091 struct ModelOptionCateg { 00092 ModelOptionCategPriority sortpriority; 00093 const char* description; 00094 }; 00095 00096 // NOTE: If you want to create a new option category with a new 00097 // ModelOptionCateg object, then you should add it to a local file 00098 // nearby to where the options are going to be used, e.g. in the same 00099 // source subdirectory (i.e., don't add the new ModelOptionCateg here 00100 // in this file). 00101 00102 extern const ModelOptionCateg MOC_GENERAL; //!< General-use options 00103 extern const ModelOptionCateg MOC_ALIAS; //!< Option aliases 00104 00105 // ###################################################################### 00106 //! What to export when calling ModelComponent::exportOptions() 00107 //@{ 00108 00109 //! Export no option 00110 const int OPTEXP_NONE = 0; 00111 00112 //! Export all options 00113 const int OPTEXP_ALL = 0xffff; 00114 00115 /*! Export our core configuration options that do not require any other 00116 model component to be present in the model */ 00117 const int OPTEXP_CORE = (1 << 0); 00118 00119 /*! Export our options that relate to saving results, and require that 00120 an OutputFrameSeries be available (and used!) in the model */ 00121 const int OPTEXP_SAVE = (1 << 1); 00122 00123 /*! Export options that relate to the MbariResultViewer */ 00124 const int OPTEXP_MRV = (1 << 2); 00125 00126 //@} 00127 00128 // ###################################################################### 00129 //! Specification of a known model option 00130 struct ModelOptionDef 00131 { 00132 ModelOptionType type; //!< Type of the option 00133 const char* name; //!< Option name 00134 const ModelOptionCateg* categ; //!< Option category 00135 const int exportFlag; //!< one of the what-to-export flags 00136 const char* descr; //!< Description of what option does 00137 const char* longoptname; //!< Long option name (without leading "--") 00138 char shortoptname; //!< Short option name (without leading "-") 00139 const char* validvals; //!< Textual description of valid values, or NULL 00140 const char* defval; //!< Default value in text representation 00141 }; 00142 00143 #endif // !MODELOPTIONDEF_H_DEFINED 00144 00145 // ###################################################################### 00146 /* So things look consistent in everyone's emacs... */ 00147 /* Local Variables: */ 00148 /* indent-tabs-mode: nil */ 00149 /* End: */