diff --git a/libraries/ElementChecker/src/ElementChecker/Checker/Checker.cpp b/libraries/ElementChecker/src/ElementChecker/Checker/Checker.cpp index e3eeb1b..b531f48 100644 --- a/libraries/ElementChecker/src/ElementChecker/Checker/Checker.cpp +++ b/libraries/ElementChecker/src/ElementChecker/Checker/Checker.cpp @@ -36,67 +36,67 @@ void Checker::check() case eTypeUnknown : LOG_ERROR( "Unknown element type, cannot check it" ); break; case eTypeInt8 : { - if( Ranges< be::int8 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::int8 >() ) ) + if( Ranges< be::int8 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::int8 >() ) ) status = eStatusValid; break; } case eTypeUInt8 : { - if( Ranges< be::uint8 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::uint8 >() ) ) + if( Ranges< be::uint8 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::uint8 >() ) ) status = eStatusValid; break; } case eTypeInt16 : { - if( Ranges< be::int16 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::int16 >() ) ) + if( Ranges< be::int16 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::int16 >() ) ) status = eStatusValid; break; } case eTypeUInt16 : { - if( Ranges< be::uint16 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::uint16 >() ) ) + if( Ranges< be::uint16 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::uint16 >() ) ) status = eStatusValid; break; } case eTypeInt32 : { - if( Ranges< be::int32 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::int32 >() ) ) + if( Ranges< be::int32 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::int32 >() ) ) status = eStatusValid; break; } case eTypeUInt32 : { - if( Ranges< be::uint32 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::uint32 >() ) ) + if( Ranges< be::uint32 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::uint32 >() ) ) status = eStatusValid; break; } case eTypeInt64 : { - if( Ranges< be::int64 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::int64 >() ) ) + if( Ranges< be::int64 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::int64 >() ) ) status = eStatusValid; break; } case eTypeUInt64 : { - if( Ranges< be::uint64 >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::uint64 >() ) ) + if( Ranges< be::uint64 >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::uint64 >() ) ) status = eStatusValid; break; } case eTypeFloat : { - if( Ranges< float >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< float >() ) ) + if( Ranges< float >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< float >() ) ) status = eStatusValid; break; } case eTypeDouble : { - if( Ranges< double >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< double >() ) ) + if( Ranges< double >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< double >() ) ) status = eStatusValid; break; } case eTypeIeeeExtended : { - if( Ranges< be::ieeeExtended >( _element->_rangeExpr ).isInRanges( Translator( _element.get() ).get< be::ieeeExtended >() ) ) + if( Ranges< be::ieeeExtended >( _element->_rangeExpr ).isInRanges( Translator( _element ).get< be::ieeeExtended >() ) ) status = eStatusValid; break; } @@ -104,7 +104,7 @@ void Checker::check() case eTypeAscii : case eTypeHexa : { - std::string orig = Translator( _element.get() ).get(); + std::string orig = Translator( _element ).get(); std::string lowCase = orig; std::string upCase = orig; std::transform( lowCase.begin(), lowCase.end(), lowCase.begin(), ::tolower ); diff --git a/libraries/ElementChecker/src/ElementChecker/Translator/Translator.hpp b/libraries/ElementChecker/src/ElementChecker/Translator/Translator.hpp index 1f8af4e..f65568a 100644 --- a/libraries/ElementChecker/src/ElementChecker/Translator/Translator.hpp +++ b/libraries/ElementChecker/src/ElementChecker/Translator/Translator.hpp @@ -20,7 +20,7 @@ union NumberData class Translator { public: - Translator( const basic_element::Element* elem ) + Translator( const std::shared_ptr< basic_element::Element > elem ) : _ref( elem ) { } @@ -41,7 +41,7 @@ class Translator void getOrderedData( char* buffer ); private: - const basic_element::Element* _ref; + const std::shared_ptr< basic_element::Element > _ref; }; } diff --git a/libraries/ElementChecker/test/translatorTest.hpp b/libraries/ElementChecker/test/translatorTest.hpp index edfb1f2..d8bf213 100644 --- a/libraries/ElementChecker/test/translatorTest.hpp +++ b/libraries/ElementChecker/test/translatorTest.hpp @@ -28,58 +28,58 @@ BOOST_AUTO_TEST_CASE( element_checker_translator_1 ) spec.setFromString( jsonString ); std::shared_ptr< spec_reader::SpecNode > node = spec.getFirstNode(); - basic_element::Element elem( node ); + std::shared_ptr< basic_element::Element > elem( new basic_element::Element( node ) ); { - Translator tr = Translator( &elem ); + Translator tr = Translator( elem ); BOOST_CHECK_THROW( tr.get< std::string >(), std::runtime_error ); } { const char buff[4] { 'W', 'A', 'V', 'E' }; - elem.set( (const char*)&buff, 4 ); - - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::string >(), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::vector< int > >().at(0), 1163280727 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(0), 87 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(1), 65 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(2), 86 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(3), 69 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< int >(), 1163280727 ); - BOOST_CHECK_THROW( Translator( &elem ).get< short >(), std::runtime_error ); + elem->set( (const char*)&buff, 4 ); + + BOOST_CHECK_EQUAL( Translator( elem ).get< std::string >(), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::vector< int > >().at(0), 1163280727 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(0), 87 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(1), 65 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(2), 86 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(3), 69 ); + BOOST_CHECK_EQUAL( Translator( elem ).get< int >(), 1163280727 ); + BOOST_CHECK_THROW( Translator( elem ).get< short >(), std::runtime_error ); } { const char buff[2] { 'a', 'b' }; - elem.set( (const char*)&buff, 2 ); - - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::string >(), "ab" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::vector< short > >().at(0), 25185 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(0), 97 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(1), 98 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< short >(), 25185 ); - BOOST_CHECK_THROW( Translator( &elem ).get< int >(), std::runtime_error ); - BOOST_CHECK_THROW( Translator( &elem ).get< std::vector< int > >(), std::runtime_error ); + elem->set( (const char*)&buff, 2 ); + + BOOST_CHECK_EQUAL( Translator( elem ).get< std::string >(), "ab" ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::vector< short > >().at(0), 25185 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(0), 97 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(1), 98 ); + BOOST_CHECK_EQUAL( Translator( elem ).get< short >(), 25185 ); + BOOST_CHECK_THROW( Translator( elem ).get< int >(), std::runtime_error ); + BOOST_CHECK_THROW( Translator( elem ).get< std::vector< int > >(), std::runtime_error ); } { const char buff[4] { 'W', 'A', 'V', 'E' }; - elem.set( (const char*)&buff, 4 ); + elem->set( (const char*)&buff, 4 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeDefault ), "" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeNumbers ), "87658669" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeAscii ), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeHexa ), "57415645" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeRaw ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeDefault ), "" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeNumbers ), "87658669" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeAscii ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeHexa ), "57415645" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeRaw ), "WAVE" ); } { - basic_element::Element data( node ); + std::shared_ptr< basic_element::Element > data( new basic_element::Element( node ) ); const char buff[4] { 'W', 'A', 'V', 'E' }; - data.set( (const char*)&buff, 4 ); + data->set( (const char*)&buff, 4 ); - BOOST_CHECK_EQUAL( Translator( &data ).get( eDisplayTypeDefault ), "" ); - BOOST_CHECK_EQUAL( Translator( &data ).get( eDisplayTypeNumbers ), "87658669" ); - BOOST_CHECK_EQUAL( Translator( &data ).get( eDisplayTypeAscii ), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &data ).get( eDisplayTypeHexa ), "57415645" ); - BOOST_CHECK_EQUAL( Translator( &data ).get( eDisplayTypeRaw ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( data ).get( eDisplayTypeDefault ), "" ); + BOOST_CHECK_EQUAL( Translator( data ).get( eDisplayTypeNumbers ), "87658669" ); + BOOST_CHECK_EQUAL( Translator( data ).get( eDisplayTypeAscii ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( data ).get( eDisplayTypeHexa ), "57415645" ); + BOOST_CHECK_EQUAL( Translator( data ).get( eDisplayTypeRaw ), "WAVE" ); } } @@ -105,26 +105,26 @@ BOOST_AUTO_TEST_CASE( element_checker_translator_2 ) spec.setFromString( jsonString ); std::shared_ptr< spec_reader::SpecNode > node = spec.getFirstNode(); - basic_element::Element elem( node ); + std::shared_ptr< basic_element::Element > elem( new basic_element::Element( node ) ); const char buff[4] { 'W', 'A', 'V', 'E' }; - elem.set( (const char*)&buff, 4 ); + elem->set( (const char*)&buff, 4 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::string >(), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::vector< int > >().at(0), 1163280727 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(0), 87 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(1), 65 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(2), 86 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(3), 69 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< int >(), 1163280727 ); - BOOST_CHECK_THROW( Translator( &elem ).get< short >(), std::runtime_error ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::string >(), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::vector< int > >().at(0), 1163280727 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(0), 87 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(1), 65 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(2), 86 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(3), 69 ); + BOOST_CHECK_EQUAL( Translator( elem ).get< int >(), 1163280727 ); + BOOST_CHECK_THROW( Translator( elem ).get< short >(), std::runtime_error ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeDefault ), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeNumbers ), "87658669" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeAscii ), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeHexa ), "57415645" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeRaw ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeDefault ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeNumbers ), "87658669" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeAscii ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeHexa ), "57415645" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeRaw ), "WAVE" ); } { @@ -145,26 +145,26 @@ BOOST_AUTO_TEST_CASE( element_checker_translator_2 ) spec.setFromString( jsonString ); std::shared_ptr< spec_reader::SpecNode > node = spec.getFirstNode(); - basic_element::Element elem( node ); + std::shared_ptr< basic_element::Element > elem( new basic_element::Element( node ) ); const char buff[4] { 'W', 'A', 'V', 'E' }; - elem.set( (const char*)&buff, 4 ); + elem->set( (const char*)&buff, 4 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::string >(), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::vector< int > >().at(0), 1463899717 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(0), 87 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(1), 65 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(2), 86 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(3), 69 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< int >(), 1463899717 ); - BOOST_CHECK_THROW( Translator( &elem ).get< short >(), std::runtime_error ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::string >(), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::vector< int > >().at(0), 1463899717 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(0), 87 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(1), 65 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(2), 86 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(3), 69 ); + BOOST_CHECK_EQUAL( Translator( elem ).get< int >(), 1463899717 ); + BOOST_CHECK_THROW( Translator( elem ).get< short >(), std::runtime_error ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeDefault ), "1463899717" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeNumbers ), "87658669" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeAscii ), "WAVE" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeHexa ), "57415645" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeRaw ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeDefault ), "1463899717" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeNumbers ), "87658669" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeAscii ), "WAVE" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeHexa ), "57415645" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeRaw ), "WAVE" ); } { @@ -185,24 +185,24 @@ BOOST_AUTO_TEST_CASE( element_checker_translator_2 ) spec.setFromString( jsonString ); std::shared_ptr< spec_reader::SpecNode > node = spec.getFirstNode(); - basic_element::Element elem( node ); + std::shared_ptr< basic_element::Element > elem( new basic_element::Element( node ) ); const char buff[1] { 'W' }; - elem.set( (const char*)&buff, 1 ); + elem->set( (const char*)&buff, 1 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< std::string >(), "W" ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(0), 87 ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< char >(), 'W' ); - BOOST_CHECK_THROW( Translator( &elem ).get< std::vector< int > >(), std::runtime_error ); - BOOST_CHECK_THROW( Translator( &elem ).get< int >(), std::runtime_error ); - BOOST_CHECK_THROW( Translator( &elem ).get< short >(), std::runtime_error ); + BOOST_CHECK_EQUAL( Translator( elem ).get< std::string >(), "W" ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(0), 87 ); + BOOST_CHECK_EQUAL( Translator( elem ).get< char >(), 'W' ); + BOOST_CHECK_THROW( Translator( elem ).get< std::vector< int > >(), std::runtime_error ); + BOOST_CHECK_THROW( Translator( elem ).get< int >(), std::runtime_error ); + BOOST_CHECK_THROW( Translator( elem ).get< short >(), std::runtime_error ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeDefault ), "87" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeNumbers ), "87" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeAscii ), "W" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeHexa ), "57" ); - BOOST_CHECK_EQUAL( Translator( &elem ).get( eDisplayTypeRaw ), "W" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeDefault ), "87" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeNumbers ), "87" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeAscii ), "W" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeHexa ), "57" ); + BOOST_CHECK_EQUAL( Translator( elem ).get( eDisplayTypeRaw ), "W" ); } { @@ -224,24 +224,24 @@ BOOST_AUTO_TEST_CASE( element_checker_translator_2 ) spec.setFromString( jsonString ); std::shared_ptr< spec_reader::SpecNode > node = spec.getFirstNode(); - basic_element::Element elem( node ); + std::shared_ptr< basic_element::Element > elem( new basic_element::Element( node ) ); const char buff[4] { 0x01, 0x00, 0x00, 0x00 }; - elem.set( (const char*)&buff, 4 ); - - BOOST_CHECK_EQUAL( elem._isBigEndian, false ); - BOOST_CHECK_EQUAL( Translator( &elem ).get< int >(), 1 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().size(), 4 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(0), 1 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(1), 0 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(2), 0 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< char > >().at(3), 0 ); - - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< short > >().size(), 2 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< short > >().at(0), 1 ); - BOOST_CHECK_EQUAL( (short) Translator( &elem ).get< std::vector< short > >().at(1), 0 ); + elem->set( (const char*)&buff, 4 ); + + BOOST_CHECK_EQUAL( elem->_isBigEndian, false ); + BOOST_CHECK_EQUAL( Translator( elem ).get< int >(), 1 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().size(), 4 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(0), 1 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(1), 0 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(2), 0 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< char > >().at(3), 0 ); + + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< short > >().size(), 2 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< short > >().at(0), 1 ); + BOOST_CHECK_EQUAL( (short) Translator( elem ).get< std::vector< short > >().at(1), 0 ); - BOOST_CHECK_THROW( Translator( &elem ).get< short >(), std::runtime_error ); + BOOST_CHECK_THROW( Translator( elem ).get< short >(), std::runtime_error ); } }