Kaydet (Commit) 335978eb authored tarafından Kohei Yoshida's avatar Kohei Yoshida

A little cleanup. Derive block types from multi_type_matrix.

Rather than directly using the blocks from mtv.

Change-Id: I215e38ad406f8edc5d15c9f011dde649fce1d671
üst 10ccf6ac
...@@ -1057,8 +1057,10 @@ public: ...@@ -1057,8 +1057,10 @@ public:
{ {
case mdds::mtm::element_numeric: case mdds::mtm::element_numeric:
{ {
mdds::mtv::numeric_element_block::const_iterator it = mdds::mtv::numeric_element_block::begin(*node.data); typedef MatrixImplType::numeric_block_type block_type;
mdds::mtv::numeric_element_block::const_iterator itEnd = mdds::mtv::numeric_element_block::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it) for (; it != itEnd; ++it)
{ {
if (mbFirst) if (mbFirst)
...@@ -1074,8 +1076,10 @@ public: ...@@ -1074,8 +1076,10 @@ public:
break; break;
case mdds::mtm::element_boolean: case mdds::mtm::element_boolean:
{ {
mdds::mtv::boolean_element_block::const_iterator it = mdds::mtv::boolean_element_block::begin(*node.data); typedef MatrixImplType::boolean_block_type block_type;
mdds::mtv::boolean_element_block::const_iterator itEnd = mdds::mtv::boolean_element_block::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it) for (; it != itEnd; ++it)
{ {
if (mbFirst) if (mbFirst)
...@@ -1177,8 +1181,10 @@ size_t WalkAndMatchElements<double>::compare(const MatrixImplType::element_block ...@@ -1177,8 +1181,10 @@ size_t WalkAndMatchElements<double>::compare(const MatrixImplType::element_block
{ {
case mdds::mtm::element_numeric: case mdds::mtm::element_numeric:
{ {
MatrixImplType::numeric_block_type::const_iterator it = MatrixImplType::numeric_block_type::begin(*node.data); typedef MatrixImplType::numeric_block_type block_type;
MatrixImplType::numeric_block_type::const_iterator itEnd = MatrixImplType::numeric_block_type::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it, nCount++) for (; it != itEnd; ++it, nCount++)
{ {
if (*it == maMatchValue) if (*it == maMatchValue)
...@@ -1190,8 +1196,10 @@ size_t WalkAndMatchElements<double>::compare(const MatrixImplType::element_block ...@@ -1190,8 +1196,10 @@ size_t WalkAndMatchElements<double>::compare(const MatrixImplType::element_block
} }
case mdds::mtm::element_boolean: case mdds::mtm::element_boolean:
{ {
MatrixImplType::boolean_block_type::const_iterator it = MatrixImplType::boolean_block_type::begin(*node.data); typedef MatrixImplType::boolean_block_type block_type;
MatrixImplType::boolean_block_type::const_iterator itEnd = MatrixImplType::boolean_block_type::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it, ++nCount) for (; it != itEnd; ++it, ++nCount)
{ {
if (int(*it) == maMatchValue) if (int(*it) == maMatchValue)
...@@ -1218,8 +1226,10 @@ size_t WalkAndMatchElements<svl::SharedString>::compare(const MatrixImplType::el ...@@ -1218,8 +1226,10 @@ size_t WalkAndMatchElements<svl::SharedString>::compare(const MatrixImplType::el
{ {
case mdds::mtm::element_string: case mdds::mtm::element_string:
{ {
MatrixImplType::string_block_type::const_iterator it = MatrixImplType::string_block_type::begin(*node.data); typedef MatrixImplType::string_block_type block_type;
MatrixImplType::string_block_type::const_iterator itEnd = MatrixImplType::string_block_type::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it, ++nCount) for (; it != itEnd; ++it, ++nCount)
{ {
if (it->getDataIgnoreCase() == maMatchValue.getDataIgnoreCase()) if (it->getDataIgnoreCase() == maMatchValue.getDataIgnoreCase())
...@@ -1247,8 +1257,8 @@ struct MaxOp ...@@ -1247,8 +1257,8 @@ struct MaxOp
} }
static double boolValue( static double boolValue(
mdds::mtv::boolean_element_block::const_iterator it, MatrixImplType::boolean_block_type::const_iterator it,
mdds::mtv::boolean_element_block::const_iterator itEnd) MatrixImplType::boolean_block_type::const_iterator itEnd)
{ {
// If the array has at least one true value, the maximum value is 1. // If the array has at least one true value, the maximum value is 1.
it = std::find(it, itEnd, true); it = std::find(it, itEnd, true);
...@@ -1265,8 +1275,8 @@ struct MinOp ...@@ -1265,8 +1275,8 @@ struct MinOp
} }
static double boolValue( static double boolValue(
mdds::mtv::boolean_element_block::const_iterator it, MatrixImplType::boolean_block_type::const_iterator it,
mdds::mtv::boolean_element_block::const_iterator itEnd) MatrixImplType::boolean_block_type::const_iterator itEnd)
{ {
// If the array has at least one false value, the minimum value is 0. // If the array has at least one false value, the minimum value is 0.
it = std::find(it, itEnd, false); it = std::find(it, itEnd, false);
...@@ -1288,22 +1298,25 @@ public: ...@@ -1288,22 +1298,25 @@ public:
void operator() (const MatrixImplType::element_block_node_type& node) void operator() (const MatrixImplType::element_block_node_type& node)
{ {
using namespace mdds::mtv;
switch (node.type) switch (node.type)
{ {
case mdds::mtm::element_numeric: case mdds::mtm::element_numeric:
{ {
numeric_element_block::const_iterator it = numeric_element_block::begin(*node.data); typedef MatrixImplType::numeric_block_type block_type;
numeric_element_block::const_iterator itEnd = numeric_element_block::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it) for (; it != itEnd; ++it)
mfVal = _Op::compare(mfVal, *it); mfVal = _Op::compare(mfVal, *it);
} }
break; break;
case mdds::mtm::element_boolean: case mdds::mtm::element_boolean:
{ {
boolean_element_block::const_iterator it = boolean_element_block::begin(*node.data); typedef MatrixImplType::boolean_block_type block_type;
boolean_element_block::const_iterator itEnd = boolean_element_block::end(*node.data);
block_type::const_iterator it = block_type::begin(*node.data);
block_type::const_iterator itEnd = block_type::end(*node.data);
double fVal = _Op::boolValue(it, itEnd); double fVal = _Op::boolValue(it, itEnd);
mfVal = _Op::compare(mfVal, fVal); mfVal = _Op::compare(mfVal, fVal);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment