Exemplo n.º 1
0
  //-----------------------------------------------------------------------------
  // Tools::scanValues
  //-----------------------------------------------------------------------------
  std::string Tools::scanValues(ArrayIterator& iterator, ArrayIterator& end, int maxCell) 
  {
    std::cout<<"Entering Tools::scanValues"<<std::endl;

    stringstream res;
    int j = 0;
    vector<int> current = iterator.getPosition();
    double value;

    while( iterator != end )
    {
      current = iterator.getPosition();
      if( current[0] < maxCell )
      {
        if( current[current.size() - 1] == 0 )
        {
          if( current[0] != 0 )
          {
            res << "...\n";
          }
          res << "raw" << Tools::displayArray( iterator.getPosition() ) << "= ";
          j++;
        }
        value = iterator.getValue<double>();
        if( current[current.size() - 1] < maxCell )
        {
          stringstream tmp_ss;
          tmp_ss << value;
          if( tmp_ss.str().size() > 9 )
          {
            res << tmp_ss.str().substr(0, 5) << "... ";
          }
          else
          {
            int size = tmp_ss.str().size();
            for( int i = 0; i < 9 - size; i++ )
            {
              tmp_ss << " ";
            }
            res << tmp_ss.str().c_str();
          }
        }
      }
      ++iterator;
    }
    res << "...";
    std::string str = res.str();
    std::cout<<"Leaving Tools::scanValues"<<std::endl;
    return str;
  }
Exemplo n.º 2
0
//----------------------------------------------------------------------------
// Array::setValue
//----------------------------------------------------------------------------
template<typename T> void Array::setValue(const ArrayIterator& target, T value)
{
  m_data_impl->setValue( m_view_ptr, target.getPosition(), &value );
}