From d016f7cdcd35caf662ae9dba010c0e33949e2bcd Mon Sep 17 00:00:00 2001 From: Russell Taylor <taylorrj@ornl.gov> Date: Mon, 12 Nov 2007 14:00:28 +0000 Subject: [PATCH] More standardisation of doxygen comments. Re #47. --- Code/Mantid/Build/Mantid.doxyfile | 2 +- Code/Mantid/Kernel/inc/ConfigSvc.h | 2 +- Code/Mantid/Kernel/inc/Exception.h | 22 +- Code/Mantid/Kernel/inc/Support.h | 80 ++-- Code/Mantid/Kernel/inc/System.h | 6 + Code/Mantid/Kernel/src/Algorithm.cpp | 4 +- .../Mantid/Kernel/src/AnalysisDataService.cpp | 2 +- Code/Mantid/Kernel/src/Exception.cpp | 14 +- Code/Mantid/Kernel/src/Support.cpp | 434 ++++++++---------- 9 files changed, 288 insertions(+), 278 deletions(-) diff --git a/Code/Mantid/Build/Mantid.doxyfile b/Code/Mantid/Build/Mantid.doxyfile index 54d2db7967b..237753df202 100644 --- a/Code/Mantid/Build/Mantid.doxyfile +++ b/Code/Mantid/Build/Mantid.doxyfile @@ -1006,7 +1006,7 @@ ENABLE_PREPROCESSING = YES # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the diff --git a/Code/Mantid/Kernel/inc/ConfigSvc.h b/Code/Mantid/Kernel/inc/ConfigSvc.h index cbe411ea95c..6af3fb9eb85 100644 --- a/Code/Mantid/Kernel/inc/ConfigSvc.h +++ b/Code/Mantid/Kernel/inc/ConfigSvc.h @@ -73,7 +73,7 @@ namespace Kernel } /** Constructor with a class to wrap - * @param Field The class to wrap + * @param F The object to wrap */ template<typename Field> WrappedObject(Field& F) : T(F) diff --git a/Code/Mantid/Kernel/inc/Exception.h b/Code/Mantid/Kernel/inc/Exception.h index 939a0741d36..b221d5f39cb 100644 --- a/Code/Mantid/Kernel/inc/Exception.h +++ b/Code/Mantid/Kernel/inc/Exception.h @@ -11,8 +11,8 @@ namespace Mantid { namespace Kernel { -/** @file - The File contains all of the exception classes used by Mantid that are extended from the std:exception classes. +/** + The exception classes used by Mantid. All exceptions inherit from std:exception. The exception tree is @@ -68,8 +68,8 @@ namespace Kernel You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. - File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid> - Code Documentation is available at: <http://doxygen.mantidproject.org> + File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. + Code Documentation is available at: <http://doxygen.mantidproject.org> */ namespace Exception { @@ -78,13 +78,17 @@ namespace Exception class DLLExport FileError : public std::runtime_error { private: + /// The name of the file relating to the error const std::string fileName; + /// The message returned by what() std::string outMessage; public: FileError(const std::string&,const std::string&); FileError(const FileError& A); + /// Assignment operator FileError& operator=(const FileError& A); + /// Destructor ~FileError() throw() {} const char* what() const throw(); @@ -96,7 +100,9 @@ class DLLExport NotImplementedError : public std::logic_error public: NotImplementedError(const std::string&); NotImplementedError(const NotImplementedError& A); + /// Assignment operator NotImplementedError& operator=(const NotImplementedError& A); + /// Destructor ~NotImplementedError() throw() {} const char* what() const throw(); @@ -106,13 +112,17 @@ class DLLExport NotImplementedError : public std::logic_error class DLLExport NotFoundError : public std::runtime_error { private: + /// The name of the search object const std::string objectName; + /// The message returned by what() std::string outMessage; public: NotFoundError(const std::string&,const std::string&); NotFoundError(const NotFoundError& A); + /// Assignment operator NotFoundError& operator=(const NotFoundError& A); + /// Destructor ~NotFoundError() throw() {} const char* what() const throw(); @@ -122,13 +132,17 @@ class DLLExport NotFoundError : public std::runtime_error class DLLExport ExistsError : public std::runtime_error { private: + /// The name of the search object const std::string objectName; + /// The message returned by what() std::string outMessage; public: ExistsError(const std::string&,const std::string&); ExistsError(const ExistsError& A); + /// Assignment operator ExistsError& operator=(const ExistsError& A); + /// Destructor ~ExistsError() throw() {} const char* what() const throw(); diff --git a/Code/Mantid/Kernel/inc/Support.h b/Code/Mantid/Kernel/inc/Support.h index a7a00a5f97e..f2682a7a86b 100644 --- a/Code/Mantid/Kernel/inc/Support.h +++ b/Code/Mantid/Kernel/inc/Support.h @@ -1,6 +1,9 @@ #ifndef MANTID_STRFUNC_SUPPORT_H_ #define MANTID_STRFUNC_SUPPORT_H_ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- #include "System.h" #include <iostream> #include <sstream> @@ -8,73 +11,90 @@ namespace Mantid { -/*! - \namespace StrFunc - \brief Holds support functions for strings - \author S. Ansell - \date February 2006 - \version 1.0 +/** Holds support functions for strings. + + @author S. Ansell + @date February 2006 + + Copyright © 2007 STFC Rutherford Appleton Laboratories + + This file is part of Mantid. + + Mantid 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 3 of the License, or + (at your option) any later version. + + Mantid 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, see <http://www.gnu.org/licenses/>. + + File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. + Code Documentation is available at: <http://doxygen.mantidproject.org> */ namespace StrFunc { /// determine if a character group exists in a string -DLLExport int confirmStr(const std::string&,const std::string&); +DLLExport int confirmStr(const std::string& S,const std::string& fullPhrase); /// Get a word from a string -DLLExport int extractWord(std::string&,const std::string&,const int=4); +DLLExport int extractWord(std::string& Line,const std::string& Word,const int cnt = 4); /// strip all spaces -DLLExport std::string removeSpace(const std::string&); +DLLExport std::string removeSpace(const std::string& CLine); /// strip pre/post spaces -DLLExport std::string fullBlock(const std::string&); -/// strip trialling comments -DLLExport void stripComment(std::string&); +DLLExport std::string fullBlock(const std::string& A); +/// strip trailling comments +DLLExport void stripComment(std::string& A); /// Determines if a string is only spaces -DLLExport int isEmpty(const std::string&); +DLLExport int isEmpty(const std::string& A); /// Get a line and strip comments -DLLExport std::string getLine(std::istream&,const int= 256); +DLLExport std::string getLine(std::istream& fh,const int spc = 256); /// get a part of a long line -DLLExport int getPartLine(std::istream&,std::string&,std::string&,const int= 256); +DLLExport int getPartLine(std::istream& fh,std::string& Out,std::string& Excess,const int spc = 256); -template<typename T> int convPartNum(const std::string&,T&); +template<typename T> int convPartNum(const std::string& A,T& out); /// Convert a string into a number -template<typename T> int convert(const std::string&,T&); +template<typename T> int convert(const std::string& A,T& out); /// Convert a char* into a number -template<typename T> int convert(const char*,T&); +template<typename T> int convert(const char* A,T& out); template<typename T> -int setValues(const std::string&,const std::vector<int>&, - std::vector<T>&); +int setValues(const std::string& Line,const std::vector<int>& Index,std::vector<T>& Out); /// Convert and cut a string -template<typename T> int sectPartNum(std::string&,T&); +template<typename T> int sectPartNum(std::string& A,T& out); /// Convert and cut a string -template<typename T> int section(std::string&,T&); +template<typename T> int section(std::string& A,T& out); /// Convert and cut a char* -template<typename T> int section(char*,T&); +template<typename T> int section(char* cA,T& out); /// Convert and cut a string for MCNPX -template<typename T> int sectionMCNPX(std::string&,T&); +template<typename T> int sectionMCNPX(std::string& A,T& out); /// Write file in standard MCNPX input form -void writeMCNPX(const std::string&,std::ostream&); +void writeMCNPX(const std::string& Line,std::ostream& OX); /// Split tring into spc deliminated components -std::vector<std::string> StrParts(std::string); +std::vector<std::string> StrParts(std::string Ln); /// Write a set of containers to a file template<template<typename T> class V,typename T> -int writeFile(const std::string&,const T,const V<T>&); +int writeFile(const std::string& Fname,const T step,const V<T>& Y); template<template<typename T> class V,typename T> -int writeFile(const std::string&,const V<T>&,const V<T>&); +int writeFile(const std::string& Fname,const V<T>& X,const V<T>& Y); template<template<typename T> class V,typename T> -int writeFile(const std::string&,const V<T>&,const V<T>&,const V<T>&); +int writeFile(const std::string& Fname,const V<T>& X,const V<T>& Y,const V<T>& Err); /// Convert a VAX number to x86 little eindien -DLLExport float getVAXnum(const float); +float getVAXnum(const float A); } // NAMESPACE StrFunc } // NAMESPACE Mantid diff --git a/Code/Mantid/Kernel/inc/System.h b/Code/Mantid/Kernel/inc/System.h index 0930c1c98ae..28174eb63d7 100644 --- a/Code/Mantid/Kernel/inc/System.h +++ b/Code/Mantid/Kernel/inc/System.h @@ -23,6 +23,12 @@ File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ + +// The documentation block below is for the main page of the doxygen documentation +/** @mainpage Mantid + * + */ + #ifndef MANTID_KERNEL_SYSTEM_H_ #define MANTID_KERNEL_SYSTEM_H_ diff --git a/Code/Mantid/Kernel/src/Algorithm.cpp b/Code/Mantid/Kernel/src/Algorithm.cpp index 1b0da4c626c..7c855db0ff1 100644 --- a/Code/Mantid/Kernel/src/Algorithm.cpp +++ b/Code/Mantid/Kernel/src/Algorithm.cpp @@ -278,10 +278,10 @@ namespace Kernel * * @return Success since nothing ever happens. */ - StatusCode createSubAlgorithm( const std::string& type, const std::string& name, + StatusCode Algorithm::createSubAlgorithm( const std::string& type, const std::string& name, Algorithm*& pSubAlg ) { - // TODO This method needs implementing now that we have an algorithm factory + /// @todo This method needs implementing now that we have an algorithm factory return StatusCode::SUCCESS; } diff --git a/Code/Mantid/Kernel/src/AnalysisDataService.cpp b/Code/Mantid/Kernel/src/AnalysisDataService.cpp index f2be40d4a97..fec6d9df9da 100644 --- a/Code/Mantid/Kernel/src/AnalysisDataService.cpp +++ b/Code/Mantid/Kernel/src/AnalysisDataService.cpp @@ -78,7 +78,7 @@ StatusCode AnalysisDataService::retrieve(const std::string& name, Workspace *& s // Private member functions //---------------------------------------------------------------------- -// Private constructor for singleton class +/// Private constructor for singleton class AnalysisDataService::AnalysisDataService() { } diff --git a/Code/Mantid/Kernel/src/Exception.cpp b/Code/Mantid/Kernel/src/Exception.cpp index 3cc16141a98..39f9c7a1f84 100644 --- a/Code/Mantid/Kernel/src/Exception.cpp +++ b/Code/Mantid/Kernel/src/Exception.cpp @@ -14,8 +14,8 @@ namespace Exception // FileError //------------------------- /** Constructor - @param Desc :: Function description - @param Fname :: Filename + @param Desc Function description + @param FName Filename */ FileError::FileError(const std::string& Desc,const std::string& FName) : std::runtime_error(Desc),fileName(FName) @@ -40,7 +40,7 @@ const char* FileError::what() const throw() // NotImplementedError //------------------------- /** Constructor - @param Desc :: Function description + @param Desc Function description */ NotImplementedError::NotImplementedError(const std::string& Desc) : std::logic_error(Desc) @@ -63,8 +63,8 @@ const char* NotImplementedError::what() const throw() // NotFoundError //------------------------- /** Constructor - @param Desc :: Function description - @param ObjectName :: the name of the search object + @param Desc Function description + @param ObjectName The name of the search object */ NotFoundError::NotFoundError(const std::string& Desc,const std::string& ObjectName) : std::runtime_error(Desc),objectName(ObjectName) @@ -89,8 +89,8 @@ const char* NotFoundError::what() const throw() // ExistsError //------------------------- /** Constructor - @param Desc :: Function description - @param ObjectName :: the name of the search object + @param Desc Function description + @param ObjectName The name of the search object */ ExistsError::ExistsError(const std::string& Desc,const std::string& ObjectName) : std::runtime_error(Desc),objectName(ObjectName) diff --git a/Code/Mantid/Kernel/src/Support.cpp b/Code/Mantid/Kernel/src/Support.cpp index bd7bf6c29a6..a8069f78faa 100644 --- a/Code/Mantid/Kernel/src/Support.cpp +++ b/Code/Mantid/Kernel/src/Support.cpp @@ -43,15 +43,14 @@ template DLLExport int writeFile(const std::string&,const std::vector<float>&,co /// \endcond TEMPLATE -void -printHex(std::ostream& OFS,const int n) - /*! - Function to convert and number into hex - output (and leave the stream un-changed) - \param OFS :: Output stream - \param n :: integer to convert - \todo Change this to a stream operator - */ +/*! + Function to convert a number into hex + output (and leave the stream un-changed) + \param OFS :: Output stream + \param n :: Integer to convert + \todo Change this to a stream operator +*/ +void printHex(std::ostream& OFS,const int n) { std::ios_base::fmtflags PrevFlags=OFS.flags(); OFS<<"Ox"; @@ -63,14 +62,12 @@ printHex(std::ostream& OFS,const int n) return; } - -std::string -stripMultSpc(const std::string& Line) - /*! - Removes the multiple spaces in the line - \param Line :: Line to process - \return String with single space components - */ +/*! + Removes the multiple spaces in the line + \param Line :: Line to process + \return String with single space components +*/ +std::string stripMultSpc(const std::string& Line) { std::string Out; int spc(1); @@ -96,18 +93,17 @@ stripMultSpc(const std::string& Line) return Out; } -int -extractWord(std::string& Line,const std::string& Word,const int cnt) - /*! - Checks that as least cnt letters of - works is part of the string. It is currently - case sensative. It removes the Word if found - \param Line :: Line to process - \param Word :: Word to use - \param cnt :: Length of Word for significants [default =4] - \retval 1 on success (and changed Line) - \retval 0 on failure - */ +/*! + Checks that as least cnt letters of + works is part of the string. It is currently + case sensative. It removes the Word if found + \param Line :: Line to process + \param Word :: Word to use + \param cnt :: Length of Word for significants [default =4] + \retval 1 on success (and changed Line) + \retval 0 on failure +*/ +int extractWord(std::string& Line,const std::string& Word,const int cnt) { if (Word.empty()) return 0; @@ -125,15 +121,14 @@ extractWord(std::string& Line,const std::string& Word,const int cnt) return 1; } -int -confirmStr(const std::string& S,const std::string& fullPhrase) - /*! - Check to see if S is the same as the - first part of a phrase. (case insensitive) - \param S :: string to check - \param fullPhrase :: complete phrase - \returns 1 on success - */ +/*! + Check to see if S is the same as the + first part of a phrase. (case insensitive) + \param S :: string to check + \param fullPhrase :: complete phrase + \returns 1 on success +*/ +int confirmStr(const std::string& S,const std::string& fullPhrase) { const int nS(S.length()); const int nC(fullPhrase.length()); @@ -145,19 +140,18 @@ confirmStr(const std::string& S,const std::string& fullPhrase) return 1; } -int -getPartLine(std::istream& fh,std::string& Out,std::string& Excess,const int spc) - /*! - Gets a line and determine if there is addition component to add - in the case of a very long line. - \param fh :: input stream to get line - \param Out :: string up to last 'tab' or ' ' - \param Excess :: string after 'tab or ' ' - \param spc :: number of char to try to read - \retval 1 :: more line to be found - \retval -1 :: Error with file - \retval 0 :: line finished. - */ +/*! + Gets a line and determine if there is addition component to add + in the case of a very long line. + \param fh :: input stream to get line + \param Out :: string up to last 'tab' or ' ' + \param Excess :: string after 'tab or ' ' + \param spc :: number of char to try to read + \retval 1 :: more line to be found + \retval -1 :: Error with file + \retval 0 :: line finished. +*/ +int getPartLine(std::istream& fh,std::string& Out,std::string& Excess,const int spc) { std::string Line; if (fh.good()) @@ -193,14 +187,13 @@ getPartLine(std::istream& fh,std::string& Out,std::string& Excess,const int spc) return -1; } -std::string -removeSpace(const std::string& CLine) - /*! - Removes all spaces from a string - except those with in the form '\ ' - \param CLine :: Line to strip - \return String without space - */ +/*! + Removes all spaces from a string + except those with in the form '\ ' + \param CLine :: Line to strip + \return String without space +*/ +std::string removeSpace(const std::string& CLine) { std::string Out; char prev='x'; @@ -215,17 +208,14 @@ removeSpace(const std::string& CLine) return Out; } - -std::string -getLine(std::istream& fh,const int spc) - /*! - Reads a line from the stream of max length spc. - Trailing comments are removed. (with # or ! character) - \param fh :: already open file handle - \param spc :: max number of characters to read - \return String read. - */ - +/*! + Reads a line from the stream of max length spc. + Trailing comments are removed. (with # or ! character) + \param fh :: already open file handle + \param spc :: max number of characters to read + \return String read. +*/ +std::string getLine(std::istream& fh,const int spc) { char* ss=new char[spc+1]; std::string Line; @@ -243,26 +233,24 @@ getLine(std::istream& fh,const int spc) return Line; } -int -isEmpty(const std::string& A) - /*! - Determines if a string is only spaces - \param A :: string to check - \returns 1 on an empty string , 0 on failure - */ +/*! + Determines if a string is only spaces + \param A :: string to check + \returns 1 on an empty string , 0 on failure +*/ +int isEmpty(const std::string& A) { std::string::size_type pos= A.find_first_not_of(" \t"); return (pos!=std::string::npos) ? 0 : 1; } -void -stripComment(std::string& A) - /*! - removes the string after the comment type of - '$ ' or '!' or '# ' - \param A :: String to process - */ +/*! + removes the string after the comment type of + '$ ' or '!' or '# ' + \param A :: String to process +*/ +void stripComment(std::string& A) { std::string::size_type posA=A.find("$ "); std::string::size_type posB=A.find("# "); @@ -276,14 +264,13 @@ stripComment(std::string& A) return; } -std::string -fullBlock(const std::string& A) - /*! - Returns the string from the first non-space to the - last non-space - \param A :: string to process - \returns shortened string - */ +/*! + Returns the string from the first non-space to the + last non-space + \param A :: string to process + \returns shortened string +*/ +std::string fullBlock(const std::string& A) { std::string::size_type posA=A.find_first_not_of(" "); std::string::size_type posB=A.find_last_not_of(" "); @@ -292,19 +279,18 @@ fullBlock(const std::string& A) return A.substr(posA,1+posB-posA); } +/*! + Takes a character string and evaluates + the first [typename T] object. The string is then + erase upt to the end of number. + The diffierence between this and section is that + it allows trailing characters after the number. + \param out :: place for output + \param A :: string to process + \returns 1 on success 0 on failure + */ template<typename T> -int -sectPartNum(std::string& A,T& out) - /*! - Takes a character string and evaluates - the first [typename T] object. The string is then - erase upt to the end of number. - The diffierence between this and section is that - it allows trailing characters after the number. - \param out :: place for output - \param A :: string to process - \returns 1 on success 0 on failure - */ +int sectPartNum(std::string& A,T& out) { if (A.empty()) return 0; @@ -322,17 +308,16 @@ sectPartNum(std::string& A,T& out) return 1; } +/*! + Takes a character string and evaluates + the first [typename T] object. The string is then filled with + spaces upto the end of the [typename T] object + \param out :: place for output + \param cA :: char array for input and output. + \returns 1 on success 0 on failure + */ template<typename T> -int -section(char* cA,T& out) - /*! - Takes a character string and evaluates - the first [typename T] object. The string is then filled with - spaces upto the end of the [typename T] object - \param out :: place for output - \param cA :: char array for input and output. - \returns 1 on success 0 on failure - */ +int section(char* cA,T& out) { if (!cA) return 0; std::string sA(cA); @@ -345,17 +330,16 @@ section(char* cA,T& out) return 0; } +/* + takes a character string and evaluates + the first <T> object. The string is then filled with + spaces upto the end of the <T> object + \param out :: place for output + \param A :: string for input and output. + \return 1 on success 0 on failure +*/ template<typename T> -int -section(std::string& A,T& out) - /* - takes a character string and evaluates - the first <T> object. The string is then filled with - spaces upto the end of the <T> object - \param out :: place for output - \param A :: string for input and output. - \return 1 on success 0 on failure - */ +int section(std::string& A,T& out) { if (A.empty()) return 0; std::istringstream cx; @@ -374,20 +358,19 @@ section(std::string& A,T& out) return 1; } +/* + Takes a character string and evaluates + the first [T] object. The string is then filled with + spaces upto the end of the [T] object. + This version deals with MCNPX numbers. Those + are numbers that are crushed together like + - 5.4938e+04-3.32923e-6 + \param out :: place for output + \param A :: string for input and output. + \return 1 on success 0 on failure +*/ template<typename T> -int -sectionMCNPX(std::string& A,T& out) - /* - Takes a character string and evaluates - the first [T] object. The string is then filled with - spaces upto the end of the [T] object. - This version deals with MCNPX numbers. Those - are numbers that are crushed together like - - 5.4938e+04-3.32923e-6 - \param out :: place for output - \param A :: string for input and output. - \return 1 on success 0 on failure - */ +int sectionMCNPX(std::string& A,T& out) { if (A.empty()) return 0; std::istringstream cx; @@ -409,15 +392,14 @@ sectionMCNPX(std::string& A,T& out) return 0; } -void -writeMCNPX(const std::string& Line,std::ostream& OX) - /*! - Write out the line in the limited form for MCNPX - ie initial line from 0->72 after that 8 to 72 - (split on a space or comma) - \param Line :: full MCNPX line - \param OX :: ostream to write to - */ +/*! + Write out the line in the limited form for MCNPX + ie initial line from 0->72 after that 8 to 72 + (split on a space or comma) + \param Line :: full MCNPX line + \param OX :: ostream to write to +*/ +void writeMCNPX(const std::string& Line,std::ostream& OX) { const int MaxLine(72); std::string::size_type pos(0); @@ -450,13 +432,12 @@ writeMCNPX(const std::string& Line,std::ostream& OX) return; } -std::vector<std::string> -StrParts(std::string Ln) - /*! - Splits the sting into parts that are space delminated. - \param Ln :: line component to strip - \returns vector of components - */ +/*! + Splits the sting into parts that are space delminated. + \param Ln :: line component to strip + \returns vector of components +*/ +std::vector<std::string> StrParts(std::string Ln) { std::vector<std::string> Out; std::string Part; @@ -465,20 +446,19 @@ StrParts(std::string Ln) return Out; } +/*! + Takes a character string and evaluates + the first [typename T] object. The string is then + erase upto the end of number. + The diffierence between this and convert is that + it allows trailing characters after the number. + \param out :: place for output + \param A :: string to process + \retval number of char read on success + \retval 0 on failure + */ template<typename T> -int -convPartNum(const std::string& A,T& out) - /*! - Takes a character string and evaluates - the first [typename T] object. The string is then - erase upto the end of number. - The diffierence between this and convert is that - it allows trailing characters after the number. - \param out :: place for output - \param A :: string to process - \retval number of char read on success - \retval 0 on failure - */ +int convPartNum(const std::string& A,T& out) { if (A.empty()) return 0; std::istringstream cx; @@ -493,15 +473,14 @@ convPartNum(const std::string& A,T& out) return xpt; } +/*! + Convert a string into a value + \param A :: string to pass + \param out :: value if found + \returns 0 on failure 1 on success +*/ template<typename T> -int -convert(const std::string& A,T& out) - /*! - Convert a string into a value - \param A :: string to pass - \param out :: value if found - \returns 0 on failure 1 on success - */ +int convert(const std::string& A,T& out) { if (A.empty()) return 0; std::istringstream cx; @@ -518,15 +497,14 @@ convert(const std::string& A,T& out) return 1; } +/*! + Convert a string into a value + \param A :: string to pass + \param out :: value if found + \returns 0 on failure 1 on success +*/ template<typename T> -int -convert(const char* A,T& out) - /*! - Convert a string into a value - \param A :: string to pass - \param out :: value if found - \returns 0 on failure 1 on success - */ +int convert(const char* A,T& out) { // No string, no conversion if (!A) return 0; @@ -534,16 +512,15 @@ convert(const char* A,T& out) return convert(Cx,out); } +/*! + Write out the three vectors into a file of type dc 9 + \param step :: parameter to control x-step (starts from zero) + \param Y :: Y column + \param Fname :: Name of the file + \returns 0 on success and -ve on failure +*/ template<template<typename T> class V,typename T> -int -writeFile(const std::string& Fname,const T step, const V<T>& Y) - /*! - Write out the three vectors into a file of type dc 9 - \param step :: parameter to control x-step (starts from zero) - \param Y :: Y column - \param Fname :: Name of the file - \returns 0 on success and -ve on failure - */ +int writeFile(const std::string& Fname,const T step, const V<T>& Y) { V<T> Ex; // Empty vector V<T> X; // Empty vector @@ -553,34 +530,30 @@ writeFile(const std::string& Fname,const T step, const V<T>& Y) return writeFile(Fname,X,Y,Ex); } +/*! + Write out the three vectors into a file of type dc 9 + \param X :: X column + \param Y :: Y column + \param Fname :: Name of the file + \returns 0 on success and -ve on failure +*/ template<template<typename T> class V,typename T> -int -writeFile(const std::string& Fname,const V<T>& X, - const V<T>& Y) - /*! - Write out the three vectors into a file of type dc 9 - \param X :: X column - \param Y :: Y column - \param Fname :: Name of the file - \returns 0 on success and -ve on failure - */ +int writeFile(const std::string& Fname,const V<T>& X,const V<T>& Y) { V<T> Ex; // Empty vector/list return writeFile(Fname,X,Y,Ex); // don't need to specific ?? } +/*! + Write out the three container into a file of type dc 9 + \param X :: X column + \param Y :: Y column + \param Err :: Err column + \param Fname :: Name of the file + \returns 0 on success and -ve on failure +*/ template<template<typename T> class V,typename T> -int -writeFile(const std::string& Fname,const V<T>& X, - const V<T>& Y,const V<T>& Err) - /*! - Write out the three container into a file of type dc 9 - \param X :: X column - \param Y :: Y column - \param Err :: Err column - \param Fname :: Name of the file - \returns 0 on success and -ve on failure - */ +int writeFile(const std::string& Fname,const V<T>& X,const V<T>& Y,const V<T>& Err) { const int Npts(X.size()>Y.size() ? Y.size() : X.size()); const int Epts(Npts>static_cast<int>(Err.size()) ? Err.size() : Npts); @@ -617,13 +590,12 @@ writeFile(const std::string& Fname,const V<T>& X, return 0; } -float -getVAXnum(const float A) - /*! - Converts a vax number into a standard unix number - \param A :: float number as read from a VAX file - \returns float A in IEEE little eindian format - */ +/*! + Converts a vax number into a standard unix number + \param A :: float number as read from a VAX file + \returns float A in IEEE little eindian format +*/ +float getVAXnum(const float A) { union { @@ -651,20 +623,18 @@ getVAXnum(const float A) return (float) onum; } +/*! + Call to read in various values in position x1,x2,x3 from the + line. Note to avoid the dependency on crossSort this needs + to be call IN ORDER + \param Line :: string to read + \param Index :: Indexes to read + \param Out :: OutValues [unchanged if not read] + \retval 0 :: success + \retval -ve on failure. +*/ template<typename T> -int -setValues(const std::string& Line,const std::vector<int>& Index, - std::vector<T>& Out) - /*! - Call to read in various values in position x1,x2,x3 from the - line. Note to avoid the dependency on crossSort this needs - to be call IN ORDER - \param Line :: string to read - \param Index :: Indexes to read - \param Out :: OutValues [unchanged if not read] - \retval 0 :: success - \retval -ve on failure. - */ +int setValues(const std::string& Line,const std::vector<int>& Index,std::vector<T>& Out) { if (Index.empty()) return 0; -- GitLab