Changeset 59:03ab00493dfc in rrlib_si_units


Ignore:
Timestamp:
02.06.2017 23:25:49 (2 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Adapts to changes in rrlib_rtti

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rtti.cpp

    r40 r59  
    6767//---------------------------------------------------------------------- 
    6868 
    69 static rtti::tType init_types[] = 
     69rtti::tType init_types[] = 
    7070{ 
    7171  rtti::tDataType<tLength<double>>(), 
  • rtti.h

    r49 r59  
    7171   * \return Type name to use in rrlib_rtti for type T 
    7272   */ 
    73   static std::string Get() 
     73  static util::tManagedConstCharPointer Get(const rrlib::rtti::tType& type) 
    7474  { 
    7575    std::stringstream str; 
    76     str << "Quantity<" << TUnit() << ", " << TypeName<TValue>::Get() << ">"; 
    77     return str.str(); 
     76    str << "Quantity<" << TUnit() << ", " << rtti::tDataType<TValue>().GetName() << ">"; 
     77    return util::tManagedConstCharPointer(str.str().c_str(), true); 
    7878  } 
     79 
     80  static constexpr tGetTypenameFunction value = &Get; 
    7981}; 
    8082 
     
    8688   * \return Type name to use in rrlib_rtti for type T 
    8789   */ 
    88   static std::string Get() 
     90  static util::tManagedConstCharPointer Get(const rrlib::rtti::tType& type) 
    8991  { 
    9092    std::stringstream str; 
    9193    str << "Quantity<" << TUnit() << ", Angle>"; 
    92     return str.str(); 
     94    return util::tManagedConstCharPointer(str.str().c_str(), true); 
    9395  } 
     96 
     97  static constexpr tGetTypenameFunction value = &Get; 
     98}; 
     99 
     100template <typename TUnit, typename TValue> 
     101struct UnderlyingType<si_units::tQuantity<TUnit, TValue>> 
     102{ 
     103  typedef TValue type; 
     104  enum { cREVERSE_CAST_VALID = true }; 
     105  enum { cBINARY_SERIALIZATION_DIFFERS = false }; 
     106  enum { cOTHER_SERIALIZATION_DIFFERS = true }; 
    94107}; 
    95108 
  • tests/test.cpp

    r48 r59  
    160160    serialization::tMemoryBuffer memory_buffer; 
    161161    serialization::tOutputStream output_stream(memory_buffer); 
    162     serialization::tInputStream input_stream(memory_buffer); 
    163162 
    164163    output_stream << tLength<double>(10); 
     
    166165    output_stream.Flush(); 
    167166 
     167    serialization::tInputStream input_stream(memory_buffer); 
    168168    input_stream >> length; 
    169169    RRLIB_UNIT_TESTS_EQUALITY(tLength<double>(10), length); 
Note: See TracChangeset for help on using the changeset viewer.