-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/10271_tcmalloc_ldpreload
Conflicts: Code/Mantid/Framework/Kernel/CMakeLists.txt Refs #10271
- Loading branch information
Showing
67 changed files
with
2,753 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# - Find jsoncpp include dirs and libraries | ||
# Use this module by invoking find_package with the form: | ||
# find_package(JsonCPP [required] [quiet] ) | ||
# | ||
# The module sets the following variables | ||
# JSONCPP_FOUND - True if headers and libraries were found | ||
# JSONCPP_INCLUDE_DIR - jsoncpp include directories | ||
# JSONCPP_LIBRARY - library files for linking (optimised version) | ||
# JSONCPP_LIBRARY_DEBUG - library files for linking (debug version) | ||
# JSONCPP_LIBRARIES - All required libraries, including the configuration type | ||
|
||
# Headers | ||
find_path ( JSONCPP_INCLUDE_DIR jsoncpp/json/json.h ) | ||
|
||
# Libraries | ||
find_library ( JSONCPP_LIBRARY NAMES jsoncpp ) # optimized | ||
find_library ( JSONCPP_LIBRARY_DEBUG NAMES jsoncpp_d ) # debug | ||
|
||
if ( JSONCPP_LIBRARY AND JSONCPP_LIBRARY_DEBUG ) | ||
set ( JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARY} debug ${JSONCPP_LIBRARY_DEBUG} ) | ||
else() | ||
set ( JSONCPP_LIBRARIES ${JSONCPP_LIBRARY} ) | ||
endif() | ||
|
||
# Handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
include ( FindPackageHandleStandardArgs ) | ||
find_package_handle_standard_args( JsonCPP DEFAULT_MSG JSONCPP_INCLUDE_DIR JSONCPP_LIBRARIES ) | ||
|
||
# Advanced variables | ||
mark_as_advanced ( JSONCPP_INCLUDE_DIR JSONCPP_LIBRARIES ) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/DownloadFile.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#ifndef MANTID_DATAHANDLING_DOWNLOADFILE_H_ | ||
#define MANTID_DATAHANDLING_DOWNLOADFILE_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
|
||
namespace Mantid | ||
{ | ||
|
||
namespace Kernel | ||
{ | ||
//forward Declaration | ||
class InternetHelper; | ||
} | ||
|
||
namespace DataHandling | ||
{ | ||
|
||
/** DownloadFile : Downloads a file from a url to the file system | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
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://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport DownloadFile : public API::Algorithm | ||
{ | ||
public: | ||
DownloadFile(); | ||
virtual ~DownloadFile(); | ||
|
||
virtual const std::string name() const; | ||
virtual int version() const; | ||
virtual const std::string category() const; | ||
virtual const std::string summary() const; | ||
|
||
protected: | ||
Kernel::InternetHelper* m_internetHelper; | ||
|
||
private: | ||
void init(); | ||
void exec(); | ||
|
||
|
||
|
||
}; | ||
|
||
|
||
} // namespace DataHandling | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_DATAHANDLING_DOWNLOADFILE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#include "MantidDataHandling/DownloadFile.h" | ||
#include "MantidKernel/InternetHelper.h" | ||
#include "MantidKernel/ListValidator.h" | ||
#include "MantidKernel/MandatoryValidator.h" | ||
#include "MantidAPI/FileProperty.h" | ||
|
||
#include "Poco/URI.h" | ||
|
||
#include "boost/make_shared.hpp" | ||
#include "boost/algorithm/string/predicate.hpp" | ||
|
||
#include <string> | ||
#include <stdexcept> | ||
|
||
namespace Mantid | ||
{ | ||
namespace DataHandling | ||
{ | ||
|
||
using Mantid::Kernel::Direction; | ||
using Mantid::Kernel::MandatoryValidator; | ||
using Mantid::Kernel::StringListValidator; | ||
using Mantid::API::WorkspaceProperty; | ||
using Mantid::API::FileProperty; | ||
|
||
// Register the algorithm into the AlgorithmFactory | ||
DECLARE_ALGORITHM(DownloadFile) | ||
|
||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
DownloadFile::DownloadFile():m_internetHelper(new Kernel::InternetHelper()) | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
DownloadFile::~DownloadFile() | ||
{ | ||
delete m_internetHelper; | ||
} | ||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
|
||
/// Algorithms name for identification. @see Algorithm::name | ||
const std::string DownloadFile::name() const { return "DownloadFile"; } | ||
|
||
/// Algorithm's version for identification. @see Algorithm::version | ||
int DownloadFile::version() const { return 1;} | ||
|
||
/// Algorithm's category for identification. @see Algorithm::category | ||
const std::string DownloadFile::category() const { return "DataHandling";} | ||
|
||
/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary | ||
const std::string DownloadFile::summary() const { return "Downloads a file from a url to the file system";} | ||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Initialize the algorithm's properties. | ||
*/ | ||
void DownloadFile::init() | ||
{ | ||
declareProperty("Address", "", boost::make_shared<MandatoryValidator<std::string> >(), | ||
"The address of the network resource to download. This should start http:// or https:// .", Direction::InOut); | ||
declareProperty(new FileProperty("Filename", "", FileProperty::Save), | ||
"The filename to save the download to."); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Execute the algorithm. | ||
*/ | ||
void DownloadFile::exec() | ||
{ | ||
std::string address = getProperty("Address"); | ||
if ((!boost::starts_with(address,"http://")) && (!boost::starts_with(address,"https://"))) | ||
{ | ||
address = "http://" + address; | ||
g_log.information("Address must start http:// or https://, http has been assumed to continue: " + address); | ||
} | ||
std::string filename = getProperty("Filename"); | ||
|
||
Poco::URI url(address); | ||
m_internetHelper->downloadFile(url.toString(),filename); | ||
setProperty("Address",address); | ||
} | ||
|
||
|
||
} // namespace DataHandling | ||
} // namespace Mantid |
Oops, something went wrong.