Elements  5.8
A C++ base framework for the Euclid Software.
DataSyncUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef ELEMENTSSERVICES_ELEMENTSSERVICES_DATASYNC_DATASYNCUTILS_H_
20 #define ELEMENTSSERVICES_ELEMENTSSERVICES_DATASYNC_DATASYNCUTILS_H_
21 
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
26 #include <boost/filesystem.hpp>
27 
28 #include "ElementsKernel/Export.h"
29 
30 namespace ElementsServices {
31 namespace DataSync {
32 
34 
36 
37 ELEMENTS_API bool checkCall(std::string command);
38 
40  std::string command);
41 
42 ELEMENTS_API bool localDirExists(path localDir);
43 
44 ELEMENTS_API void createLocalDirOf(path localFile);
45 
51 
53 
55 
56 template<typename T>
57 ELEMENTS_API bool valueIsListed(const T& value, const std::vector<T>& list) {
58  const auto& begin = list.begin();
59  const auto& end = list.end();
60  return std::find(begin, end, value) != end;
61 }
62 
64  std::string input,
65  std::vector<std::string> substrings);
66 
67 } // namespace DataSync
68 } // namespace ElementsServices
69 
70 #endif // ELEMENTSSERVICES_ELEMENTSSERVICES_DATASYNC_DATASYNCUTILS_H_
Export.h
defines the macros to be used for explicit export of the symbols
ElementsServices::DataSync::containsInThisOrder
ELEMENTS_API bool containsInThisOrder(std::string input, std::vector< std::string > substrings)
Definition: DataSyncUtils.cpp:90
std::string
STL class.
ElementsServices::DataSync::environmentVariable
ELEMENTS_API std::string environmentVariable(std::string name)
Get the value of an environment variable.
Definition: DataSyncUtils.cpp:74
ElementsServices::DataSync::confFilePath
ELEMENTS_API path confFilePath(path filename)
Definition: DataSyncUtils.cpp:36
std::pair
std::vector
STL class.
std::find
T find(T... args)
ElementsServices::DataSync::path
boost::filesystem::path path
Definition: DataSyncUtils.h:33
ElementsServices::DataSync::lower
ELEMENTS_API std::string lower(std::string text)
Definition: DataSyncUtils.cpp:84
ElementsServices::DataSync::valueIsListed
ELEMENTS_API bool valueIsListed(const T &value, const std::vector< T > &list)
Definition: DataSyncUtils.h:57
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
ElementsServices
Definition: ConnectionConfiguration.h:28
ElementsServices::DataSync::createLocalDirOf
ELEMENTS_API void createLocalDirOf(path localFile)
Definition: DataSyncUtils.cpp:64
ElementsServices::DataSync::runCommandAndCaptureOutErr
ELEMENTS_API std::pair< std::string, std::string > runCommandAndCaptureOutErr(std::string command)
Definition: DataSyncUtils.cpp:45
std::vector::begin
T begin(T... args)
ElementsServices::DataSync::checkCall
ELEMENTS_API bool checkCall(std::string command)
Definition: DataSyncUtils.cpp:40
ElementsServices::DataSync::localDirExists
ELEMENTS_API bool localDirExists(path localDir)
Definition: DataSyncUtils.cpp:60
ElementsServices::DataSync::localWorkspacePrefix
ELEMENTS_API path localWorkspacePrefix()
Definition: DataSyncUtils.cpp:78
std::vector::end
T end(T... args)