From 8de6e027fa6abbb64d236b875c803f477079c095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Br=C3=A9mond?= Date: Wed, 22 Aug 2018 08:59:50 -0700 Subject: [PATCH 1/4] [feature] Improve JupyterLab environment start --- tools/python/start.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/python/start.sh b/tools/python/start.sh index bdf2e101..454ef521 100755 --- a/tools/python/start.sh +++ b/tools/python/start.sh @@ -23,12 +23,13 @@ if [[ ! -z $1 ]] && [[ $1 == "--link" ]]; then --rm \ --publish="8886:8888" \ --user="" \ - --env="JUPYTER_LAB_ENABLE=yes" \ + --env="JUPYTER_ENABLE_LAB=yes" \ --env="LD_LIBRARY_PATH=/usr/local/lib:/opt/conda/lib/python3.6/site-packages:/home/jovyan/lib" \ --env="PYTHONPATH=/opt/conda/lib/python3.6/site-packages:/home/jovyan/lib" \ --volume=$(pwd)/../../../library-physics/lib:/opt/library-physics:ro \ --volume=$(pwd)/../../lib:/opt/lib:ro \ --volume=$(pwd)/../../share/python/notebooks:/home/jovyan/notebooks \ + --workdir="/home/jovyan/notebooks" \ "${repository_name}/${project_name}-python" \ bash -c "mkdir -p /opt/conda/lib/python3.6/site-packages/Library/Core \ && ln -s /opt/lib/liblibrary-core.so.0 /opt/conda/lib/python3.6/site-packages/Library/Core/liblibrary-core.so.0 \ @@ -46,10 +47,11 @@ else --rm \ --publish="8886:8888" \ --user="" \ - --env="JUPYTER_LAB_ENABLE=yes" \ + --env="JUPYTER_ENABLE_LAB=yes" \ --env="LD_LIBRARY_PATH=/usr/local/lib:/opt/conda/lib/python3.6/site-packages:/home/jovyan/lib" \ --env="PYTHONPATH=/opt/conda/lib/python3.6/site-packages:/home/jovyan/lib" \ --volume=$(pwd)/../../share/python/notebooks:/home/jovyan/notebooks \ + --workdir="/home/jovyan/notebooks" \ "${repository_name}/${project_name}-python" \ bash -c "start-notebook.sh --NotebookApp.token=''" From a9a8a184d0d5514f9e1318eefab791f2a104e8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Br=C3=A9mond?= Date: Wed, 22 Aug 2018 17:58:01 -0700 Subject: [PATCH 2/4] [misc] Fix typo --- tools/python/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/start.sh b/tools/python/start.sh index 454ef521..7f1eed1a 100755 --- a/tools/python/start.sh +++ b/tools/python/start.sh @@ -57,6 +57,6 @@ else fi -popd +popd > /dev/null ################################################################################################################################################################ \ No newline at end of file From 44b9162729433ed61f5ca1f98c62193a518ee392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Br=C3=A9mond?= Date: Thu, 23 Aug 2018 17:24:17 -0700 Subject: [PATCH 3/4] [feature] Add move semantics to Array --- include/Library/Core/Containers/Array.hpp | 32 +++++++++++++++++++ .../Library/Core/Containers/Dictionary.hpp | 2 +- include/Library/Core/Containers/Object.hpp | 2 +- include/Library/Core/FileSystem/Directory.hpp | 2 +- include/Library/Core/FileSystem/File.hpp | 2 +- include/Library/Core/FileSystem/Path.hpp | 2 +- include/Library/Core/Types/Integer.hpp | 2 +- src/Library/Core/Containers/Array.tpp | 9 +++++- 8 files changed, 46 insertions(+), 7 deletions(-) diff --git a/include/Library/Core/Containers/Array.hpp b/include/Library/Core/Containers/Array.hpp index 0c2757ef..5fab7c39 100755 --- a/include/Library/Core/Containers/Array.hpp +++ b/include/Library/Core/Containers/Array.hpp @@ -93,6 +93,38 @@ class Array : public std::vector Array ( std::initializer_list aList ) ; + /// @brief Copy constructor + /// + /// @param [in] anArray An array + + Array ( const Array& anArray ) = default ; + + /// @brief Move constructor (array) + /// + /// @param [in] anArray An array + + Array ( Array&& anArray ) = default ; + + /// @brief Move constructor (vector) + /// + /// @param [in] aVector A vector + + Array ( std::vector&& aVector ) ; + + /// @brief Copy assignment operator + /// + /// @param [in] anArray An array + /// @return Reference to array + + Array& operator = ( const Array& anArray ) = default ; + + /// @brief Move assignment operator + /// + /// @param [in] anArray An array + /// @return Reference to array + + Array& operator = ( Array&& anArray ) = default ; + /// @brief Concatenate array /// /// @code diff --git a/include/Library/Core/Containers/Dictionary.hpp b/include/Library/Core/Containers/Dictionary.hpp index a177c0d4..57bf28d5 100755 --- a/include/Library/Core/Containers/Dictionary.hpp +++ b/include/Library/Core/Containers/Dictionary.hpp @@ -160,7 +160,7 @@ class Dictionary ~Dictionary ( ) ; - /// @brief Assignment operator + /// @brief Copy assignment operator /// /// @param [in] aDictionary A dictionary /// @return Reference to dictionary diff --git a/include/Library/Core/Containers/Object.hpp b/include/Library/Core/Containers/Object.hpp index f1ea0a41..0de5d0d5 100755 --- a/include/Library/Core/Containers/Object.hpp +++ b/include/Library/Core/Containers/Object.hpp @@ -96,7 +96,7 @@ class Object ~Object ( ) ; - /// @brief Assignment operator + /// @brief Copy assignment operator /// /// @param [in] anObject An object /// @return Reference to object diff --git a/include/Library/Core/FileSystem/Directory.hpp b/include/Library/Core/FileSystem/Directory.hpp index 44262ac8..f000544a 100755 --- a/include/Library/Core/FileSystem/Directory.hpp +++ b/include/Library/Core/FileSystem/Directory.hpp @@ -50,7 +50,7 @@ class Directory Directory ( const Directory& aDirectory ) ; - /// @brief Assignment operator + /// @brief Copy assignment operator /// /// @param [in] aDirectory A directory /// @return Directory diff --git a/include/Library/Core/FileSystem/File.hpp b/include/Library/Core/FileSystem/File.hpp index 08ffaa04..3673ea5e 100755 --- a/include/Library/Core/FileSystem/File.hpp +++ b/include/Library/Core/FileSystem/File.hpp @@ -44,7 +44,7 @@ class File File ( const File& aFile ) ; - /// @brief Assignment operator + /// @brief Copy assignment operator /// /// @param [in] aFile A file /// @return File diff --git a/include/Library/Core/FileSystem/Path.hpp b/include/Library/Core/FileSystem/Path.hpp index ffb217a5..950e8120 100755 --- a/include/Library/Core/FileSystem/Path.hpp +++ b/include/Library/Core/FileSystem/Path.hpp @@ -48,7 +48,7 @@ class Path ~Path ( ) ; - /// @brief Assignment operator + /// @brief Copy assignment operator /// /// @param [in] aPath A path /// @return Path diff --git a/include/Library/Core/Types/Integer.hpp b/include/Library/Core/Types/Integer.hpp index 4d516e2b..f0a4a5ac 100755 --- a/include/Library/Core/Types/Integer.hpp +++ b/include/Library/Core/Types/Integer.hpp @@ -75,7 +75,7 @@ class Integer Integer ( double ) = delete ; - /// @brief Assignment operator + /// @brief Copy assignment operator /// /// @param [in] anInteger An integer /// @return Reference to integer diff --git a/src/Library/Core/Containers/Array.tpp b/src/Library/Core/Containers/Array.tpp index b02da34e..002d5257 100644 --- a/src/Library/Core/Containers/Array.tpp +++ b/src/Library/Core/Containers/Array.tpp @@ -43,6 +43,13 @@ namespace ctnr : std::vector(aList) { +} + + template + Array::Array ( std::vector&& aVector ) + : std::vector(std::move(aVector)) +{ + } template @@ -318,7 +325,7 @@ typename Array::Iterator Array::find ( template Array Array::Empty ( ) { - return Array(std::vector()) ; + return std::move(std::vector()) ; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// From 0126ea64e7b584275a3bbcef3f312c88075e0039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Br=C3=A9mond?= Date: Thu, 23 Aug 2018 17:31:42 -0700 Subject: [PATCH 4/4] [misc] Typo --- include/Library/Core/Logger/Pump.hpp | 4 +-- include/Library/Core/Utilities/Print.hpp | 2 +- src/Library/Core/Containers/Dictionary.cpp | 20 ++++++------ src/Library/Core/Containers/Object.cpp | 2 +- src/Library/Core/Types/Integer.cpp | 36 +++++++++++----------- src/Library/Core/Types/Real.cpp | 24 +++++++-------- src/Library/Core/Types/String.cpp | 2 +- 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/include/Library/Core/Logger/Pump.hpp b/include/Library/Core/Logger/Pump.hpp index 18bf330e..4d8caad1 100755 --- a/include/Library/Core/Logger/Pump.hpp +++ b/include/Library/Core/Logger/Pump.hpp @@ -66,7 +66,7 @@ class Pump this->accessStream() << anObject ; } - return (*this) ; + return *this ; } @@ -78,7 +78,7 @@ class Pump this->accessStream() << aStreamManipulator ; } - return (*this) ; + return *this ; } diff --git a/include/Library/Core/Utilities/Print.hpp b/include/Library/Core/Utilities/Print.hpp index 729b19ab..031d92f6 100755 --- a/include/Library/Core/Utilities/Print.hpp +++ b/include/Library/Core/Utilities/Print.hpp @@ -51,7 +51,7 @@ class Print stream_ << std::setw(40) << std::setfill(' ') << anObject << " " ; - return (*this) ; + return *this ; } diff --git a/src/Library/Core/Containers/Dictionary.cpp b/src/Library/Core/Containers/Dictionary.cpp index 0f079ea8..bfe2dbc1 100644 --- a/src/Library/Core/Containers/Dictionary.cpp +++ b/src/Library/Core/Containers/Dictionary.cpp @@ -46,7 +46,7 @@ Dictionary::Iterator& Dictionary::Iterator::operator = ( mapIt_ = anIterator.mapIt_ ; } - return (*this) ; + return *this ; } @@ -62,7 +62,7 @@ bool Dictionary::Iterator::operator != ( const Dictionary::Iterator& Dictionary::Iterator::operator * ( ) const { - return (*this) ; + return *this ; } const Dictionary::Iterator* Dictionary::Iterator::operator -> ( ) const @@ -72,7 +72,7 @@ const Dictionary::Iterator* Dictionary::Iterator::operator -> ( ) Dictionary::Iterator& Dictionary::Iterator::operator * ( ) { - return (*this) ; + return *this ; } Dictionary::Iterator* Dictionary::Iterator::operator -> ( ) @@ -90,7 +90,7 @@ Dictionary::Iterator& Dictionary::Iterator::operator ++ ( ) ++mapIt_ ; - return (*this) ; + return *this ; } @@ -104,7 +104,7 @@ Dictionary::Iterator& Dictionary::Iterator::operator -- ( ) --mapIt_ ; - return (*this) ; + return *this ; } @@ -171,7 +171,7 @@ Dictionary::ConstIterator& Dictionary::ConstIterator::operator = ( mapIt_ = aConstIterator.mapIt_ ; } - return (*this) ; + return *this ; } @@ -187,7 +187,7 @@ bool Dictionary::ConstIterator::operator != ( const Dictionary::ConstIterator& Dictionary::ConstIterator::operator * ( ) const { - return (*this) ; + return *this ; } const Dictionary::ConstIterator* Dictionary::ConstIterator::operator -> ( ) const @@ -205,7 +205,7 @@ Dictionary::ConstIterator& Dictionary::ConstIterator::operator ++ ( ) ++mapIt_ ; - return (*this) ; + return *this ; } @@ -219,7 +219,7 @@ Dictionary::ConstIterator& Dictionary::ConstIterator::operator -- ( ) --mapIt_ ; - return (*this) ; + return *this ; } @@ -270,7 +270,7 @@ Dictionary& Dictionary::operator = ( map_ = aDictionary.map_ ; } - return (*this) ; + return *this ; } diff --git a/src/Library/Core/Containers/Object.cpp b/src/Library/Core/Containers/Object.cpp index fd5cf737..c5cf19b7 100644 --- a/src/Library/Core/Containers/Object.cpp +++ b/src/Library/Core/Containers/Object.cpp @@ -372,7 +372,7 @@ Object& Object::operator = ( objectImplUPtr_.reset((anObject.objectImplUPtr_ != nullptr) ? anObject.objectImplUPtr_->clone() : nullptr) ; } - return (*this) ; + return *this ; } diff --git a/src/Library/Core/Types/Integer.cpp b/src/Library/Core/Types/Integer.cpp index 0473989b..1acf652a 100644 --- a/src/Library/Core/Types/Integer.cpp +++ b/src/Library/Core/Types/Integer.cpp @@ -39,7 +39,7 @@ Integer& Integer::operator = ( type_ = Integer::Type::Defined ; value_ = anInteger ; - return (*this) ; + return *this ; } @@ -122,7 +122,7 @@ Integer Integer::operator + ( if (type_ != Integer::Type::Defined) { - return (*this) ; + return *this ; } else if (anInteger.type_ != Integer::Type::Defined) { @@ -170,7 +170,7 @@ Integer Integer::operator - ( if (type_ != Integer::Type::Defined) { - return (*this) ; + return *this ; } else if (anInteger.type_ != Integer::Type::Defined) { @@ -413,11 +413,11 @@ Integer Integer::operator % ( } else if (!this->isInfinity() && anInteger.isInfinity()) { - return (*this) ; + return *this ; } else if ((!this->isInfinity()) && this->isStrictlyPositive() && (!anInteger.isInfinity()) && (anInteger.value_ == std::numeric_limits::min())) { - return (*this) ; + return *this ; } else if ((!anInteger.isInfinity()) && (std::abs(anInteger.value_) == 1)) { @@ -468,7 +468,7 @@ Integer& Integer::operator += ( (*this) = (*this) + anInteger ; - return (*this) ; + return *this ; } @@ -477,7 +477,7 @@ Integer& Integer::operator -= ( (*this) = (*this) - anInteger ; - return (*this) ; + return *this ; } @@ -486,7 +486,7 @@ Integer& Integer::operator *= ( (*this) = (*this) * anInteger ; - return (*this) ; + return *this ; } @@ -495,7 +495,7 @@ Integer& Integer::operator /= ( (*this) = (*this) / anInteger ; - return (*this) ; + return *this ; } @@ -504,7 +504,7 @@ Integer& Integer::operator %= ( (*this) = (*this) % anInteger ; - return (*this) ; + return *this ; } @@ -513,7 +513,7 @@ Integer& Integer::operator += ( (*this) = (*this) + Integer(anInteger) ; - return (*this) ; + return *this ; } @@ -522,7 +522,7 @@ Integer& Integer::operator -= ( (*this) = (*this) - Integer(anInteger) ; - return (*this) ; + return *this ; } @@ -531,7 +531,7 @@ Integer& Integer::operator *= ( (*this) = (*this) * Integer(anInteger) ; - return (*this) ; + return *this ; } @@ -540,7 +540,7 @@ Integer& Integer::operator /= ( (*this) = (*this) / Integer(anInteger) ; - return (*this) ; + return *this ; } @@ -549,7 +549,7 @@ Integer& Integer::operator %= ( (*this) = (*this) % Integer(anInteger) ; - return (*this) ; + return *this ; } @@ -585,7 +585,7 @@ Integer operator % ( Integer Integer::operator + ( ) const { - return (*this) ; + return *this ; } Integer Integer::operator - ( ) const @@ -654,7 +654,7 @@ Integer& Integer::operator ++ ( ) } - return (*this) ; + return *this ; } @@ -688,7 +688,7 @@ Integer& Integer::operator -- ( ) } - return (*this) ; + return *this ; } diff --git a/src/Library/Core/Types/Real.cpp b/src/Library/Core/Types/Real.cpp index f0afcf08..94131af5 100644 --- a/src/Library/Core/Types/Real.cpp +++ b/src/Library/Core/Types/Real.cpp @@ -40,7 +40,7 @@ Real& Real::operator = ( type_ = Real::Type::Defined ; value_ = aReal ; - return (*this) ; + return *this ; } @@ -123,7 +123,7 @@ Real Real::operator + ( if (type_ != Real::Type::Defined) { - return (*this) ; + return *this ; } else if (aReal.type_ != Real::Type::Defined) { @@ -171,7 +171,7 @@ Real Real::operator - ( if (type_ != Real::Type::Defined) { - return (*this) ; + return *this ; } else if (aReal.type_ != Real::Type::Defined) { @@ -422,7 +422,7 @@ Real& Real::operator += ( (*this) = (*this) + aReal ; - return (*this) ; + return *this ; } @@ -431,7 +431,7 @@ Real& Real::operator -= ( (*this) = (*this) - aReal ; - return (*this) ; + return *this ; } @@ -440,7 +440,7 @@ Real& Real::operator *= ( (*this) = (*this) * aReal ; - return (*this) ; + return *this ; } @@ -449,7 +449,7 @@ Real& Real::operator /= ( (*this) = (*this) / aReal ; - return (*this) ; + return *this ; } @@ -458,7 +458,7 @@ Real& Real::operator += ( (*this) = (*this) + Real(aReal) ; - return (*this) ; + return *this ; } @@ -467,7 +467,7 @@ Real& Real::operator -= ( (*this) = (*this) - Real(aReal) ; - return (*this) ; + return *this ; } @@ -476,7 +476,7 @@ Real& Real::operator *= ( (*this) = (*this) * Real(aReal) ; - return (*this) ; + return *this ; } @@ -485,7 +485,7 @@ Real& Real::operator /= ( (*this) = (*this) / Real(aReal) ; - return (*this) ; + return *this ; } @@ -515,7 +515,7 @@ Real operator / ( Real Real::operator + ( ) const { - return (*this) ; + return *this ; } Real Real::operator - ( ) const diff --git a/src/Library/Core/Types/String.cpp b/src/Library/Core/Types/String.cpp index 8ad7d1c9..4021b32f 100755 --- a/src/Library/Core/Types/String.cpp +++ b/src/Library/Core/Types/String.cpp @@ -156,7 +156,7 @@ String& String::trim ( ) boost::trim(*this) ; } - return (*this) ; + return *this ; }