Skip to content

Commit

Permalink
add modifications to Comparator class for displayType, and simple cou…
Browse files Browse the repository at this point in the history
…nt support (and unit tests)

issue #31
  • Loading branch information
Valentin Noel committed Sep 4, 2013
1 parent 5dd0773 commit e2593da
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 152 deletions.
16 changes: 8 additions & 8 deletions libraries/comparator/src/Comparator.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ std::shared_ptr< be::data_element::Data > Comparator::getElement< be::data_eleme
element->setLabel( node.getLabel() );
element->setBigEndianness( node.isBigEndian() );
element->setSpecData( node.getValues() );
element->setDisplayType( node.getDisplayType() );

size_t size = element->getSize();
char buffer[ size ];

// if( size == 0 && ! node.getCount().empty() ) // @todo: when variables map is got!
// {
// be::expression_parser::ExpressionParser< size_t > sizeParser( /*variablesMap*/ );
// size = sizeParser.getExpressionResult< size_t >( node.getCount() );
// }
if( size == 0 && ! node.getCount().empty() ) // @todo: create a map of variables for expression parser!
{
std::map < std::string, size_t > varMap; // @todelete: when variables map is got!
be::expression_parser::ExpressionParser sizeParser( varMap );
size = sizeParser.getExpressionResult< size_t >( node.getCount() );
}

char buffer[ size ];
_file->readData( buffer, size );
element->setData( buffer, size );
element->checkData();
Expand All @@ -97,7 +98,6 @@ std::shared_ptr< be::data_element::Data > Comparator::getElement< be::data_eleme

void Comparator::compare( const std::string& specId, rg::Report& report )
{
// @todo: init ExpressionParser variable map with first pass! or not...
LOG_TRACE( "COMPARE !");
_report = &report;

Expand Down
Loading

0 comments on commit e2593da

Please sign in to comment.