itom  4.1.0
helperCommon.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut fuer Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef HELPERCOMMON_H
29 #define HELPERCOMMON_H
30 
31 #include "typeDefs.h"
32 #include "sharedStructures.h"
33 
34 #include <qstring.h>
35 #include <qvector.h>
36 #include <qobject.h>
37 #include <qhash.h>
38 
39 #if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
40 
41 namespace ito
42 {
43  ito::RetVal ITOMCOMMONQT_EXPORT checkParamVector(QVector<ito::Param> *params);
44  ito::RetVal ITOMCOMMONQT_EXPORT checkParamVectors(QVector<ito::Param> *paramsMand, QVector<ito::Param> *paramsOpt, QVector<ito::Param> *paramsOut);
45 
46  ITOMCOMMONQT_EXPORT ito::Param* getParamByName(QVector<ito::Param> *paramVec, const char* name, ito::RetVal *retval = NULL);
47  ITOMCOMMONQT_EXPORT ito::ParamBase* getParamByName(QVector<ito::ParamBase> *paramVec, const char* name, ito::RetVal *retval = NULL);
48  ITOMCOMMONQT_EXPORT QHash<QString, ito::Param*> createParamHashTable(QVector<ito::Param> *paramVec);
49 
50  bool ITOMCOMMONQT_EXPORT checkNumericParamRange(const ito::Param &param, double &value, bool *ok = NULL);
51 
52  ito::RetVal ITOMCOMMONQT_EXPORT parseParamName(const QString &name, QString &paramName, bool &hasIndex, int &index, QString &additionalTag);
53 
54  ito::RetVal ITOMCOMMONQT_EXPORT getParamValue(const QMap<QString, Param> *m_params, const QString &key, ito::Param &value, QString &pkey, int &index);
55  ito::RetVal ITOMCOMMONQT_EXPORT setParamValue(const QMap<QString, Param> *m_params, const QString &key, const ito::ParamBase &value, QString &pkey, int &index);
56 }; // end namespace ito
57 
58 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
59 
60 #endif
ito::RetVal ITOMCOMMONQT_EXPORT checkParamVectors(QVector< ito::Param > *paramsMand, QVector< ito::Param > *paramsOpt, QVector< ito::Param > *paramsOut)
verifies that the three param vectors are not NULL
Definition: helperCommon.cpp:64
Class for managing status values (like errors or warning)
Definition: retVal.h:54
class for parameter handling e.g. to pass paramters to plugins
Definition: param.h:283
Definition: apiFunctionsGraph.cpp:39
ito::RetVal ITOMCOMMONQT_EXPORT checkParamVector(QVector< ito::Param > *params)
checks param vector
Definition: helperCommon.cpp:43
ITOMCOMMONQT_EXPORT ito::Param * getParamByName(QVector< ito::Param > *paramVec, const char *name, ito::RetVal *retval=NULL)
brief returns a parameter from the parameter-vector, that fits to a specific name ...
Definition: helperCommon.cpp:90
Definition: param.h:67
ito::RetVal ITOMCOMMONQT_EXPORT parseParamName(const QString &name, QString &paramName, bool &hasIndex, int &index, QString &additionalTag)
parses parameter name with respect to regular expression, assigned for parameter-communcation with pl...
Definition: helperCommon.cpp:413