Changeset 59:03ab00493dfc in rrlib_si_units
Legend:
- Unmodified
- Added
- Removed
-
rtti.cpp
r40 r59 67 67 //---------------------------------------------------------------------- 68 68 69 staticrtti::tType init_types[] =69 rtti::tType init_types[] = 70 70 { 71 71 rtti::tDataType<tLength<double>>(), -
rtti.h
r49 r59 71 71 * \return Type name to use in rrlib_rtti for type T 72 72 */ 73 static std::string Get()73 static util::tManagedConstCharPointer Get(const rrlib::rtti::tType& type) 74 74 { 75 75 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); 78 78 } 79 80 static constexpr tGetTypenameFunction value = &Get; 79 81 }; 80 82 … … 86 88 * \return Type name to use in rrlib_rtti for type T 87 89 */ 88 static std::string Get()90 static util::tManagedConstCharPointer Get(const rrlib::rtti::tType& type) 89 91 { 90 92 std::stringstream str; 91 93 str << "Quantity<" << TUnit() << ", Angle>"; 92 return str.str();94 return util::tManagedConstCharPointer(str.str().c_str(), true); 93 95 } 96 97 static constexpr tGetTypenameFunction value = &Get; 98 }; 99 100 template <typename TUnit, typename TValue> 101 struct 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 }; 94 107 }; 95 108 -
tests/test.cpp
r48 r59 160 160 serialization::tMemoryBuffer memory_buffer; 161 161 serialization::tOutputStream output_stream(memory_buffer); 162 serialization::tInputStream input_stream(memory_buffer);163 162 164 163 output_stream << tLength<double>(10); … … 166 165 output_stream.Flush(); 167 166 167 serialization::tInputStream input_stream(memory_buffer); 168 168 input_stream >> length; 169 169 RRLIB_UNIT_TESTS_EQUALITY(tLength<double>(10), length);
Note: See TracChangeset
for help on using the changeset viewer.