actual min-maxes per axis

actual min-maxes per axis

git-svn-id: 5819f25216ce36c8424e05b91e02bc3535ed28bf@82 7a0b5368-9e9f-4da2-a48c-2b820cea8ffb

--- src/NGParallelCoordinatesRenderer2D.cpp
+++ src/NGParallelCoordinatesRenderer2D.cpp
@@ -734,8 +734,14 @@
             this->font.DrawString(x, this->marginY * 0.5f                   , fontsize, true, std::to_string(minimums[realCol]).c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
             this->font.DrawString(x, this->marginY * 1.5f + this->axisHeight, fontsize, true, std::to_string(maximums[realCol]).c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
 #else
-            this->font.DrawString(x, this->marginY * 0.5f, fontsize, true, std::to_string(filters[realCol].lower).c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
-            this->font.DrawString(x, this->marginY * 1.5f + this->axisHeight, fontsize, true, std::to_string(filters[realCol].upper).c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
+            float bottom = filters[realCol].lower;
+            bottom *= (maximums[realCol] - minimums[realCol]);
+            bottom += minimums[realCol];
+            float top = filters[realCol].upper;
+            top *= (maximums[realCol] - minimums[realCol]);
+            top += minimums[realCol];
+            this->font.DrawString(x, this->marginY * 0.5f, fontsize, true, std::to_string(bottom).c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
+            this->font.DrawString(x, this->marginY * 1.5f + this->axisHeight, fontsize, true, std::to_string(top).c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
 #endif
             this->font.DrawString(x, this->marginY * 2.5f + this->axisHeight, fontsize*2.0f, true, names[realCol].c_str(), vislib::graphics::AbstractFont::ALIGN_CENTER_MIDDLE);
         }


ymove書いた

ymove書いた

--- clammbon/src/algorithm.cpp
+++ clammbon/src/algorithm.cpp
@@ -70,8 +70,9 @@
 	void print(step_type const& step) const;

 	// yoshikawa
-	int form_evaluate(matrix_type const& matrix);
-	point_type get_start_point(matrix_type const& matrix);
+	void ymove();
+	int form_evaluate(matrix_type const& mat);
+	point_type get_start_point(matrix_type const& mat);
 	int eval_two_piece(evaluate_set_type const& eval_set, point_type const& new_position);
 	evaluate_set_type try_u(evaluate_set_type const& eval_set);
 	evaluate_set_type try_r(evaluate_set_type const& eval_set);
@@ -145,7 +146,7 @@
 }

 // yoshikawa {{{1
-int algorithm::impl::form_evaluate(mat_type const& mat)
+int algorithm::impl::form_evaluate(matrix_type const& mat)
 {
 	int s = 0;
 	for (int i = 0; i < mat.size(); ++i)
@@ -158,7 +159,7 @@
 	return s;
 }

-point_type algorithm::impl::get_start_point(mat_type const& mat)
+point_type algorithm::impl::get_start_point(matrix_type const& mat)
 {
 	int max_val = 0;
 	point_type max_point;//場所
@@ -241,8 +242,178 @@
 	return std::move(return_set);
 }

-void algorithm::impl::ymove() {
-    auto const& problem = matrix;
+void algorithm::impl::ymove()
+{
+	int const width = matrix.at(0).size();
+	int const height = matrix.size();
+
+	std::vector<evaluate_set_type>answer_y;
+	answer_y.reserve(1000);
+	std::vector<evaluate_set_type> first_temp;
+	first_temp.reserve(4);
+	std::vector<evaluate_set_type> second_temp;
+	second_temp.reserve(16);
+
+	evaluate_set_type start;
+	start.matrix = matrix;
+	start.position = get_start_point(matrix);
+	start.content = matrix[start.position.y][start.position.x];
+	start.score = form_evaluate(start.matrix);
+	start.direct = " ";
+	answer_y.push_back(std::move(start));
+
+	std::cout << "select piece position = " << start.position << std::endl;
+	std::cout << "select piece content = " << start.content << std::endl;
+
+	int c = 0;
+	do//とりあえず良くなってる間回る
+	{
+		c++;
+
+		if (answer_y.back().position.y != 0 && answer_y.back().direct.back() != 'D')
+		{
+			first_temp.push_back(std::move(try_u(answer_y.back())));
+			//std::cout << "上やった" << std::endl;
+			//for (auto const& line : first_temp.back().matrix)
+			//{
+			//	for (auto const& piece : line)
+			//	{
+			//		std::cout << piece;
+			//	}
+			//	std::cout << std::endl;
+			//}
+			//std::cout << std::endl;
+		}
+		if (answer_y.back().position.x != width - 1 && answer_y.back().direct.back() != 'L')
+		{
+			first_temp.push_back(std::move(try_r(answer_y.back())));
+			//std::cout << "右やった" << std::endl;
+			//for (auto const& line : first_temp.back().matrix)
+			//{
+			//	for (auto const& piece : line)
+			//	{
+			//		std::cout << piece;
+			//	}
+			//	std::cout << std::endl;
+			//}
+			//std::cout << std::endl;
+		}
+		if (answer_y.back().position.y != height - 1 && answer_y.back().direct.back() != 'U')
+		{
+			first_temp.push_back(std::move(try_d(answer_y.back())));
+			//std::cout << "下やった" << std::endl;
+			//for (auto const& line : first_temp.back().matrix)
+			//{
+			//	for (auto const& piece : line)
+			//	{
+			//		std::cout << piece;
+			//	}
+			//	std::cout << std::endl;
+			//}
+			//std::cout << std::endl;
+		}
+		if (answer_y.back().position.x != 0 && answer_y.back().direct.back() != 'R')
+		{
+			first_temp.push_back(std::move(try_l(answer_y.back())));
+			//std::cout << "左やった" << std::endl;
+			//for (auto const& line : first_temp.back().matrix)
+			//{
+			//	for (auto const& piece : line)
+			//	{
+			//		std::cout << piece;
+			//	}
+			//	std::cout << std::endl;
+			//}
+			//std::cout << std::endl;
+		}
+
+		//std::cout << "fisrt temp size = " << first_temp.size() << std::endl;
+		for (auto const& one_first_temp : first_temp)
+		{
+			//std::cout << "------------------------------------------------" << std::endl;
+			if (one_first_temp.position.y != 0 && one_first_temp.direct.back() != 'D')
+			{
+				second_temp.push_back(std::move(try_u(one_first_temp)));
+				//std::cout << "上やった" << std::endl;
+				//for (auto const& line : second_temp.back().matrix)
+				//{
+				//	for (auto const& piece : line)
+				//	{
+				//		std::cout << piece;
+				//	}
+				//	std::cout << std::endl;
+				//}
+				//std::cout << std::endl;
+			}
+			if (one_first_temp.position.x != width - 1 && one_first_temp.direct.back() != 'L')
+			{
+				second_temp.push_back(std::move(try_r(one_first_temp)));
+				//std::cout << "右やった" << std::endl;
+				//for (auto const& line : second_temp.back().matrix)
+				//{
+				//	for (auto const& piece : line)
+				//	{
+				//		std::cout << piece;
+				//	}
+				//	std::cout << std::endl;
+				//}
+				//std::cout << std::endl;
+			}
+			if (one_first_temp.position.y != height - 1 && one_first_temp.direct.back() != 'U')
+			{
+				second_temp.push_back(std::move(try_d(one_first_temp)));
+				//std::cout << "下やった" << std::endl;
+				//for (auto const& line : second_temp.back().matrix)
+				//{
+				//	for (auto const& piece : line)
+				//	{
+				//		std::cout << piece;
+				//	}
+				//	std::cout << std::endl;
+				//}
+				//std::cout << std::endl;
+			}
+			if (one_first_temp.position.x != 0 && one_first_temp.direct.back() != 'R')
+			{
+				second_temp.push_back(std::move(try_l(one_first_temp)));
+				//std::cout << "左やった" << std::endl;
+				//for (auto const& line : second_temp.back().matrix)
+				//{
+				//	for (auto const& piece : line)
+				//	{
+				//		std::cout << piece;
+				//	}
+				//	std::cout << std::endl;
+				//}
+				//std::cout << std::endl;
+			}
+		}
+
+		//std::cout << "second temp size = " << second_temp.size() << std::endl;
+
+		answer_y.push_back(
+			*std::min_element(second_temp.begin(), second_temp.end(), [](evaluate_set_type a, evaluate_set_type b){return a.score < b.score; })
+			);
+		first_temp.clear();
+		second_temp.clear();
+
+		for (auto const& line : answer_y.back().matrix)
+		{
+			for (auto const& piece : line)
+			{
+				std::cout << piece;
+			}
+			std::cout << std::endl;
+		}
+		std::cout << "score = " << answer_y.back().score << std::endl;
+
+//	} while (answer_y.at(answer_y.size() - 2).score >= answer_y.back().score);
+	} while (c < 10);
+
+	std::cout << answer_y.back().direct << std::endl;
+
+	answer.list.push_back(answer_atom{ answer_y.back().position, answer_y.back().direct });
+	matrix = answer_y.back().matrix;
 }

 // implements {{{1


Simplify the final rendering step to use 1D iteration

--- muspelheim.hpp
+++ muspelheim.hpp
@@ -131,12 +131,10 @@
   }

   auto logmax = std::log(static_cast<T>(max_alpha));
-  for(size_t x = 0; x < dst.width(); x++) {
-    for(size_t y = 0; y < dst.height(); y++) {
-      auto a = std::log(static_cast<T>(alpha(x, y)[0])) / logmax;
-      auto &c = color(x, y);
-      dst(x, y) = typename View::value_type(c[0] * a, c[1] * a, c[2] * a);
-    }
+  for(size_t i = 0; i != dst.size(); i++) {
+    auto a = std::log(static_cast<T>(alpha[i][0])) / logmax;
+    auto &c = color[i];
+    dst[i] = typename View::value_type(c[0] * a, c[1] * a, c[2] * a);
   }
 }


YAMLDocReader::getCurNode()

YAMLDocReader::getCurNode()

--- include/Athena/DNAYaml.hpp
+++ include/Athena/DNAYaml.hpp
@@ -537,6 +537,7 @@

     static bool ValidateClassType(yaml_parser_t* doc, const char* expectedType);
     inline const YAMLNode* getRootNode() const {return m_rootNode.get();}
+    inline const YAMLNode* getCurNode() const {return m_subStack.empty() ? nullptr : m_subStack.back();}
     std::unique_ptr<YAMLNode> releaseRootNode() {return std::move(m_rootNode);}

     bool enterSubRecord(const char* name)


Revert 129623, this was creating ~92 (test-only) heapcheck leak reports.

- Fixed Close() method of TestAudioInputController (callback on caller thread).

It has been changed to make this test class work coherently with the mocked
AudioInputController, according to the modifications made in CL 9858007 (which
issue the callback from the caller thread, not from the audio thread anymore).

BUG=120110, 120111
TEST=Run content_unittests.

Review URL: https://chromiumcodereview.appspot.com/9864031

TBR=primiano@chromium.org,jhawkins@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9924025

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@129674 0039d316-1c4b-4281-b951-d872f2087c98

--- media/audio/test_audio_input_controller_factory.cc
+++ media/audio/test_audio_input_controller_factory.cc
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-#include "base/bind.h"
-#include "base/bind_helpers.h"
 #include "media/audio/test_audio_input_controller_factory.h"
 #include "media/audio/audio_io.h"

@@ -26,9 +24,7 @@
 }

 void TestAudioInputController::Close(const base::Closure& closed_task) {
-  message_loop_->PostTaskAndReply(FROM_HERE,
-                                  base::Bind(&base::DoNothing),
-                                  closed_task);
+  message_loop_->PostTask(FROM_HERE, closed_task);
 }

 TestAudioInputControllerFactory::TestAudioInputControllerFactory()


Improve LIEF iterators

Improve LIEF iterators

--- include/LIEF/iterators.hpp
+++ include/LIEF/iterators.hpp
@@ -29,19 +29,27 @@
 template<class T>
 using decay_t = typename std::decay<T>::type;

+template<class T>
+using add_const_t = typename std::add_const<T>::type;
+
+template<class T>
+using remove_const_t = typename std::remove_const<T>::type;
+

 // Iterator which return ref on container's values
 // ===============================================

-template<class T>
+template<class T, class ITERATOR_T = typename decay_t<T>::iterator>
 class ref_iterator : public std::iterator<
-                     std::forward_iterator_tag,
+                     std::bidirectional_iterator_tag,
                      typename decay_t<T>::value_type,
-                     size_t,
+                     ssize_t,
                      typename std::remove_pointer<typename decay_t<T>::value_type>::type*,
                      typename std::remove_pointer<typename decay_t<T>::value_type>::type&> {
   public:
-  using DT = decay_t<T>;
+  using DT        = decay_t<T>;
+  using ref_t     = typename ref_iterator::reference;
+  using pointer_t = typename ref_iterator::pointer;

   ref_iterator(T container) :
     container_{std::forward<T>(container)},
@@ -110,31 +118,19 @@
   }

-  template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename ref_iterator::reference>::type
-  operator[](typename ref_iterator::difference_type n) {
-    if (n < 0 or n >= this->size()) {
+  typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
+  operator[](size_t n) {
+    return const_cast<remove_const_t<ref_t>>(static_cast<const ref_iterator*>(this)->operator[](n));
+  }
+
+
+  add_const_t<ref_t> operator[](size_t n) const {
+    if (n >= this->size()) {
       throw integrity_error(std::to_string(n) + " is out of bound");
     }
-    auto it = std::begin(this->container_);
+    auto it = this->begin();
     std::advance(it, n);
-
-    if (*it == nullptr) {
-      throw integrity_error("nullptr");
-    }
-    return **it;
-
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename ref_iterator::reference>::type
-  operator[](typename ref_iterator::difference_type n) {
-    if (n < 0 or n >= this->size()) {
-      throw integrity_error(std::to_string(n) + " is out of bound");
-    }
-    auto it = std::begin(this->container_);
-    std::advance(it, n);
-    return *it;
+    return const_cast<add_const_t<ref_t>>(*it);
   }

   ref_iterator operator+(typename ref_iterator::difference_type n) const {
@@ -172,17 +168,25 @@
     return not (*this > rhs);
   }

-  ref_iterator begin(void) {
+  ref_iterator begin(void) const {
     return this->container_;
   }

-  ref_iterator end(void)  {
+  ref_iterator cbegin(void) const {
+    return this->begin();
+  }
+
+  ref_iterator end(void)  const {
     ref_iterator it = ref_iterator{this->container_};
     it.it_ = std::end(it.container_);
     it.distance_ = it.size();
     return it;
   }

+  ref_iterator cend(void) const {
+    return this->end();
+  }
+
   bool operator==(const ref_iterator& other) const {
     return (this->size() == other.size() and this->distance_ == other.distance_);
   }
@@ -195,286 +199,117 @@
     return this->container_.size();
   }

+
+  typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
+  operator*() {
+    return const_cast<remove_const_t<ref_t>>(static_cast<const ref_iterator*>(this)->operator*());
+  }
+
   template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename ref_iterator::reference>::type
-  operator*() {
-    if (*this->it_ == nullptr) {
-      throw integrity_error("nullptr");
-    }
-    return **it_;
-  }
-
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename ref_iterator::pointer>::type
-  operator->() {
-    if (*this->it_ == nullptr) {
-      throw integrity_error("nullptr");
-    }
-    return *this->it_;
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename ref_iterator::reference>::type
-  operator*() {
-    return *(this->it_);
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename ref_iterator::pointer>::type
-  operator->() {
-    return &(*this->it_);
-  }
-
-  private:
-  T container_;
-  typename DT::iterator it_;
-  typename ref_iterator::difference_type distance_;
-};
-
-
-// Iterator which return const ref on container's values
-// =====================================================
-
-template<class T, class CT = typename std::add_const<T>::type>
-class const_ref_iterator : public std::iterator<
-                     std::forward_iterator_tag,
-                     const typename decay_t<T>::value_type,
-                     size_t,
-                     const typename std::remove_pointer<typename decay_t<T>::value_type>::type*,
-                     const typename std::remove_pointer<typename decay_t<T>::value_type>::type&> {
-  public:
-  using DT = decay_t<CT>;
-
-  const_ref_iterator(CT container) :
-    container_{std::forward<CT>(container)},
-    distance_{0}
-  {
-    this->it_ = this->container_.cbegin();
-  }
-
-
-  const_ref_iterator(const const_ref_iterator& copy) :
-    container_{copy.container_},
-    it_{container_.cbegin()},
-    distance_{copy.distance_}
-  {
-    std::advance(this->it_, this->distance_);
-  }
-
-  const_ref_iterator operator=(const_ref_iterator other) {
-    this->swap(other);
-    return *this;
-  }
-
-  void swap(const_ref_iterator& other) {
-    std::swap(this->container_, other.container_);
-    std::swap(this->it_, other.it_);
-    std::swap(this->distance_, other.distance_);
-  }
-
-
-
-  const_ref_iterator& operator++() {
-    this->it_ = std::next(this->it_);
-    this->distance_++;
-    return *this;
-  }
-
-  const_ref_iterator operator++(int) {
-    const_ref_iterator retval = *this;
-    ++(*this);
-    return retval;
-  }
-
-  const_ref_iterator& operator--(void) {
-    if (this->it_ != container_.cbegin()) {
-      this->it_ = std::prev(this->it_);
-      this->distance_--;
-    }
-    return *this;
-  }
-
-  const_ref_iterator operator--(int) {
-    const_ref_iterator retval = *this;
-    --(*this);
-    return retval;
-  }
-
-
-  const_ref_iterator& operator+=(const typename const_ref_iterator::difference_type& movement) {
-    std::advance(this->it_, movement);
-    this->distance_ += movement;
-    return *this;
-  }
-
-
-  const_ref_iterator& operator-=(const typename const_ref_iterator::difference_type& movement) {
-    return (*this) += -movement;
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename const_ref_iterator::reference>::type
-  operator[](typename const_ref_iterator::difference_type n) {
-    if (n < 0 or n >= this->size()) {
-      throw integrity_error(std::to_string(n) + " is out of bound");
-    }
-    auto&& it = this->container_.cbegin();
-    std::advance(it, n);
-
-    if (*it == nullptr) {
-      throw integrity_error("nullptr");
-    }
-    return **it;
-
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename const_ref_iterator::reference>::type
-  operator[](typename const_ref_iterator::difference_type n) {
-    auto&& it = this->container_.cbegin();
-    std::advance(it, n);
-    return *it;
-  }
-
-  const_ref_iterator operator+(typename const_ref_iterator::difference_type n) const {
-    const_ref_iterator tmp = *this;
-    return tmp += n;
-  }
-
-
-  const_ref_iterator operator-(typename const_ref_iterator::difference_type n) const {
-    const_ref_iterator tmp = *this;
-    return tmp -= n;
-  }
-
-
-  typename const_ref_iterator::difference_type operator-(const const_ref_iterator& rhs) const {
-    return this->distance_ - rhs.distance_;
-  }
-
-  bool operator<(const const_ref_iterator& rhs) const {
-    return (rhs - *this) > 0;
-  }
-
-
-  bool operator>(const const_ref_iterator& rhs) const {
-    return rhs < *this;
-  }
-
-
-  bool operator>=(const const_ref_iterator& rhs) const {
-    return not (*this < rhs);
-  }
-
-  bool operator<=(const const_ref_iterator& rhs) const {
-    return not (*this > rhs);
-  }
-
-  const_ref_iterator cbegin(void) const {
-    return this->container_;
-  }
-
-  const_ref_iterator cend(void) const {
-    const_ref_iterator it{this->container_};
-    it.it_ = it.container_.cend();
-    it.distance_ = it.size();
-    return it;
-  }
-
-  const_ref_iterator begin(void) const {
-    return this->cbegin();
-  }
-
-  const_ref_iterator end(void) const {
-    return this->cend();
-  }
-
-  bool operator==(const const_ref_iterator& other) const {
-    return (this->size() == other.size() and this->distance_ == other.distance_);
-  }
-
-  bool operator!=(const const_ref_iterator& other) const {
-    return not (*this == other);
-  }
-
-  size_t size(void) const {
-    return this->container_.size();
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename const_ref_iterator::reference>::type
+  typename std::enable_if<std::is_pointer<U>::value, add_const_t<ref_t>>::type
   operator*() const {
     if (*this->it_ == nullptr) {
       throw integrity_error("nullptr");
     }
-    return **it_;
+    return const_cast<add_const_t<ref_t>>(**it_);
   }

   template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename const_ref_iterator::pointer>::type
+  typename std::enable_if<not std::is_pointer<U>::value, add_const_t<ref_t>>::type
+  operator*() const {
+    return const_cast<add_const_t<ref_t>>(*(this->it_));
+  }
+
+
+  typename std::enable_if<not std::is_const<pointer_t>::value, pointer_t>::type
   operator->() {
-    if (*this->it_ == nullptr) {
-      throw integrity_error("nullptr");
-    }
-    return *this->it_;
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename const_ref_iterator::reference>::type
-  operator*() const {
-    return *it_;
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename const_ref_iterator::pointer>::type
-  operator->() {
-    return &(*this->it_);
-  }
-  private:
+    return const_cast<remove_const_t<pointer_t>>(static_cast<const ref_iterator*>(this)->operator->());
+  }
+
+  add_const_t<pointer_t> operator->() const {
+    return const_cast<add_const_t<pointer_t>>(&(this->operator*()));
+  }
+
+  protected:
   T container_;
-  typename decay_t<decltype(container_)>::const_iterator it_;
-  typename const_ref_iterator::difference_type distance_;
+  ITERATOR_T it_;
+  typename ref_iterator::difference_type distance_;
 };

-// Iterator which return a ref on container's values given a predicated
-// ====================================================================
-
-template<class T>
+// Iterator which return const ref on container's values
+// =====================================================
+template<class T, class CT = typename std::add_const<T>::type>
+using const_ref_iterator = ref_iterator<CT, typename decay_t<CT>::const_iterator>;
+
+
+// Iterator which return a ref on container's values given predicates
+// ==================================================================
+
+template<class T, class ITERATOR_T = typename decay_t<T>::iterator>
 class filter_iterator : public std::iterator<
                      std::forward_iterator_tag,
                      typename decay_t<T>::value_type,
-                     size_t,
+                     ssize_t,
                      typename std::remove_pointer<typename decay_t<T>::value_type>::type*,
                      typename std::remove_pointer<typename decay_t<T>::value_type>::type&> {

   public:

-  using DT = decay_t<T>;
-  using filter_t = std::function<bool (const typename DT::value_type&)>;
+  using DT        = decay_t<T>;
+  using ref_t     = typename filter_iterator::reference;
+  using pointer_t = typename filter_iterator::pointer;
+  using filter_t  = std::function<bool (const typename DT::value_type&)>;

   filter_iterator(T container, filter_t filter) :
     size_c_{0},
     container_{std::forward<T>(container)},
-    filter_{filter},
+    filters_{},
     distance_{0}
   {

     this->it_ = std::begin(this->container_);

+    this->filters_.push_back(filter),
+    this->it_ = std::begin(this->container_);
+
     if (this->it_ != std::end(this->container_)) {
-      if (not this->filter_(*this->it_)) {
+      if (not std::all_of(std::begin(this->filters_), std::end(this->filters_), [this] (const filter_t& f) {return f(*this->it_);})) {
         this->next();
       }
     }
+  }
+
+  filter_iterator(T container, const std::vector<filter_t>& filters) :
+    size_c_{0},
+    container_{std::forward<T>(container)},
+    filters_{filters},
+    distance_{0}
+  {
+
+    this->it_ = std::begin(this->container_);
+
+    if (this->it_ != std::end(this->container_)) {
+      if (not std::all_of(std::begin(this->filters_), std::end(this->filters_), [this] (const filter_t& f) {return f(*this->it_);})) {
+        this->next();
+      }
+    }
+  }
+
+  filter_iterator(T container) :
+    size_c_{0},
+    container_{std::forward<T>(container)},
+    filters_{},
+    distance_{0}
+  {
+    this->it_ = std::begin(this->container_);
   }

   filter_iterator(const filter_iterator& copy) :
     size_c_{0},
     container_{copy.container_},
     it_{std::begin(container_)},
-    filter_{copy.filter_},
+    filters_{copy.filters_},
     distance_{copy.distance_}
   {
     std::advance(this->it_, this->distance_);
@@ -488,14 +323,14 @@
   void swap(filter_iterator& other) {
     std::swap(this->container_, other.container_);
     std::swap(this->it_,        other.it_);
-    std::swap(this->filter_,    other.filter_);
+    std::swap(this->filters_,   other.filters_);
     std::swap(this->size_c_,    other.size_c_);
     std::swap(this->distance_,  other.distance_);
   }

   filter_iterator& def(filter_t func) {
-    this->filter_ = func;
+    this->filters_.push_back(func);
     this->size_c_ = 0;
     return *this;
   }
@@ -511,12 +346,16 @@
     return retval;
   }

-  filter_iterator begin(void) {
-    return {this->container_, this->filter_};
-  }
-
-  filter_iterator end(void) {
-    filter_iterator it_end{this->container_, this->filter_};
+  filter_iterator begin(void) const {
+    return {this->container_, this->filters_};
+  }
+
+  filter_iterator cbegin(void) const {
+    return this->begin();
+  }
+
+  filter_iterator end(void) const {
+    filter_iterator it_end{this->container_, this->filters_};

     it_end.it_       =  it_end.container_.end();
     it_end.distance_ = it_end.container_.size();
@@ -524,40 +363,68 @@
     return it_end;
   }

+  filter_iterator cend(void) const {
+    return this->end();
+  }
+
+  typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
+  operator*() {
+    return const_cast<remove_const_t<ref_t>>(static_cast<const filter_iterator*>(this)->operator*());
+  }
+
   template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename filter_iterator::reference>::type
-  operator*() {
+  typename std::enable_if<std::is_pointer<U>::value, add_const_t<ref_t>>::type
+  operator*() const {
     if (*this->it_ == nullptr) {
       throw integrity_error("nullptr");
     }
-    return **this->it_;
+    return const_cast<add_const_t<ref_t>>(**it_);
   }

   template<typename U = typename DT::value_type>
-  typename std::enable_if<!std::is_pointer<U>::value, typename filter_iterator::reference>::type
-  operator*() {
-    return *this->it_;
-  }
-
-
-  typename filter_iterator::reference
-  operator[](typename filter_iterator::difference_type n) {
-    if (n < 0 or n >= this->size()) {
+  typename std::enable_if<not std::is_pointer<U>::value, add_const_t<ref_t>>::type
+  operator*() const {
+    return const_cast<add_const_t<ref_t>>(*(this->it_));
+  }
+
+
+  typename std::enable_if<not std::is_const<ref_t>::value, remove_const_t<ref_t>>::type
+  operator[](size_t n) {
+    return const_cast<remove_const_t<ref_t>>(static_cast<const filter_iterator*>(this)->operator[](n));
+  }
+
+  add_const_t<ref_t> operator[](size_t n) const {
+    if (n >= this->size()) {
       throw integrity_error(std::to_string(n) + " is out of bound");
     }

     auto it = this->begin();
     std::advance(it, n);
-    return *it;
+    return const_cast<add_const_t<ref_t>>(*it);
+  }
+
+
+  typename std::enable_if<not std::is_const<pointer_t>::value, pointer_t>::type
+  operator->() {
+    return const_cast<remove_const_t<pointer_t>>(static_cast<const filter_iterator*>(this)->operator->());
+  }
+
+  add_const_t<pointer_t> operator->() const {
+    return const_cast<add_const_t<pointer_t>>(&(this->operator*()));
   }

   size_t size(void) const {
+    if (this->filters_.size() == 0) {
+      return this->container_.size();
+    }
+
     if (this->size_c_ > 0) {
       return this->size_c_;
     }
     filter_iterator it = *this;
     size_t size = 0;
-    while (it++ != std::end(it)) ++size;
+
+    while (it++ != std::end(it)) size++;
     this->size_c_ = size;
     return this->size_c_;
   }
@@ -571,7 +438,7 @@
     return not (*this == other);
   }

-  private:
+  protected:
   void next(void) {
     if (this->it_ == std::end(this->container_)) {
       this->distance_ = this->container_.size();
@@ -581,179 +448,31 @@
     do {
       this->it_ = std::next(this->it_);
       this->distance_++;
-    } while(this->it_ != std::end(this->container_) and not this->filter_(*this->it_));
+    } while(
+        this->it_ != std::end(this->container_) and
+        not std::all_of(
+          std::begin(this->filters_),
+          std::end(this->filters_),
+          [this] (const filter_t& f) {
+            return f(*this->it_);
+          }
+        )
+      );

   }

   mutable size_t size_c_;
   T container_;
-  typename DT::iterator it_;
-  filter_t filter_;
+  ITERATOR_T it_;
+  std::vector<filter_t> filters_;
   typename filter_iterator::difference_type distance_;
 };

-// Iterator which return a const ref on container's values given a predicated
-// ==========================================================================
-
+// Iterator which return a const ref on container's values given predicates
+// ========================================================================
 template<class T, class CT = typename std::add_const<T>::type>
-class const_filter_iterator : public std::iterator<
-                     std::forward_iterator_tag,
-                     const typename decay_t<T>::value_type,
-                     std::size_t,
-                     const typename std::remove_pointer<typename decay_t<T>::value_type>::type*,
-                     const typename std::remove_pointer<typename decay_t<T>::value_type>::type&> {
-
-  public:
-
-  using DT = decay_t<CT>;
-  using filter_t = std::function<bool (const typename DT::value_type)>;
-
-  const_filter_iterator(CT container, filter_t filter) :
-    size_c_{0},
-    container_{std::forward<CT>(container)},
-    filter_{filter},
-    distance_{0}
-  {
-    this->it_ = this->container_.cbegin();
-
-    if (this->it_ != this->container_.cend()) {
-      if (not this->filter_(*this->it_)) {
-        this->next();
-      }
-    }
-  }
-
-  const_filter_iterator(const const_filter_iterator& copy) :
-    size_c_{0},
-    container_{copy.container_},
-    it_{container_.cbegin()},
-    filter_{copy.filter_},
-    distance_{copy.distance_}
-  {
-    std::advance(this->it_, this->distance_);
-  }
-
-  const_filter_iterator operator=(const_filter_iterator other) {
-    this->swap(other);
-    return *this;
-  }
-
-  void swap(const_filter_iterator& other) {
-    std::swap(this->container_, other.container_);
-    std::swap(this->it_,        other.it_);
-    std::swap(this->filter_,    other.filter_);
-    std::swap(this->size_c_,    other.size_c_);
-    std::swap(this->distance_,  other.distance_);
-  }
-
-
-
-  const_filter_iterator& def(filter_t func) {
-    this->filter_ = func;
-    this->size_c_ = 0;
-    return *this;
-  }
-
-  const_filter_iterator& operator++() {
-    this->next();
-    return *this;
-  }
-
-  const_filter_iterator operator++(int) {
-    const_filter_iterator retval = *this;
-    ++(*this);
-    return retval;
-  }
-
-  const_filter_iterator cbegin(void) const {
-    return {this->container_, this->filter_};
-  }
-
-  const_filter_iterator cend(void) const {
-    const_filter_iterator it{this->container_, this->filter_};
-    it.it_       = it.container_.cend();
-    it.distance_ = it.container_.size();
-    return it;
-  }
-
-  const_filter_iterator begin(void) const {
-    return this->cbegin();
-  }
-
-  const_filter_iterator end(void) const {
-    return this->cend();
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<std::is_pointer<U>::value, typename const_filter_iterator::reference>::type
-  operator*() const {
-    if (*this->it_ == nullptr) {
-      throw integrity_error("nullptr");
-    }
-    return **this->it_;
-  }
-
-  template<typename U = typename DT::value_type>
-  typename std::enable_if<not std::is_pointer<U>::value, typename const_filter_iterator::reference>::type
-  operator*() const {
-    return *this->it_;
-  }
-
-
-  size_t size(void) const {
-    if (this->size_c_ > 0) {
-      return this->size_c_;
-    }
-
-    auto it = this->cbegin();
-    size_t size = 0;
-    while (it++ != it.cend()) ++size;
-    this->size_c_ = size;
-    return this->size_c_;
-  }
-
-
-  typename const_filter_iterator::reference
-  operator[](typename const_filter_iterator::difference_type n) const {
-    if (n < 0 or n >= this->size()) {
-      throw integrity_error(std::to_string(n) + " is out of bound");
-    }
-
-    auto it = this->cbegin();
-    std::advance(it, n);
-
-    return *it;
-  }
-
-  bool operator==(const const_filter_iterator& other) const {
-    return (this->container_.size() == other.container_.size() and this->distance_ == other.distance_);
-  }
-
-  bool operator!=(const const_filter_iterator& other) const {
-    return not (*this == other);
-  }
-
-  private:
-  void next(void) {
-
-    if (this->it_ == this->container_.cend()) {
-      this->distance_ = this->container_.size();
-      return;
-    }
-
-    do {
-      this->it_ = std::next(this->it_);
-      this->distance_++;
-    } while(this->it_ != this->container_.cend() and not this->filter_(*this->it_));
-  }
-
-  mutable size_t size_c_;
-  T container_;
-  typename decay_t<decltype(container_)>::const_iterator it_;
-  filter_t filter_;
-  typename const_filter_iterator::difference_type distance_;
-};
+using const_filter_iterator = filter_iterator<CT, typename decay_t<CT>::const_iterator>;


Minor formatting changes

Minor formatting changes

--- src/SimpleMetropolisHastingsSampler.cxx
+++ src/SimpleMetropolisHastingsSampler.cxx
@@ -91,8 +91,8 @@
   if (sqmodulus != NULL)
     *sqmodulus = sum_of_squares;
 }
-static inline void random_inside_hypersphere(
-    double scale, double *d, size_t n)
+
+static inline void random_inside_hypersphere( double scale, double *d, size_t n )
 {
   double sqmodulus = 0.0;
   random_multinormal(d, n, &sqmodulus);
@@ -116,57 +116,57 @@
   unsigned int numberOfActiveParameters = this->GetNumberOfActiveParameters();
   std::vector< double > randomStep( numberOfActiveParameters, 0.0 );

-  assert( std::count(this->m_ActiveParameterIndices.begin(),
-    this->m_ActiveParameterIndices.end(), true) == numberOfActiveParameters);
+  assert( std::count( this->m_ActiveParameterIndices.begin(),
+                      this->m_ActiveParameterIndices.end(), true ) == numberOfActiveParameters);

   for ( unsigned int giveup = 1048576; giveup != 0; --giveup ) {
-    random_inside_hypersphere(
-      m_StepSize, &(randomStep[0]), numberOfActiveParameters);
+    random_inside_hypersphere( m_StepSize,
+                               &(randomStep[0]),
+                               numberOfActiveParameters );
+
     unsigned int k = 0;
-    for(unsigned int i = 0; i < m_NumberOfParameters; i++) {
-      if (this->m_ActiveParameterIndices[i]) {
+    for ( unsigned int i = 0; i < m_NumberOfParameters; i++ ) {
+      if ( m_ActiveParameterIndices[i] ) {
         xc[i] = m_LastStepParameters[i] + randomStep[k];
         k++;
       } else {
         xc[i] = m_LastStepParameters[i];
-				// Not sure how to respect this->m_CurrentParameters[i] ???
-				// for (i < m_NumberOfParameters)
-				//   if (!this->m_ActiveParameterIndices[i] &&
-				//        (this->m_CurrentParameters[i] != m_LastStepParameters[i])) {
-				//     do something;
-				//   }
+        // Not sure how to respect this->m_CurrentParameters[i] ???
+        // for (i < m_NumberOfParameters)
+        //   if (!this->m_ActiveParameterIndices[i] &&
+        //        (this->m_CurrentParameters[i] != m_LastStepParameters[i])) {
+        //     do something;
+        //   }
       }
     }

-    if (m_OptimizeOnLikelihood) {
+    if ( m_OptimizeOnLikelihood ) {
       double ll;
       m->GetScalarOutputsAndLogLikelihood(xc,yc,ll);
       double delta_logLikelihood = ll - m_LastStepLogLikelihood;
+
       if ((delta_logLikelihood > 0) ||
-          (exp(delta_logLikelihood) > uniform_rand()))
-        {
-          m_LastStepLogLikelihood = ll;
-          m_LastStepParameters = xc;
-          m_LastStepOutputs = yc;
-          trace->add(xc, yc, ll);
-          return;
-          //FIXME do somthing
-        }
+          (exp(delta_logLikelihood) > uniform_rand())) {
+        m_LastStepLogLikelihood = ll;
+        m_LastStepParameters = xc;
+        m_LastStepOutputs = yc;
+        trace->add(xc, yc, ll);
+        return;
+      }
     } else {
       double ll;
       m->GetScalarOutputsAndLogLikelihood(xc,yc,ll);
-      //m_Model->GetScalarOutputs(xc,yx);
+
       double f_of_x = m_LastStepOutputs[output_index];
       double f_of_xc = yc[output_index];
-      if ((f_of_xc > f_of_x) || (f_of_xc > (f_of_x * uniform_rand())))
-        {
-          m_LastStepLogLikelihood = ll;
-          m_LastStepParameters = xc;
-          m_LastStepOutputs = yc;
-          trace->add(xc, yc, ll);
-          return;
-          //FIXME do somthing ???
-        }
+
+      if ((f_of_xc > f_of_x) || (f_of_xc > (f_of_x * uniform_rand()))) {
+        m_LastStepLogLikelihood = ll;
+        m_LastStepParameters = xc;
+        m_LastStepOutputs = yc;
+        trace->add(xc, yc, ll);
+        return;
+      }
     }
   }
 }


Fix misspelling.

Fix misspelling.

--- include/aux/yk_var_api.hpp
+++ include/aux/yk_var_api.hpp
@@ -846,7 +846,7 @@
            This value is typically set by the stencil compiler, but
            this function allows you to override that value.
            If the left halo is set to a value larger than the left padding size, the
-           left padding size will be automatically increase to accomodate it.
+           left padding size will be automatically increase to accommodate it.
            @note After data storage has been allocated, the left halo size
            can only be set to a value less than or equal to the left padding size
            in the given dimension.
@@ -864,7 +864,7 @@
            This value is typically set by the stencil compiler, but
            this function allows you to override that value.
            If the right halo is set to a value larger than the right padding size, the
-           right padding size will be automatically increase to accomodate it.
+           right padding size will be automatically increase to accommodate it.
            @note After data storage has been allocated, the right halo size
            can only be set to a value less than or equal to the right padding size
            in the given dimension.


Return earlier if no new segments

Return earlier if no new segments

--- include/boink/compactor.hh
+++ include/boink/compactor.hh
@@ -347,6 +347,11 @@
                            preprocess);
         }
         preprocess.push_back(compact_segment()); // null segment
+
+        if (preprocess.size() < 3) {
+            // no new sequence
+            return;
+        }

         // handle edge case for left_flank of first segment if it starts at pos 0
         if (preprocess[1].start_pos == 0) {


Discard SIGCHLD if NEB module load Qt (performance improvement).

git-svn-id: a49aa41e49c69a6ab6ef43f172843a2fef6cb475@1222 7c7d615a-03b3-410d-a316-1135b1bd9499

--- neb/src/neb.cc
+++ neb/src/neb.cc
@@ -17,10 +17,10 @@
 ** <http://www.gnu.org/licenses/>.
 */

+#include <csignal>
+#include <cstring>
 #include <QCoreApplication>
 #include <QTimer>
-#include <stddef.h>
-#include <string.h>
 #include "com/centreon/broker/config/applier/endpoint.hh"
 #include "com/centreon/broker/config/applier/init.hh"
 #include "com/centreon/broker/config/applier/logger.hh"
@@ -190,6 +190,7 @@
     if (!QCoreApplication::instance()) {
       gl_initialized_qt = true;
       new QCoreApplication(gl_qt_argc, (char**)gl_qt_argv);
+      signal(SIGCHLD, SIG_DFL);
     }

     // Disable timestamp printing in logs (cause starvation when forking).


r9821/sofa : Little optimization in UnilateralConstraintResolutionWithFriction.

Former-commit-id: 74268ec584eac98355d37608e4c7e2e2d8f2ccdd

--- modules/sofa/component/constraintset/UnilateralInteractionConstraint.cpp
+++ modules/sofa/component/constraintset/UnilateralInteractionConstraint.cpp
@@ -102,10 +102,12 @@

     normFt = sqrt(force[line+1]*force[line+1] + force[line+2]*force[line+2]);

-    if(normFt > _mu*force[line])
+	double fN = _mu*force[line];
+    if(normFt > fN)
     {
-        force[line+1] *= _mu*force[line]/normFt;
-        force[line+2] *= _mu*force[line]/normFt;
+		double factor = fN / normFt;
+        force[line+1] *= factor;
+        force[line+2] *= factor;
     }
 }


CSM: copy dynamics to output if enabled (#922)

The monitor optionally kept track of velocities, accelerations & effort too,
but never wrote them to the output variable when asked for the current state

--- moveit_ros/planning/planning_scene_monitor/src/current_state_monitor.cpp
+++ moveit_ros/planning/planning_scene_monitor/src/current_state_monitor.cpp
@@ -103,6 +103,24 @@
   boost::mutex::scoped_lock slock(state_update_lock_);
   const double* pos = robot_state_.getVariablePositions();
   upd.setVariablePositions(pos);
+  if (copy_dynamics_)
+  {
+    if (robot_state_.hasVelocities())
+    {
+      const double* vel = robot_state_.getVariableVelocities();
+      upd.setVariableVelocities(vel);
+    }
+    if (robot_state_.hasAccelerations())
+    {
+      const double* acc = robot_state_.getVariableAccelerations();
+      upd.setVariableAccelerations(acc);
+    }
+    if (robot_state_.hasEffort())
+    {
+      const double* eff = robot_state_.getVariableEffort();
+      upd.setVariableEffort(eff);
+    }
+  }
 }

 void planning_scene_monitor::CurrentStateMonitor::addUpdateCallback(const JointStateUpdateCallback& fn)


IMPALA-1350: rework symbol resolution

IMPALA-1350: rework symbol resolution

This passes our current UDF tests, and I manually checked that it
fixes the Impyla issue.

Change-Id: I6591c316e4a479b44057e26bed5892a559edbc85
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4741
Reviewed-by: Skye Wanderman-Milne <6d4b168ab637b0a20cc9dbf96abb2537f372f946@cloudera.com>
Tested-by: jenkins

--- be/src/service/fe-support.cc
+++ be/src/service/fe-support.cc
@@ -158,20 +158,21 @@
     }
   }

-  if (SymbolsUtil::IsMangled(params.symbol)) {
-    DCHECK(params.fn_binary_type != TFunctionBinaryType::HIVE);
+  if (params.fn_binary_type == TFunctionBinaryType::IR ||
+      params.fn_binary_type == TFunctionBinaryType::HIVE ||
+      SymbolsUtil::IsMangled(params.symbol)) {
+    // Check if the FE specified symbol exists as-is.
     Status status =
         LibCache::instance()->CheckSymbolExists(params.location, type, params.symbol);
     if (status.ok()) {
-      // The FE specified symbol exists, just use that.
       result->__set_result_code(TSymbolLookupResultCode::SYMBOL_FOUND);
       result->__set_symbol(params.symbol);
       // TODO: we can demangle the user symbol here and validate it against
       // params.arg_types. This would prevent someone from typing the wrong symbol
       // by accident. This requires more string parsing of the symbol.
       return;
-    } else {
-      // The input was already mangled and we couldn't find it, return the error.
+    } else if (params.fn_binary_type != TFunctionBinaryType::IR) {
+      // No use trying to mangle Hive or already mangled symbols, return the error.
       result->__set_result_code(TSymbolLookupResultCode::SYMBOL_NOT_FOUND);
       stringstream ss;
       ss << "Could not find symbol '" << params.symbol << "' in: " << params.location;
@@ -184,19 +185,18 @@
   ColumnType ret_type(INVALID_TYPE);
   if (params.__isset.ret_arg_type) ret_type = ColumnType(params.ret_arg_type);

-  if (params.fn_binary_type != TFunctionBinaryType::HIVE) {
-    // Mangle the user input
-    if (params.symbol_type == TSymbolType::UDF_EVALUATE) {
-      symbol = SymbolsUtil::MangleUserFunction(params.symbol,
-          arg_types, params.has_var_args, params.__isset.ret_arg_type ? &ret_type : NULL);
-    } else {
-      DCHECK(params.symbol_type == TSymbolType::UDF_PREPARE ||
-             params.symbol_type == TSymbolType::UDF_CLOSE);
-      symbol = SymbolsUtil::ManglePrepareOrCloseFunction(params.symbol);
-    }
-  }
-
-  // Look up the symbol
+  // Mangle the user input
+  DCHECK_NE(params.fn_binary_type, TFunctionBinaryType::HIVE);
+  if (params.symbol_type == TSymbolType::UDF_EVALUATE) {
+    symbol = SymbolsUtil::MangleUserFunction(params.symbol,
+        arg_types, params.has_var_args, params.__isset.ret_arg_type ? &ret_type : NULL);
+  } else {
+    DCHECK(params.symbol_type == TSymbolType::UDF_PREPARE ||
+           params.symbol_type == TSymbolType::UDF_CLOSE);
+    symbol = SymbolsUtil::ManglePrepareOrCloseFunction(params.symbol);
+  }
+
+  // Look up the mangled symbol
   Status status = LibCache::instance()->CheckSymbolExists(params.location, type, symbol);
   if (!status.ok()) {
     result->__set_result_code(TSymbolLookupResultCode::SYMBOL_NOT_FOUND);


Added a protobuf::append function.

Added a protobuf::append function.

Review: https://reviews.apache.org/r/26799

--- 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
+++ 3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
@@ -44,7 +44,8 @@
 namespace protobuf {

 // Write out the given protobuf to the specified file descriptor by
-// first writing out the length of the protobuf followed by the contents.
+// first writing out the length of the protobuf followed by the
+// contents.
 // NOTE: On error, this may have written partial data to the file.
 inline Try<Nothing> write(int fd, const google::protobuf::Message& message)
 {
@@ -70,14 +71,15 @@
 }

-// A wrapper function that wraps the above write with open and closing the file.
+// A wrapper function that wraps the above write with open and closing
+// the file.
 inline Try<Nothing> write(
     const std::string& path,
     const google::protobuf::Message& message)
 {
   Try<int> fd = os::open(
       path,
-      O_WRONLY | O_CREAT | O_TRUNC,
+      O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
       S_IRUSR | S_IWUSR | S_IRGRP | S_IRWXO);

   if (fd.isError()) {
@@ -86,17 +88,41 @@

   Try<Nothing> result = write(fd.get(), message);

-  // NOTE: We ignore the return value of close(). This is because users calling
-  // this function are interested in the return value of write(). Also an
-  // unsuccessful close() doesn't affect the write.
+  // NOTE: We ignore the return value of close(). This is because
+  // users calling this function are interested in the return value of
+  // write(). Also an unsuccessful close() doesn't affect the write.
   os::close(fd.get());

   return result;
 }

-// Read the next protobuf of type T from the file by first reading
-// the "size" followed by the contents (as written by 'write' above).
+inline Try<Nothing> append(
+    const std::string& path,
+    const google::protobuf::Message& message)
+{
+  Try<int> fd = os::open(
+      path,
+      O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC,
+      S_IRUSR | S_IWUSR | S_IRGRP | S_IRWXO);
+
+  if (fd.isError()) {
+    return Error("Failed to open file '" + path + "': " + fd.error());
+  }
+
+  Try<Nothing> result = write(fd.get(), message);
+
+  // NOTE: We ignore the return value of close(). This is because
+  // users calling this function are interested in the return value of
+  // write(). Also an unsuccessful close() doesn't affect the write.
+  os::close(fd.get());
+
+  return result;
+}
+
+
+// Read the next protobuf of type T from the file by first reading the
+// "size" followed by the contents (as written by 'write' above).
 // If 'ignorePartial' is true, None() is returned when we unexpectedly
 // hit EOF while reading the protobuf (e.g., partial write).
 // If 'undoFailed' is true, failed read attempts will restore the file
@@ -143,9 +169,9 @@
   // Parse the size from the bytes.
   memcpy((void*) &size, (void*) result.get().data(), sizeof(size));

-  // NOTE: Instead of specifically checking for corruption in 'size', we simply
-  // try to read 'size' bytes. If we hit EOF early, it is an indication of
-  // corruption.
+  // NOTE: Instead of specifically checking for corruption in 'size',
+  // we simply try to read 'size' bytes. If we hit EOF early, it is an
+  // indication of corruption.
   result = os::read(fd, size);

   if (result.isError()) {
@@ -187,13 +213,15 @@
 }

-// A wrapper function that wraps the above read() with
-// open and closing the file.
+// A wrapper function that wraps the above read() with open and
+// closing the file.
 template <typename T>
 inline Result<T> read(const std::string& path)
 {
   Try<int> fd = os::open(
-      path, O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IRWXO);
+      path,
+      O_RDONLY | O_CLOEXEC,
+      S_IRUSR | S_IWUSR | S_IRGRP | S_IRWXO);

   if (fd.isError()) {
     return Error("Failed to open file '" + path + "': " + fd.error());
@@ -201,9 +229,9 @@

   Result<T> result = read<T>(fd.get());

-  // NOTE: We ignore the return value of close(). This is because users calling
-  // this function are interested in the return value of read(). Also an
-  // unsuccessful close() doesn't affect the read.
+  // NOTE: We ignore the return value of close(). This is because
+  // users calling this function are interested in the return value of
+  // read(). Also an unsuccessful close() doesn't affect the read.
   os::close(fd.get());

   return result;


BUG: Pass requires correct types on setp instructions..

Former-commit-id: b894df02a3b0bca1389b81bfce865e2a405e7ff7


Support for higher dimensions

Support for higher dimensions

--- include/etl/generators.hpp
+++ include/etl/generators.hpp
@@ -9,6 +9,8 @@
 #define ETL_GENERATORS_HPP

 #include <random>
+
+#include "cpp_utils/tmp.hpp"

 namespace etl {

@@ -24,11 +26,10 @@
         return value;
     }

-    constexpr const T operator()(std::size_t) const {
-        return value;
-    }
+    template<typename... S>
+    T operator()(S... /*args*/) const {
+        static_assert(cpp::all_convertible_to<std::size_t, S...>::value, "Invalid size types");

-    constexpr const T operator()(std::size_t, std::size_t) const {
         return value;
     }
 };


additional documentation

additional documentation

--- include/gbBase/PerfLog.hpp
+++ include/gbBase/PerfLog.hpp
@@ -2,10 +2,10 @@
 #define GHULBUS_LIBRARY_INCLUDE_GUARD_BASE_PERFLOG_HPP

 /** @file
-*
-* @brief Minimalistic Performance Logger.
-* @author Andreas Weis (der_ghulbus@ghulbus-inc.de)
-*/
+ *
+ * @brief Minimalistic Performance Logger.
+ * @author Andreas Weis (der_ghulbus@ghulbus-inc.de)
+ */

 #include <gbBase/config.hpp>
 #include <gbBase/Log.hpp>
@@ -17,6 +17,11 @@

 namespace GHULBUS_BASE_NAMESPACE
 {
+/** A simple performance logger.
+ * PerfLog records timestamped events with every tick().
+ * These can either be retrieved later or passed on to the logger straight away.
+ * Each event consists of a string label and a timestamp.
+ */
 class PerfLog {
     struct LogEntry {
         std::chrono::steady_clock::time_point t;
@@ -30,20 +35,33 @@
 private:
     Log m_log;
 public:
+    /** Constructor.
+     * This will create the initial event labeled "Epoch".
+     */
     inline PerfLog()
         :PerfLog("Epoch")
     {}

+    /** Constructor.
+     * This will create the initial event with the label passed as argument.
+     */
     inline explicit PerfLog(std::string_view initial_label)
     {
         tick(initial_label);
     }

+    /** Adds a new event to the log.
+     * @param[in] label The label associated with the event.
+     */
     void tick(std::string_view label)
     {
         m_log.emplace_back(std::chrono::steady_clock::now(), std::string(label));
     }

+    /** Adds a new event to the log and log the time passed since the last tick to the logger.
+     * @param[in] log_level The log level used for the triggered logging operation.
+     * @param[in] label The label associated with the event.
+     */
     void tick(LogLevel log_level, std::string_view label)
     {
         auto const t0 = m_log.back().t;
@@ -52,6 +70,8 @@
             std::chrono::duration_cast<std::chrono::milliseconds>(m_log.back().t - t0).count() << " ms.");
     }

+    /** Retrieves the event log.
+     */
     Log const& getLog() const
     {
         return m_log;


Apply ncs operator to aniso

Apply ncs operator to aniso

--- include/gemmi/assembly.hpp
+++ include/gemmi/assembly.hpp
@@ -228,8 +228,14 @@
           new_chain.name = namegen.make_new_name(new_chain.name, (int)i+1);

           for (gemmi::Residue& res : new_chain.residues) {
-            for (gemmi::Atom& a : res.atoms)
+            for (gemmi::Atom& a : res.atoms) {
               a.pos = op.apply(a.pos);
+              if (a.aniso.nonzero()) {
+                SMat33<double> u = a.aniso.transformed_by(op.tr.mat);
+                a.aniso = {static_cast<float>(u.u11), static_cast<float>(u.u22), static_cast<float>(u.u33),
+                           static_cast<float>(u.u12), static_cast<float>(u.u13), static_cast<float>(u.u23)};
+              }
+            }
             if (!res.subchain.empty())
               res.subchain = new_chain.name + ":" + res.subchain;
             if (how == HowToNameCopiedChains::Dup)


add export macros

add export macros

git-svn-id: c39a6fcb73c71bf990fd9353909696546eb40440@5334 a83610d8-ad2a-0410-a6ab-fc0612d85776

--- include/libtorrent/rss.hpp
+++ include/libtorrent/rss.hpp
@@ -60,11 +60,11 @@
 	};

 #ifndef BOOST_NO_EXCEPTIONS
-	torrent_handle add_feed_item(session& s, feed_item const& fi
+	torrent_handle TORRENT_EXPORT add_feed_item(session& s, feed_item const& fi
 		, add_torrent_params const& p);
 #endif

-	torrent_handle add_feed_item(session& s, feed_item const& fi
+	torrent_handle TORRENT_EXPORT add_feed_item(session& s, feed_item const& fi
 		, add_torrent_params const& p, error_code& ec);

 	// the feed_settings object is all the information
@@ -106,7 +106,7 @@

 	struct feed;

-	struct feed_handle
+	struct TORRENT_EXPORT feed_handle
 	{
 		feed_handle() {}
 		void update_feed();
@@ -129,7 +129,7 @@
 	// RSS feed. All user interaction with this object
 	// goes through the feed_handle, which makes sure all calls
 	// are posted to the network thread
-	struct feed : boost::enable_shared_from_this<feed>
+	struct TORRENT_EXPORT feed : boost::enable_shared_from_this<feed>
 	{
 		friend void parse_feed(feed_state& f, int token, char const* name, char const* val);


COH-2: WIP using refactored OTProtocolCC API

--- Arduino/COHEAT2015/testBranch20150719/V0p2_Main/Messaging.cpp
+++ Arduino/COHEAT2015/testBranch20150719/V0p2_Main/Messaging.cpp
@@ -1143,8 +1143,8 @@
 #ifdef ALLOW_CC1_SUPPORT_HUB
     case OTRadioLink::FTp2_CC1Alert: // Handle inbound alert message.
       {
-      //OTRadioLink::printRXMsg(p, msg, min(msglen, 8));
-      OTProtocolCC::CC1Alert a = OTProtocolCC::CC1Alert::decodeAlert(msg, msglen);
+      OTProtocolCC::CC1Alert a;
+      a.OTProtocolCC::CC1Alert::decodeSimple(msg, msglen);
       // After decode instance should be valid and with correct house code.
       if(a.isValid())
         {
@@ -1159,6 +1159,14 @@
     case OTRadioLink::FTp2_CC1PollResponse: // Handle inbound poll-response message.
       {
       OTRadioLink::printRXMsg(p, msg, min(msglen, 8));
+      OTProtocolCC::CC1PollResponse a;
+      a.OTProtocolCC::CC1PollResponse::decodeSimple(msg, msglen);
+      // After decode instance should be valid and with correct house code.
+      if(a.isValid())
+        {
+        // Pass message to host to deal with as "! hc1 hc2" after prefix indicating relayed (CC1 alert) message.
+        p->print(F("+CC1 * ")); p->print(a.getHC1()); p->print(' '); p->println(a.getHC2());
+        }
       return;
       }
 #endif
@@ -1167,6 +1175,14 @@
     case OTRadioLink::FTp2_CC1PollAndCmd: // Handle inbound poll/cmd message.
       {
       OTRadioLink::printRXMsg(p, msg, min(msglen, 8));
+      OTProtocolCC::CC1PollAndCmd a;
+      a.OTProtocolCC::CC1PollAndCmd::decodeSimple(msg, msglen);
+      // After decode instance should be valid and with correct house code.
+      if(a.isValid())
+        {
+        // Pass message to host to deal with as "! hc1 hc2" after prefix indicating relayed (CC1 alert) message.
+        p->print(F("+CC1 * ")); p->print(a.getHC1()); p->print(' '); p->println(a.getHC2());
+        }
       return;
       }
 #endif


setting up for mapnik v3.0.0 release

setting up for mapnik v3.0.0 release

--- include/mapnik/version.hpp
+++ include/mapnik/version.hpp
@@ -23,7 +23,7 @@
 #ifndef MAPNIK_VERSION_HPP
 #define MAPNIK_VERSION_HPP

-#define MAPNIK_VERSION_IS_RELEASE 0
+#define MAPNIK_VERSION_IS_RELEASE 1

 #define MAPNIK_MAJOR_VERSION 3
 #define MAPNIK_MINOR_VERSION 0


added limits.h to values.hh so compiles with gcc

--- include/minizinc/values.hh
+++ include/minizinc/values.hh
@@ -20,6 +20,7 @@
 #include <functional>
 #include <vector>
 #include <string>
+#include <limits.h>

 namespace MiniZinc {


add compute as an arithmetic action name

--- include/model/topology.hpp
+++ include/model/topology.hpp
@@ -54,9 +54,9 @@

 // format {timeloop_action_name: [priority list of ERT action names]}
 static std::map <std::string, std::vector<std::string>> arithmeticOperationMappings
-  = {{"random_compute", {"mac_random", "mult_random", "mac", "mult"}},
-     {"skipped_compute", {"mac_skipped", "mult_skipped", "mac_gated", "mult_gated", "mac", "mult"}},
-     {"gated_compute", {"mac_gated", "mult_gated", "mac", "mult"}}
+  = {{"random_compute", {"mac_random", "mult_random", "mac", "mult", "compute"}},
+     {"skipped_compute", {"mac_skipped", "mult_skipped","compute_skipped", "mac_gated", "mult_gated", "compute_gated", "mac", "mult", "compute"}},
+     {"gated_compute", {"mac_gated", "mult_gated", "compute_gated", "mac", "mult", "compute"}}
   };

 static std::map <std::string, std::vector<std::string>> storageOperationMappings


Added help comments for compile error.

Added help comments for compile error.

--- include/msgpack/object.hpp
+++ include/msgpack/object.hpp
@@ -199,6 +199,39 @@
 template <typename T>
 inline void operator<< (object::with_zone& o, const T& v)
 {
+    // If you get a error 'const class your_class has no member named 'msgpack_object',
+    // check the following:
+    // 1. The class your_class should have MSGPACK_DEFINE macro or
+    //
+    // 2. The class your_class should have the following operator declaration and
+    //    definition:
+    //
+    //    namespace msgpack {
+    //    MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
+    //    void operator<< (object::with_zone& o, const your_class& v);
+    //    } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
+    //    } // namespace msgpack
+    //
+    //    See 3.
+    //
+    // 3. #include "msgpack.hpp" too early.
+    //    Replace msgpack.hpp with msgpack_fwd.hpp, then,
+    //    place operator declarations as follows:
+    //
+    //    namespace msgpack {
+    //    MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
+    //    void operator<< (object::with_zone& o, const your_class& v);
+    //    } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
+    //    } // namespace msgpack
+    //
+    //    then, #include "msgpack.hpp", finally place the operator definitions as follows:
+    //
+    //    void operator<< (object::with_zone& o, const your_class& v) {
+    //         // set object attributes using v.
+    //    }
+    //    } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
+    //    } // namespace msgpack
+    //
     v.msgpack_object(static_cast<object*>(&o), o.zone);
 }

@@ -343,6 +376,42 @@
 template <typename T>
 inline object::object(const T& v)
 {
+    // If you get a error 'no matching function call to
+    // operator<<(msgpack::v?::object::object(const T&)
+    // [with T = your_class]'
+    //
+    // check the following:
+    // 1. The class your_class should have MSGPACK_DEFINE macro or
+    //
+    // 2. The class your_class should have the following operator declaration and
+    //    definition:
+    //
+    //    namespace msgpack {
+    //    MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
+    //    void operator<< (object& o, const your_class& v);
+    //    } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
+    //    } // namespace msgpack
+    //
+    //    See 3.
+    //
+    // 3. #include "msgpack.hpp" too early.
+    //    Replace msgpack.hpp with msgpack_fwd.hpp, then,
+    //    place operator declarations as follows:
+    //
+    //    namespace msgpack {
+    //    MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
+    //    void operator<< (object& o, const your_class& v);
+    //    } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
+    //    } // namespace msgpack
+    //
+    //    then, #include "msgpack.hpp", finally place the operator definitions as follows:
+    //
+    //    void operator<< (object& o, const your_class& v) {
+    //         // set object attributes using v.
+    //    }
+    //    } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
+    //    } // namespace msgpack
+    //
     msgpack::operator<<(*this, v);
 }


Added check for already defined NOMINMAX

--- include/msgpack/unpack.hpp
+++ include/msgpack/unpack.hpp
@@ -30,7 +30,9 @@

 #if defined(_MSC_VER)
 // avoiding confliction std::max, std::min, and macro in windows.h
+#ifndef NOMINMAX
 #define NOMINMAX
+#endif
 #endif // defined(_MSC_VER)

 #ifdef _msgpack_atomic_counter_header


Classification should be a Unsigned16, not 8

--- include/pdal/Dimension.hpp
+++ include/pdal/Dimension.hpp
@@ -464,7 +464,7 @@
     case Id::EdgeOfFlightLine:
         return Unsigned8;
     case Id::Classification:
-        return Unsigned8;
+        return Unsigned16;
     case Id::ScanAngleRank:
         return Float;
     case Id::UserData:


Cleanup ctors

Cleanup ctors

--- Core/Sources/Headers/Layer/fully_connected_neural_network.hpp
+++ Core/Sources/Headers/Layer/fully_connected_neural_network.hpp
@@ -25,7 +25,8 @@
 		Matrix::element_t lastActionPotential = 0;
 		std::vector<Connection> connections;

-		Neuron(std::size_t nConnections = 0) { connections.reserve(nConnections); };
+		Neuron() = default;
+		Neuron(std::size_t nConnections) { connections.reserve(nConnections); };

 		auto AddConnection(Connection& connection) -> void {
 			connections.push_back(connection);


fixed sfinae error

fixed sfinae error

--- include/sf2/serializer.hpp
+++ include/sf2/serializer.hpp
@@ -180,7 +180,7 @@

 		public:
 			template<class T>
-			std::enable_if_t<not details::has_save<Writer,T>::value>
+			std::enable_if_t<not details::has_save<Writer,T*>::value>
 			  write_value(const T* inst) {
 				if(inst)
 					write_value(*inst);
@@ -188,7 +188,7 @@
 					writer.write_nullptr();
 			}
 			template<class T>
-			std::enable_if_t<not details::has_save<Writer,T>::value>
+			std::enable_if_t<not details::has_save<Writer,std::unique_ptr<T>>::value>
 			  write_value(const std::unique_ptr<T>& inst) {
 				if(inst)
 					write_value(*inst);
@@ -196,7 +196,7 @@
 					writer.write_nullptr();
 			}
 			template<class T>
-			std::enable_if_t<not details::has_save<Writer,T>::value>
+			std::enable_if_t<not details::has_save<Writer,std::shared_ptr<T>>::value>
 			  write_value(const std::shared_ptr<T>& inst) {
 				if(inst)
 					write_value(*inst);
@@ -376,7 +376,7 @@

 		public:
 			template<class T>
-			std::enable_if_t<not details::has_load<Reader,T>::value>
+			std::enable_if_t<not details::has_load<Reader,std::unique_ptr<T>>::value>
 			  read_value(std::unique_ptr<T>& inst) {
 				if(reader.read_nullptr())
 					inst = nullptr;
@@ -387,7 +387,7 @@
 				}
 			}
 			template<class T>
-			std::enable_if_t<not details::has_load<Reader,T>::value>
+			std::enable_if_t<not details::has_load<Reader,std::shared_ptr<T>>::value>
 			  read_value(std::shared_ptr<T>& inst) {
 				if(reader.read_nullptr())
 					inst = nullptr;


Add full constructor, taking origin and precision. 	modified:   include/sliding_window.hpp

--- include/sliding_window.hpp
+++ include/sliding_window.hpp
@@ -295,6 +295,14 @@
     {
     }

+    template <std::intmax_t Num, std::intmax_t Denom>
+    sliding_window_map(KeyType origin, std::ratio<Num, Denom>)
+        : sliding_buffer_(),
+          precision_(std::ratio<Num, Denom>()),
+          origin_(origin / precision_)
+    {
+    }
+
     std::pair<KeyType, KeyType>
     window() const
     {


Cosmetics

Cosmetics

--- include/vmmlib/frustum.hpp
+++ include/vmmlib/frustum.hpp
@@ -178,12 +178,8 @@
     return *this;
 }

-
-
-template< typename T >
-template< typename U >
-void
-frustum< T >::operator=( const frustum< U >& source_ )
+template< typename T > template< typename U >
+void frustum< T >::operator = ( const frustum< U >& source_ )
 {
     for( size_t index = 0; index < 6; ++index )
     {
@@ -320,8 +316,7 @@
 }

 template < typename T >
-void
-frustum< T >::apply_jitter( const vector< 2, T >& jitter_ )
+void frustum< T >::apply_jitter( const vector< 2, T >& jitter_ )
 {
     left()   = left() + jitter_.x();
     right()  = right() + jitter_.x();
@@ -330,107 +325,73 @@
 }

 template< typename T >
-inline T&
-frustum< T >::left()
+inline T& frustum< T >::left()
 {
     return array[ 0 ];
 }

-
-
-template< typename T >
-inline const T&
-frustum< T >::left() const
+template< typename T >
+inline const T& frustum< T >::left() const
 {
     return array[ 0 ];
 }

-
-
-template< typename T >
-inline T&
-frustum< T >::right()
+template< typename T >
+inline T& frustum< T >::right()
 {
     return array[ 1 ];
 }

-
-
-template< typename T >
-inline const T&
-frustum< T >::right() const
+template< typename T >
+inline const T& frustum< T >::right() const
 {
     return array[ 1 ];
 }

-
-
-template< typename T >
-inline T&
-frustum< T >::bottom()
+template< typename T >
+inline T& frustum< T >::bottom()
 {
     return array[ 2 ];
 }

-
-
-template< typename T >
-inline const T&
-frustum< T >::bottom() const
+template< typename T >
+inline const T& frustum< T >::bottom() const
 {
     return array[ 2 ];
 }

-
-
-template< typename T >
-inline T&
-frustum< T >::top()
+template< typename T >
+inline T& frustum< T >::top()
 {
     return array[ 3 ];
 }

-
-
-template< typename T >
-inline const T&
-frustum< T >::top() const
+template< typename T >
+inline const T& frustum< T >::top() const
 {
     return array[ 3 ];
 }

-
-
-template< typename T >
-inline T&
-frustum< T >::near_plane()
+template< typename T >
+inline T& frustum< T >::near_plane()
 {
     return array[ 4 ];
 }

-
-
-template< typename T >
-inline const T&
-frustum< T >::near_plane() const
+template< typename T >
+inline const T& frustum< T >::near_plane() const
 {
     return array[ 4 ];
 }

-
-
-template< typename T >
-inline T&
-frustum< T >::far_plane()
+template< typename T >
+inline T& frustum< T >::far_plane()
 {
     return array[ 5 ];
 }

-
-
-template< typename T >
-inline const T&
-frustum< T >::far_plane() const
+template< typename T >
+inline const T& frustum< T >::far_plane() const
 {
     return array[ 5 ];
 }


Guard against some unlikely crashes in fsexport.cpp

--- indra/newview/fsexport.cpp
+++ indra/newview/fsexport.cpp
@@ -298,11 +298,11 @@
 		if (LLGridManager::getInstance()->isInOpenSim())
 		{
 			LLViewerRegion* region = gAgent.getRegion();
-			if (region->regionSupportsExport() == LLViewerRegion::EXPORT_ALLOWED)
+			if (region && region->regionSupportsExport() == LLViewerRegion::EXPORT_ALLOWED)
 			{
 				default_prim = !node->mPermissions->allowExportBy(gAgent.getID());
 			}
-			else if (region->regionSupportsExport() == LLViewerRegion::EXPORT_DENIED)
+			else if (region && region->regionSupportsExport() == LLViewerRegion::EXPORT_DENIED)
 			{
 				// Only your own creations if this is explicitly set
 				default_prim = (!(object->permYouOwner()
@@ -766,6 +766,7 @@
 				if (LLGridManager::getInstance()->isInOpenSim())
 				{
 					LLViewerRegion* region = gAgent.getRegion();
+					if (!region) return false;
 					if (region->regionSupportsExport() == LLViewerRegion::EXPORT_ALLOWED)
 					{
 						exportable = (perms.getMaskOwner() & PERM_EXPORT) == PERM_EXPORT;
@@ -817,11 +818,11 @@
 		if (LLGridManager::getInstance()->isInOpenSim())
 		{
 			LLViewerRegion* region = gAgent.getRegion();
-			if (region->regionSupportsExport() == LLViewerRegion::EXPORT_ALLOWED)
+			if (region && region->regionSupportsExport() == LLViewerRegion::EXPORT_ALLOWED)
 			{
 				exportable = (perms.getMaskOwner() & PERM_EXPORT) == PERM_EXPORT;
 			}
-			else if (region->regionSupportsExport() == LLViewerRegion::EXPORT_DENIED)
+			else if (region && region->regionSupportsExport() == LLViewerRegion::EXPORT_DENIED)
 			{
 				exportable = perms.getCreator() == gAgentID;
 			}


Removed a spamming cout

Removed a spamming cout

--- Doremi/Core/Source/Manager/FrequencyAffectedObjectManager.cpp
+++ Doremi/Core/Source/Manager/FrequencyAffectedObjectManager.cpp
@@ -42,7 +42,6 @@
                 // Get the players current frequency
                 float t_currentFrequency = playerID->second->m_frequencyBufferHandler->GetFrequencyForFrame() / 1000.0f;
                 t_currentFrequency = std::min(t_currentFrequency, 1.0f);
-                std::cout << t_currentFrequency << endl;
                 // Loop through all entities
                 const size_t length = EntityHandler::GetInstance().GetLastEntityIndex();
                 // Loop over all entities to perform various functions on enteties that have sound components


added serial number checks

added serial number checks

--- src/algo/camera-age/l500/camera-age.cpp
+++ src/algo/camera-age/l500/camera-age.cpp
@@ -44,15 +44,24 @@
 // XXXX  Sequential number
 work_week get_manufature_work_week( const std::string & serial )
 {
+    if( serial.size() != 8 )
+        throw invalid_value_exception( "invalid serial number: " + serial + " is of invalid size" );
     unsigned Y = serial[1] - '0';  // Converts char to int, '0'-> 0, '1'-> 1, ...
     unsigned man_year = 0;
     // using Y from serial number to get manufactoring year
     if( Y == 9 )
         man_year = 2019;
+    else if( Y >= 0 && Y <= 8 )
+        man_year = 2020 + Y;
     else
-        man_year = 2020 + Y;
+        throw invalid_value_exception( "invalid serial number: " + serial + " has invalid year" );
     // using WW from serial number to get manufactoring work week
-    unsigned man_ww = ( ( serial[2] - '0' ) * 10 ) + ( serial[3] - '0' );
+    unsigned WW_tens = serial[2] - '0';
+    unsigned WW_singles = serial[3] - '0';
+    if( WW_tens > 9 || WW_tens < 0 || WW_singles > 9 || WW_singles < 0 )
+        throw invalid_value_exception( "invalid serial number: " + serial
+                                       + " has invalid work week" );
+    unsigned man_ww = ( (WW_tens)*10 ) + WW_singles;
     return work_week( man_year, man_ww );
 }


cleanup and respect log for humans

cleanup and respect log for humans

--- src/app/contextBroker/contextBroker.cpp
+++ src/app/contextBroker/contextBroker.cpp
@@ -957,17 +957,18 @@
     paConfig("log to screen",                 (void*) true);
   }

-  if (paIsSet(argC, argV, "-logForHumans"))
-  {
-    paConfig("screen line format", (void*) "TYPE@TIME  FILE[LINE]: TEXT");
-  }
-  else
-  {
-    paConfig("screen line format", LOG_FILE_LINE_FORMAT);
-  }
-
   paParse(paArgs, argC, (char**) argV, 1, false);
   lmTimeFormat(0, (char*) "%Y-%m-%dT%H:%M:%S");
+
+  if (logForHumans)
+  {
+    paConfig("screen line format", (void*) "TYPE@TIME  FILE[LINE]: TEXT");
+  }
+  else
+  {
+    paConfig("screen line format", LOG_FILE_LINE_FORMAT);
+  }
+

   //
   // disable file logging if the corresponding option is set.


FIXED a possible memory corruption error when accessing server sockets in the logonserver, caused by a race condition. Added by me a year ago. Reverted the change. No clue why I made this change back then, there doesn't seem to be anything wrong with it now.

--- src/arcemu-logonserver/AccountCache.cpp
+++ src/arcemu-logonserver/AccountCache.cpp
@@ -559,51 +559,29 @@
 	if(!usepings)
 		return;

-	std::list< LogonCommServerSocket* > slist;    // list where we will store the timed out sockets
-	set<LogonCommServerSocket*>::iterator itr;
 	uint32 now = uint32( time(NULL) );
-
-	slist.clear();

 	/* burlex: this is vulnerable to race conditions, adding a mutex to it. */
 	serverSocketLock.Acquire();

-	for( itr = m_serverSockets.begin(); itr != m_serverSockets.end(); ++itr )
-	{
+	for( set< LogonCommServerSocket* >::iterator itr = m_serverSockets.begin(); itr != m_serverSockets.end(); ){
 		LogonCommServerSocket *s = *itr;
-
-		// check for timeout and add the timed out sockets to the list
-		if( s->last_ping < now && ( (now - s->last_ping) > 300) )
-			slist.push_back( s );
-
-	}
-
-	serverSocketLock.Release();
-
-	if( slist.size() > 0 ){
-		sLog.outDebug("Closing %lu socket(s) because of ping timeout.", slist.size() );
-
-		std::list< LogonCommServerSocket* >::iterator SockITR;
-
-		// iterate over the list and close and get rid of the sockets
-		for( SockITR = slist.begin(); SockITR != slist.end(); ++SockITR ){
+		++itr;
+
+		if( s->last_ping < now && ( (now - s->last_ping) > 300) ){
+			for( set< uint32 >::iterator RealmITR = s->server_ids.begin(); RealmITR != s->server_ids.end(); ++RealmITR ){
+				uint32 RealmID = *RealmITR;
+
+				RemoveRealm( RealmID );
+			}

-			LogonCommServerSocket *s = *SockITR;
-			set<uint32>::iterator RealmITR;
-
-			// Removing the realms that are associated with this server from the realmlist
-			for( RealmITR = s->server_ids.begin(); RealmITR != s->server_ids.end(); ++RealmITR ){
-				RemoveRealm( *RealmITR );
-			}
-
 			s->removed = true;
 			m_serverSockets.erase( s );
 			s->Disconnect();
-
-		}
-	}
-
-	slist.clear();
+		}
+	}
+
+	serverSocketLock.Release();
 }

 void InformationCore::CheckServers()


RPC: Must interpolate if at a non-integer location

--- src/asp/Sessions/RPC/RPCMapTransform.cc
+++ src/asp/Sessions/RPC/RPCMapTransform.cc
@@ -56,10 +56,16 @@
   vw::Vector2
   RPCMapTransform::reverse(const vw::Vector2 &p) const {

+    // If possible, we will interpolate into the cached point cloud
+    ImageViewRef<Vector3> interp_point_cloud =
+      interpolate(m_point_cloud_cache, BicubicInterpolation(), ZeroEdgeExtension());
+
+    BBox2i shrank_bbox = m_cache_size;
+    shrank_bbox.expand(-BicubicInterpolation::pixel_buffer); // Avoid interpolating close to edges
     Vector3 xyz =
-      m_cache_size.contains( p ) ?
-      m_point_cloud_cache(p.x() - m_cache_size.min().x(),
-                          p.y() - m_cache_size.min().y()):
+      shrank_bbox.contains( p ) ?
+      interp_point_cloud(p.x() - m_cache_size.min().x(),
+                         p.y() - m_cache_size.min().y()):
       m_point_cloud(p.x(),p.y());

     return m_rpc.point_to_pixel(xyz);
@@ -77,7 +83,8 @@

   void
   RPCMapTransform::cache_dem( vw::BBox2i const& bbox ) const {
-    m_point_cloud_cache = crop( m_point_cloud, bbox );
     m_cache_size = bbox;
+    m_cache_size.expand(BicubicInterpolation::pixel_buffer); // For bicubic interpolation later
+    m_point_cloud_cache = crop( m_point_cloud, m_cache_size );
   }
 }


Fix hang running NoEnumerateBeforeBoltReturn in valgrind

--- src/autowiring/test/CoreContextTest.cpp
+++ src/autowiring/test/CoreContextTest.cpp
@@ -201,9 +201,11 @@
   });

   // Verify that the context does not appear until the bolt has finished running:
-  while(!*finished)
+  while(!*finished) {
     for(auto cur : ContextEnumeratorT<NoEnumerateBeforeBoltReturn>(ctxt))
       ASSERT_TRUE(longTime->m_bDoneRunning) << "A context was enumerated before a bolt finished running";
+    AutoRequired<CoreThread>()->WaitForEvent(std::chrono::milliseconds(100));
+  }

   // Need to block until this thread is done
   t.join();


fix exception being thrown when no arguments are passed

--- samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
+++ samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
@@ -16,6 +16,7 @@
     const std::string windowName = "Hough Circle Detection Demo";
     const std::string cannyThresholdTrackbarName = "Canny threshold";
     const std::string accumulatorThresholdTrackbarName = "Accumulator Threshold";
+    const std::string usage = "Usage : tutorial_HoughCircle_Demo <path_to_input_image>\n";

     // initial and max values of the parameters of interests.
     const int cannyThresholdInitialValue = 200;
@@ -48,9 +49,16 @@
 }

-int main(int, char** argv)
+int main(int argc, char** argv)
 {
     Mat src, src_gray;
+
+    if (argc < 2)
+    {
+        std::cerr<<"No input image specified\n";
+        std::cout<<usage;
+        return -1;
+    }

     // Read the image
     src = imread( argv[1], 1 );
@@ -58,7 +66,7 @@
     if( !src.data )
     {
         std::cerr<<"Invalid input image\n";
-        std::cout<<"Usage : tutorial_HoughCircle_Demo <path_to_input_image>\n";
+        std::cout<<usage;
         return -1;
     }


ghOSt: Add latch info to TASK_PREEMPT message string

--- lib/channel.cc
+++ lib/channel.cc
@@ -182,6 +182,7 @@
       const ghost_msg_payload_task_preempt* preempt =
           static_cast<const ghost_msg_payload_task_preempt*>(payload());
       absl::StrAppend(&result, " on cpu ", preempt->cpu);
+      if (preempt->was_latched) absl::StrAppend(&result, " (was_latched)");
       if (preempt->from_switchto) absl::StrAppend(&result, " (from_switchto)");
       break;
     }


INTEGRATION: CWS impress51 (1.6.90); FILE MERGED 2005/05/04 14:30:01 af 1.6.90.1: #i48703# Added support for focus change listeners.

--- sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: SlsFocusManager.cxx,v $
  *
- *  $Revision: 1.6 $
- *
- *  last change: $Author: vg $ $Date: 2005-02-17 10:04:57 $
+ *  $Revision: 1.7 $
+ *
+ *  last change: $Author: kz $ $Date: 2005-07-14 10:16:10 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -283,6 +283,45 @@
                 view::SlideSorterView::BBT_INFO));

         mrController.GetView().RequestRepaint (*pDescriptor);
+        NotifyFocusChangeListeners();
+    }
+}
+
+
+
+
+void FocusManager::AddFocusChangeListener (const Link& rListener)
+{
+    if (::std::find (maFocusChangeListeners.begin(), maFocusChangeListeners.end(), rListener)
+        == maFocusChangeListeners.end())
+    {
+        maFocusChangeListeners.push_back (rListener);
+    }
+}
+
+
+
+
+void FocusManager::RemoveFocusChangeListener (const Link& rListener)
+{
+    maFocusChangeListeners.erase (
+        ::std::find (maFocusChangeListeners.begin(), maFocusChangeListeners.end(), rListener));
+}
+
+
+
+
+void FocusManager::NotifyFocusChangeListeners (void) const
+{
+    // Create a copy of the listener list to be safe when that is modified.
+    ::std::vector<Link> aListeners (maFocusChangeListeners);
+
+    // Tell the slection change listeners that the selection has changed.
+    ::std::vector<Link>::iterator iListener (aListeners.begin());
+    ::std::vector<Link>::iterator iEnd (aListeners.end());
+    for (; iListener!=iEnd; ++iListener)
+    {
+        iListener->Call(NULL);
     }
 }


#i88114# accessibility fix

#i88114# accessibility fix

--- sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: SlideSorterViewShell.cxx,v $
  *
- *  $Revision: 1.30 $
- *
- *  last change: $Author: kz $ $Date: 2008-04-03 14:43:11 $
+ *  $Revision: 1.31 $
+ *
+ *  last change: $Author: kz $ $Date: 2008-04-10 11:32:16 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -266,6 +266,12 @@
     SlideSorterViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
 {
     OSL_ASSERT(mpSlideSorter.get()!=NULL);
+
+    // When the view is not set then the initialization is not yet complete
+    // and we can not yet provide an accessibility object.
+    if (mpView == NULL)
+        return NULL;
+
     return new ::accessibility::AccessibleSlideSorterView (
         *mpSlideSorter.get(),
         pWindow->GetAccessibleParentWindow()->GetAccessible(),


Fix compiler warnings for latest cuda npp which defines this itself as:
```
#define NPP_VER_MAJOR 10
#define NPP_VER_MINOR 2
#define NPP_VER_PATCH 0
#define NPP_VER_BUILD 243

#define NPP_VERSION (NPP_VER_MAJOR * 1000 +     \
                     NPP_VER_MINOR *  100 +     \
                     NPP_VER_PATCH)

--- modules/core/include/opencv2/core/private.cuda.hpp
+++ modules/core/include/opencv2/core/private.cuda.hpp
@@ -72,7 +72,9 @@
 #  include "opencv2/core/cuda_stream_accessor.hpp"
 #  include "opencv2/core/cuda/common.hpp"

+# ifndef NPP_VERSION
 #  define NPP_VERSION (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD)
+# endif

 #  define CUDART_MINIMUM_REQUIRED_VERSION 6050


fixed type comparison warning in rtk planner.

--- modules/planning/planner/rtk/rtk_replay_planner.cc
+++ modules/planning/planner/rtk/rtk_replay_planner.cc
@@ -71,7 +71,8 @@
   // check if the trajectory has enough points;
   // if not, append the last points multiple times and
   // adjust their corresponding time stamps.
-  while (trajectory_points->size() < FLAGS_rtk_trajectory_forward) {
+  while (trajectory_points->size() <
+         static_cast<int64_t>(FLAGS_rtk_trajectory_forward)) {
     const auto& last_point = *trajectory_points->rbegin();
     auto* new_point = trajectory_points->Add();
     *new_point = last_point;


r5983/sofa-dev : FIX: pb on skinningMapping and HexahedronGeodesicalDistance

 //partial sync (1/3 changes)//

--- modules/sofa/component/mapping/SkinningMapping.inl
+++ modules/sofa/component/mapping/SkinningMapping.inl
@@ -72,9 +72,9 @@
     , repartition ( initData ( &repartition,"repartition","repartition between input DOFs and skinned vertices" ) )
     , coefs ( initData ( &coefs,"coefs","weights list for the influences of the references Dofs" ) )
     , nbRefs ( initData ( &nbRefs, ( unsigned ) 3,"nbRefs","nb references for skinning" ) )
-    , displayBlendedFrame ( initData ( &displayBlendedFrame,"1", "displayBlendedFrame","weights list for the influences of the references Dofs" ) )
-    , computeJ ( initData ( &computeJ, "0", "computeJ","compute matrix J in addition to apply for the dual quat interpolation method." ) )
-    , computeAllMatrices ( initData ( &computeAllMatrices, "0", "computeAllMatrices","compute all the matrices in addition to apply for the dual quat interpolation method." ) )
+    , displayBlendedFrame ( initData ( &displayBlendedFrame, true, "displayBlendedFrame","weights list for the influences of the references Dofs" ) )
+    , computeJ ( initData ( &computeJ, false, "computeJ", "compute matrix J in addition to apply for the dual quat interpolation method." ) )
+    , computeAllMatrices ( initData ( &computeAllMatrices, false, "computeAllMatrices","compute all the matrices in addition to apply for the dual quat interpolation method." ) )
     , computeWeights ( true )
     , wheighting ( WEIGHT_INVDIST_SQUARE )
     , interpolation ( INTERPOLATION_DUAL_QUATERNION )
@@ -537,10 +537,12 @@
         this->J.resize ( nbDOF );
         this->B.resize ( nbDOF );
         this->A.resize( nbP);
+        this->ddet.resize( nbDOF);
         for ( i=0; i<nbDOF; i++ )
         {
             this->J[i].resize ( nbP );
             this->B[i].resize ( nbP );
+            this->ddet[i].resize( nbP);
         }

         //apply
@@ -1022,7 +1024,7 @@
 #ifdef SOFA_DEV
     case INTERPOLATION_DUAL_QUATERNION:
     {
-        serr << "applyJT on VecConst is not implemented for dual quat." << sendl;
+        //serr << "applyJT on VecConst is not implemented for dual quat." << sendl;
         break;
     }
 #endif


In connect_clients thread: - don't wait an extra 400ms before retrying a transporter connect if the port is dynamic

--- ndb/src/common/transporter/TransporterRegistry.cpp
+++ ndb/src/common/transporter/TransporterRegistry.cpp
@@ -1221,14 +1221,11 @@

 	  if (result<0 && t->get_s_port()!=0)
-	  {
 	    ndbout_c("Error while trying to make connection (Node %u to"
 		     " %u via port %u) error: %d. Retrying...",
 		     t->getRemoteNodeId(),
 		     t->getLocalNodeId(),
 		     t->get_s_port());
-	    NdbSleep_MilliSleep(400); // wait before retrying
-	  }

 	  /**
 	   * If dynamic, get the port for connecting from the management server


Changed mind: not binding Allegro, it's C already - moving to extras


bitWriter: don't return false when overflow

Just report a warning instead of return false when overflow.
It should be allowed to pass a large value and write some lower bits.
It is better than no thing is written into bitstream and the whole
bitstream can not be decoded.
This patch can fix the invaild frame issue reported by
https://github.com/01org/libyami/issues/670.

Signed-off-by: Zhong Li <ad6bffae321e88d39f25028f12e29bb1c91acd98@intel.com>

--- codecparsers/bitWriter.cpp
+++ codecparsers/bitWriter.cpp
@@ -71,8 +71,7 @@
 bool BitWriter::writeBits(uint32_t value, uint32_t numBits)
 {
     if (value >= (uint64_t)1 << numBits) {
-        ERROR("Write Bits Error: value overflow");
-        return false;
+        WARNING("Write Bits: value overflow");
     }

     ASSERT((m_bitsInCache <= CACHEBITS) && (numBits <= CACHEBITS));


Get rid of TruthValueType

Get rid of TruthValueType

--- opencog/persist/sql/multi-driver/SQLAtomStorage.cc
+++ opencog/persist/sql/multi-driver/SQLAtomStorage.cc
@@ -907,33 +907,29 @@

 	// Store the truth value
 	TruthValuePtr tv(h->getTruthValue());
-	TruthValueType tvt = NULL_TRUTH_VALUE;
+	Type tvt = 0;
 	if (tv) tvt = tv->getType();
 	STMTI("tv_type", tvt);

-	switch (tvt)
-	{
-		case NULL_TRUTH_VALUE:
-			break;
-		case SIMPLE_TRUTH_VALUE:
-		case COUNT_TRUTH_VALUE:
-		case PROBABILISTIC_TRUTH_VALUE:
-			STMTF("stv_mean", tv->getMean());
-			STMTF("stv_confidence", tv->getConfidence());
-			STMTF("stv_count", tv->getCount());
-			break;
-		case INDEFINITE_TRUTH_VALUE:
-		{
-			IndefiniteTruthValuePtr itv = std::static_pointer_cast<const IndefiniteTruthValue>(tv);
-			STMTF("stv_mean", itv->getL());
-			STMTF("stv_count", itv->getU());
-			STMTF("stv_confidence", itv->getConfidenceLevel());
-			break;
-		}
-		default:
-			throw IOException(TRACE_INFO,
-				"Error: store_single: Unknown truth value type\n");
-	}
+	if (SIMPLE_TRUTH_VALUE == tvt ||
+	    COUNT_TRUTH_VALUE == tvt ||
+	    PROBABILISTIC_TRUTH_VALUE == tvt)
+	{
+		STMTF("stv_mean", tv->getMean());
+		STMTF("stv_confidence", tv->getConfidence());
+		STMTF("stv_count", tv->getCount());
+	}
+	else
+	if (INDEFINITE_TRUTH_VALUE == tvt)
+	{
+		IndefiniteTruthValuePtr itv = std::dynamic_pointer_cast<const IndefiniteTruthValue>(tv);
+		STMTF("stv_mean", itv->getL());
+		STMTF("stv_count", itv->getU());
+		STMTF("stv_confidence", itv->getConfidenceLevel());
+	}
+	else
+		throw IOException(TRACE_INFO,
+			"Error: store_single: Unknown truth value type\n");

 	// We may have to store the atom table UUID and try again...
 	// We waste CPU cycles to store the atomtable, only if it failed.


minor change in new analyzer.

minor change in new analyzer.

--- compiler/src/analyzer2.cpp
+++ compiler/src/analyzer2.cpp
@@ -1,9 +1,6 @@
 #include "clay.hpp"

 namespace two {
-
-PValuePtr staticPValue(ObjectPtr x);
-PValuePtr kernelPValue(const string &name);

 MultiPValuePtr analyzeMulti(const vector<ExprPtr> &exprs, EnvPtr env);
 PValuePtr analyzeOne(ExprPtr expr, EnvPtr env);
@@ -32,13 +29,13 @@
 // staticPValue, kernelPValue
 //

-PValuePtr staticPValue(ObjectPtr x)
+static PValuePtr staticPValue(ObjectPtr x)
 {
     TypePtr t = staticType(x);
     return new PValue(t, true);
 }

-PValuePtr kernelPValue(const string &name)
+static PValuePtr kernelPValue(const string &name)
 {
     return staticPValue(kernelName(name));
 }


Fix grabSingleCloud bug

Fix grabSingleCloud bug

--- io/src/ensenso_grabber.cpp
+++ io/src/ensenso_grabber.cpp
@@ -312,7 +312,7 @@
     double timestamp;
     std::vector<float> pointMap;
     int width, height;
-    camera_[itmImages][itmRaw].getBinaryDataInfo (0, 0, 0, 0, 0, &timestamp);  // Get raw image timestamp
+    camera_[itmImages][itmRaw][itmLeft].getBinaryDataInfo (0, 0, 0, 0, 0, &timestamp);  // Get raw image timestamp
     camera_[itmImages][itmPointMap].getBinaryDataInfo (&width, &height, 0, 0, 0, 0);
     camera_[itmImages][itmPointMap].getBinaryData (pointMap, 0);


some fixes

some fixes

--- swap.hpp
+++ swap.hpp
@@ -2,6 +2,8 @@
 # define GENERIC_SWAP_HPP

 #include <cstdint>
+
+#include <type_traits>

 #if defined(_MSC_VER)
 # include <stdlib.h>
@@ -133,7 +135,7 @@

 #endif

-#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || \
     defined(__BIG_ENDIAN__) || \
     defined(__ARMEB__) || \
     defined(__THUMBEB__) || \
@@ -160,7 +162,7 @@
   return swap(i);
 }

-#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
+#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || \
     defined(__LITTLE_ENDIAN__) || \
     defined(__ARMEL__) || \
     defined(__THUMBEL__) || \


Better header includes for sockets

Better header includes for sockets

--- lib/socket.cpp
+++ lib/socket.cpp
@@ -6,14 +6,12 @@
 #include "timing.h"
 #include "defines.h"
 #include <sys/stat.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 #include <poll.h>
 #include <netdb.h>
 #include <sstream>
 #include <cstdlib>
-
-#ifdef __FreeBSD__
-#include <netinet/in.h>
-#endif

 #define BUFFER_BLOCKSIZE 4096 //set buffer blocksize to 4KiB


Only sockets can be shut down.

Only sockets can be shut down.

--- lib/socket.cpp
+++ lib/socket.cpp
@@ -83,12 +83,10 @@
       sock = -1;
     }
     if (pipes[0] != -1){
-      shutdown(pipes[0], SHUT_RDWR);
       ::close(pipes[0]);
       pipes[0] = -1;
     }
     if (pipes[1] != -1){
-      shutdown(pipes[1], SHUT_RDWR);
       ::close(pipes[1]);
       pipes[1] = -1;
     }


Added testsuite for non-default-constructible type

--- test.cpp
+++ test.cpp
@@ -148,6 +148,31 @@
     BOOST_CHECK_EQUAL(a[4], 9);
 }

+struct NonDefaultConstructible
+{
+    int i;
+
+    NonDefaultConstructible( int i_ )
+        : i( i_ ) {}
+
+    friend bool operator<( NonDefaultConstructible const& x, NonDefaultConstructible const& y ) {
+        return x.i < y.i;
+    }
+
+};
+
+BOOST_AUTO_TEST_CASE( non_default_constructible ) {
+    NonDefaultConstructible a[] = { 7, 1, 5, 3, 9 };
+
+    timsort(a, a + sizeof(a) / sizeof(a[0]), std::less<NonDefaultConstructible>());
+
+    BOOST_CHECK_EQUAL(a[0].i, 1);
+    BOOST_CHECK_EQUAL(a[1].i, 3);
+    BOOST_CHECK_EQUAL(a[2].i, 5);
+    BOOST_CHECK_EQUAL(a[3].i, 7);
+    BOOST_CHECK_EQUAL(a[4].i, 9);
+}
+
 enum id { foo, bar, baz };
 typedef std::pair<int, id> pair_t;
 bool less_in_first(pair_t x, pair_t y) {


added test

added test

--- test.cpp
+++ test.cpp
@@ -26,9 +26,19 @@
     PASS();
 }

+TEST simple_task_parse_with_wrong_priority(void) {
+    TodotxtTask task = todotxt_parse_task("(a) this is a very important task", 1);
+    ASSERT_EQ(task.id, 1);
+    ASSERT_EQ(task.finished, false);
+    ASSERT_STR_EQ(task.raw_todo, "(a) this is a very important task");
+    ASSERT_FALSE(task.priority == 'a');
+    PASS();
+}
+
 SUITE(suite) {
     RUN_TEST(simple_task_parse);
     RUN_TEST(simple_task_parse_with_priority);
+    RUN_TEST(simple_task_parse_with_wrong_priority);
 }

 GREATEST_MAIN_DEFS();


added priority to other tests

added priority to other tests

--- test.cpp
+++ test.cpp
@@ -16,6 +16,8 @@
     ASSERT_STR_EQ(task.raw_todo, "this is an important task");
     ASSERT_STR_EQ(task.todo, "this is an important task");

+    ASSERT_EQ(task.priority, '^');
+
     delete task.raw_todo;
     delete task.todo;

@@ -28,6 +30,8 @@
     ASSERT_EQ(task.finished, true);
     ASSERT_STR_EQ(task.raw_todo, "x this is an important task");
     ASSERT_STR_EQ(task.todo, "this is an important task");
+
+    ASSERT_EQ(task.priority, '^');

     delete task.raw_todo;
     delete task.todo;


Add empty test file.

Add empty test file.


Update light_node.cpp

Update light_node.cpp

Bug fix: whitelist to suppress `state.bri` for on/off plugs with _Level_ cluster was ignored.  See #1444.

--- light_node.cpp
+++ light_node.cpp
@@ -360,6 +360,7 @@
                     if ((manufacturerCode() == VENDOR_IKEA && endpoint.deviceId() == DEV_ID_Z30_ONOFF_PLUGIN_UNIT) || // IKEA Tradfri control outlet
                         (manufacturerCode() == VENDOR_INNR && endpoint.deviceId() == DEV_ID_ZLL_ONOFF_PLUGIN_UNIT)) // innr SP120 smart plug
                     { } // skip state.bri not supported
+                    else
                     {
                         addItem(DataTypeUInt8, RStateBri);
                     }


tuned thresholds & limited areas of interest

--- lineFitter.cpp
+++ lineFitter.cpp
@@ -88,10 +88,10 @@
 		for(int i=0; i<color.rows; i++){
 			for(int j=0; j<color.cols; j++){
 				pixel = color.at<Vec3b>(Point(j,i));
-				if( (pixel[0] > 9 && pixel[0] < 25) && (pixel[1] > 0 && pixel[1] < 169) && (pixel[2] > 169 && pixel[2] < 255)){
+				if( j < color.cols && i > color.rows /3 && (pixel[0] > 9 && pixel[0] < 25) && (pixel[1] > 0 && pixel[1] < 169) && (pixel[2] > 169 && pixel[2] < 255)){
 					pointsC.push_back(Point(j, i));
 				}
-				if( (pixel[0] > 36 && pixel[0] < 85) && (pixel[1] > 5 && pixel[1] < 255) && (pixel[2] >208 && pixel[2] <255)){
+				if( j > color.cols / 2 && i > color.rows/3 && (pixel[0] > 28 && pixel[0] < 109) && (pixel[1] > 1 && pixel[1] < 23) && (pixel[2] >200 && pixel[2] <255)){
 					pointsE.push_back(Point(j, i));
 				}
 			}
@@ -102,7 +102,7 @@
                 }

 		for(int k=0; k<pointsE.size(); k++){
-			circle(frame, pointsE[k], 1, Scalar(0, 0, 255), -1, CV_AA, 0);
+			circle(frame, pointsE[k], 1, Scalar(255, 0, 255), -1, CV_AA, 0);
 		}

 		double m = max(color.rows, color.cols);
@@ -144,13 +144,13 @@
 		Cp2.y = outLineC[3] + m*outLineC[1];

 		Ep1.x = outLineE[2] - m*outLineE[0];
-		Ep1.y = outLineE[2] - m*outLineE[1];
-		Ep1.x = outLineE[2] - m*outLineE[0];
-		Ep1.y = outLineE[2] - m*outLineE[1];
+		Ep1.y = outLineE[3] - m*outLineE[1];
+		Ep2.x = outLineE[2] + m*outLineE[0];
+		Ep2.y = outLineE[3] + m*outLineE[1];

-		line(frame, Cp1, Cp2, Scalar(0, 255, 0), 3, CV_AA, 0);
-		line(frame, Ep1, Ep2, Scalar(255, 0, 255), 3, CV_AA,0);
+		line(frame, Cp1, Cp2, Scalar(0, 0, 255), 3, CV_AA, 0);
+		line(frame, Ep1, Ep2, Scalar( 0, 255,0 ), 3, CV_AA,0);

 		out.write(frame);


NodeElement: Объекты перестали разъезжаться, но переодически прыгают при растяжении.

--- unreal/branches/antons_node_resize_branch/qrgui/umllib/uml_nodeelement.cpp
+++ unreal/branches/antons_node_resize_branch/qrgui/umllib/uml_nodeelement.cpp
@@ -131,7 +131,11 @@
 		}
 	}

+	/*
+	newContents.moveTo(0, 0);
 	newContents.translate(pos());
+	*/
+	newContents.moveTo(pos());

 	if (!((newContents.width() < OBJECT_MIN_SIZE) || (newContents.height() < OBJECT_MIN_SIZE)))
 		setGeometry(newContents);