nidas v1.2.3
util.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2006, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
35#ifndef NIDAS_UTIL_UTIL_H
36#define NIDAS_UTIL_UTIL_H
37
38#include <string>
39
40#include "IOException.h"
41
42namespace nidas { namespace util {
43
50std::string replaceBackslashSequences(const std::string& str);
51
52/* note that the above back slashes above are doubled so that
53 * doxygen displays them as one back slash. One does
54 * not double them in the parameter string.
55 */
56
61std::string addBackslashSequences(const std::string& str);
62
66void trimString(std::string& str);
67
71void replaceCharsIn(std::string& in,const std::string& pat, const std::string& rep);
72
73std::string replaceChars(const std::string& in,const std::string& pat, const std::string& rep);
74
81std::string svnStatus(const std::string& path);
82
87float dirFromUV(float u, float v);
88
98void
99derive_uv_from_spd_dir(float& u, float& v, float& spd, float& dir);
100
108void
109derive_spd_dir_from_uv(float& spd, float& dir, float& u, float& v);
110
111}} // namespace nidas::util
112
113#endif
void derive_uv_from_spd_dir(float &u, float &v, float &spd, float &dir)
Normalize dir, then derive u and v from spd and direction.
Definition util.cc:233
std::string addBackslashSequences(const std::string &str)
Utility function for substituting backslash sequences back into a string.
Definition util.cc:106
std::string svnStatus(const std::string &path)
Run "svn status -v --depth empty" on a path and return a concatentated string of revision + flags,...
Definition util.cc:172
void replaceCharsIn(std::string &in, const std::string &pat, const std::string &rep)
Replace all occurences of pat in string in with rep.
Definition util.cc:158
void derive_spd_dir_from_uv(float &spd, float &dir, float &u, float &v)
Derive speed and direction from wind components u, v.
Definition util.cc:251
std::string replaceChars(const std::string &in, const std::string &pat, const std::string &rep)
Definition util.cc:165
std::string replaceBackslashSequences(const std::string &str)
Utility function for replacing backslash sequences in a string.
Definition util.cc:40
float dirFromUV(float u, float v)
Calculate wind direction in degrees from U and V wind components, or if U and V are both zero return ...
Definition util.cc:222
void trimString(std::string &str)
Utility to remove white space characters (matching isspace()) from end of string.
Definition util.cc:149
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31