Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

parameterTask.h

Go to the documentation of this file.
00001 #ifndef _parameter_task_H 00002 #define _parameter_task_H 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) European Southern Observatory, 2005 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * "@(#) $Id: parameterTask.h,v 1.13 2008/10/09 07:22:33 cparedes Exp $" 00022 * 00023 * who when what 00024 * -------- -------- ---------------------------------------------- 00025 * bjeram 2005-01-19 created 00026 */ 00027 00028 /************************************************************************ 00029 * 00030 *---------------------------------------------------------------------- 00031 */ 00032 00033 #ifndef __cplusplus 00034 #error This is a C++ include file and cannot be used from plain C 00035 #endif 00036 00037 #include <map> 00038 #include <memory> 00039 #include <vector> 00040 #include "taskComponent.h" 00041 #include <xercesc/dom/DOMDocument.hpp> 00042 #include <ParamSetDef.h> 00043 #include <task.h> 00044 00045 using Parameters::ParamSetDef; 00046 using XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument; 00047 00048 namespace ACS 00049 { 00058 class parameterTask : public virtual acscomponent::ACSComponentImpl, 00059 public virtual POA_ACS::TaskComponent, public ACS::Task 00060 { 00061 public: 00067 parameterTask(const ACE_CString& name, maci::ContainerServices* containerServices); 00068 00072 virtual ~parameterTask(){} 00073 00081 virtual void run (const ACS::StringSequence & parameters, const char* fileName); 00082 00083 private: 00084 /* 00085 * @throw invalid_argument 00086 */ 00087 void buildParameterMap(const ACS::StringSequence & parameters, const string & baseFileName) ; 00088 /* 00089 * @throw std::invalid_argument 00090 */ 00091 void checkPosition(string::size_type currPosition, unsigned int length, const string & msg) ; 00092 /* 00093 * @throw std::domain_error 00094 */ 00095 string buildParameterSetXML(const string & fileNamePrefix); 00096 DOMElement* createBoolElement(const string & paramName, const vector<string> & values, DOMDocument*); 00097 DOMElement* createIntElement(const string & paramName, const vector<string> & values, DOMDocument*); 00098 DOMElement* createIntArrayElement(const string & paramName, const vector<string> & values, DOMDocument*); 00099 DOMElement* createDoubleElement(const string & paramName, const vector<string> & values, DOMDocument*); 00100 DOMElement* createDoubleArrayElement(const string & paramName, const vector<string> & values, DOMDocument*); 00101 DOMElement* createStringElement(const string & paramName, const vector<string> & values, DOMDocument*); 00102 DOMElement* createStringArrayElement(const string & paramName, const vector<string> & values, DOMDocument*); 00103 DOMElement* createSimpleElement(const string & paramName, const vector<string> & values, DOMDocument *doc, 00104 const string & paramType); 00105 DOMElement* createArrayElement(const string & paramName, const vector<string> & values, 00106 DOMDocument *doc, const string & paramType); 00107 00108 /* 00109 * @throw invalid_argument 00110 */ 00111 vector<string> parseBoolElement(const string & valueString); 00112 /* 00113 * @throw invalid_argument 00114 */ 00115 vector<string> parseIntElement(const string & valueString); 00116 /* 00117 * @throw invalid_argument 00118 */ 00119 vector<string> parseIntArrayElement(const string & valueString); 00120 /* 00121 * @throw invalid_argument 00122 */ 00123 vector<string> parseDoubleElement(const string & valueString); 00124 /* 00125 * @throw invalid_argument 00126 */ 00127 vector<string> parseDoubleArrayElement(const string & valueString); 00128 /* 00129 * @throw invalid_argument 00130 */ 00131 vector<string> parseStringElement(const string & valueString); 00132 /* 00133 * @throw invalid_argument 00134 */ 00135 vector<string> parseStringArrayElement(const string & valueString); 00136 00137 // map to hold the name/value(s) information from the parsed command line 00138 map<string, vector<string> > parameterMap; 00139 00140 // the in-memory DOM document built from the parameters 00141 auto_ptr<DOMDocument> domDocument; 00142 00143 // the parameter set definition 00144 auto_ptr<ParamSetDef> paramSetDef; 00145 }; 00146 00147 }; 00148 #endif

Generated on Thu Apr 30 02:30:52 2009 for ACS C++ API by doxygen 1.3.8