Changeset 63:7afff81381bd in finroc_plugins_data_ports


Ignore:
Timestamp:
28.03.2014 20:56:11 (5 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Message:

Adapted to changes in rrlib_rtti and adapted names of type traits to coding conventions

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • api/tBoundedPort.h

    r59 r63  
    161161   * \return Error message that value is out of bounds 
    162162   */ 
    163   template <bool ENABLE = rrlib::serialization::tIsStringSerializable<T>::value> 
     163  template <bool ENABLE = rrlib::serialization::IsStringSerializable<T>::value> 
    164164  std::string GenerateErrorMessage(const typename std::enable_if<ENABLE, T>::type& current_value) 
    165165  { 
     
    168168    return sos.ToString(); 
    169169  } 
    170   template <bool ENABLE = rrlib::serialization::tIsStringSerializable<T>::value> 
     170  template <bool ENABLE = rrlib::serialization::IsStringSerializable<T>::value> 
    171171  std::string GenerateErrorMessage(const typename std::enable_if < !ENABLE, T >::type& current_value) 
    172172  { 
  • api/tGenericPortImplementation.cpp

    r59 r63  
    103103 
    104104  /*! Should methods dealing with bounds be available? */ 
    105   enum { cBOUNDABLE = tIsBoundable<T>::value }; 
     105  enum { cBOUNDABLE = IsBoundable<T>::value }; 
    106106 
    107107  /*! Class that contains actual implementation of most functionality */ 
  • api/tPortImplementation.h

    r46 r63  
    119119template <typename T, tPortImplementationType TYPE> 
    120120struct tCheapCopyPortImplementation : 
    121   public tCheapCopyPortBaseImplementation<T, T, tPortImplementationType::CHEAP_COPY, tIsBoundable<T>::value> 
     121  public tCheapCopyPortBaseImplementation<T, T, tPortImplementationType::CHEAP_COPY, IsBoundable<T>::value> 
    122122{ 
    123123  typedef T tPortBuffer; 
     
    277277    typename tPortBase::tUnusedManagerPointer buffer = port.GetUnusedBufferRaw(); 
    278278    buffer->SetTimestamp(timestamp); 
    279     rrlib::rtti::sStaticTypeInfo<T>::DeepCopy(data, buffer->GetObject().GetData<T>()); 
     279    rrlib::rtti::GenericOperations<T>::DeepCopy(data, buffer->GetObject().GetData<T>()); 
    280280    port.BrowserPublish(buffer); 
    281281  } 
     
    285285    typename tPortBase::tUnusedManagerPointer buffer = port.GetUnusedBufferRaw(); 
    286286    buffer->SetTimestamp(timestamp); 
    287     rrlib::rtti::sStaticTypeInfo<T>::DeepCopy(data, buffer->GetObject().GetData<T>()); 
     287    rrlib::rtti::GenericOperations<T>::DeepCopy(data, buffer->GetObject().GetData<T>()); 
    288288    port.Publish(buffer); 
    289289  } 
     
    292292  { 
    293293    typename standard::tStandardPort::tLockingManagerPointer pointer = port.GetCurrentValueRaw(); 
    294     rrlib::rtti::sStaticTypeInfo<T>::DeepCopy(pointer->GetObject().GetData<T>(), result_buffer); 
     294    rrlib::rtti::GenericOperations<T>::DeepCopy(pointer->GetObject().GetData<T>(), result_buffer); 
    295295    timestamp_buffer = pointer->GetTimestamp(); 
    296296  } 
     
    335335  static void SetDefault(standard::tStandardPort& port, const T& new_default) 
    336336  { 
    337     rrlib::rtti::sStaticTypeInfo<T>::DeepCopy(new_default, port.GetDefaultBufferRaw().GetData<T>()); 
     337    rrlib::rtti::GenericOperations<T>::DeepCopy(new_default, port.GetDefaultBufferRaw().GetData<T>()); 
    338338    BrowserPublish(port, new_default, rrlib::time::cNO_TIME); 
    339339  } 
  • api/tPortImplementationTypeTrait.h

    r46 r63  
    8181{ 
    8282  /*! Port implementation to use */ 
    83   static const tPortImplementationType type = tIsNumeric<T>::value ? tPortImplementationType::NUMERIC : 
     83  static const tPortImplementationType type = IsNumeric<T>::value ? tPortImplementationType::NUMERIC : 
    8484      (tIsCheaplyCopiedType<T>::value ? tPortImplementationType::CHEAP_COPY : tPortImplementationType::STANDARD); 
    8585}; 
  • optimized/tCheapCopyPort.h

    r59 r63  
    240240    { 
    241241      tLockingManagerPointer dc = PullValueRaw(strategy == tStrategy::PULL_IGNORING_HANDLER_ON_THIS_PORT); 
    242       rrlib::rtti::sStaticTypeInfo<T>::DeepCopy(dc->GetObject().GetData<T>(), buffer, NULL); 
     242      rrlib::rtti::GenericOperations<T>::DeepCopy(dc->GetObject().GetData<T>(), buffer); 
    243243    } 
    244244  } 
     
    271271    { 
    272272      tLockingManagerPointer dc = PullValueRaw(strategy == tStrategy::PULL_IGNORING_HANDLER_ON_THIS_PORT); 
    273       rrlib::rtti::sStaticTypeInfo<T>::DeepCopy(dc->GetObject().GetData<T>(), buffer, NULL); 
     273      rrlib::rtti::GenericOperations<T>::DeepCopy(dc->GetObject().GetData<T>(), buffer); 
    274274      timestamp = dc->GetTimestamp(); 
    275275    } 
  • tBounds.h

    r46 r63  
    8383class tBounds 
    8484{ 
    85   static_assert(tIsBoundable<T>::value, "Type T is not boundable"); 
     85  static_assert(IsBoundable<T>::value, "Type T is not boundable"); 
    8686 
    8787//---------------------------------------------------------------------- 
  • tPort.h

    r58 r63  
    9393protected: 
    9494 
    95   static_assert(rrlib::serialization::tIsBinarySerializable<T>::value, "Type T needs to be binary serializable for use in ports."); 
     95  static_assert(rrlib::serialization::IsBinarySerializable<T>::value, "Type T needs to be binary serializable for use in ports."); 
    9696 
    9797  /*! Class that contains actual implementation of most functionality */ 
     
    116116 
    117117  /*! Should methods dealing with bounds be available? */ 
    118   enum { cBOUNDABLE = tIsBoundable<T>::value }; 
     118  enum { cBOUNDABLE = IsBoundable<T>::value }; 
    119119 
    120120  /*! Smart pointer class returned by various methods */ 
     
    154154    if (creation_info.DefaultValueSet()) 
    155155    { 
    156       T t = rrlib::rtti::sStaticTypeInfo<T>::CreateByValue(); 
     156      T t(rrlib::serialization::DefaultInstantiation<T>::Create()); 
    157157      creation_info.GetDefault(t); 
    158158      SetDefault(t); 
  • tPortCreationInfo.h

    r47 r63  
    7373class tPortCreationInfo : public common::tAbstractDataPortCreationInfo 
    7474{ 
    75   enum { cBOUNDABLE = tIsBoundable<T>::value }; 
     75  enum { cBOUNDABLE = IsBoundable<T>::value }; 
    7676 
    7777//---------------------------------------------------------------------- 
     
    126126 
    127127  /*! Various Set methods for different port properties */ 
    128   template <bool DISABLE = tIsString<T>::value> 
     128  template <bool DISABLE = IsString<T>::value> 
    129129  void Set(const typename std::enable_if < !DISABLE, T >::type& default_value) 
    130130  { 
     
    164164private: 
    165165 
    166   template <bool STRING = tIsString<T>::value> 
     166  template <bool STRING = IsString<T>::value> 
    167167  void SetString(const typename std::enable_if < !STRING, tString >::type& s) 
    168168  { 
     
    170170  } 
    171171 
    172   template <bool STRING = tIsString<T>::value> 
     172  template <bool STRING = IsString<T>::value> 
    173173  void SetString(const typename std::enable_if<STRING, tString>::type& s) 
    174174  { 
  • type_traits.h

    r55 r63  
    104104 */ 
    105105template <typename T> 
    106 struct tIsNumeric 
     106struct IsNumeric 
    107107{ 
    108108  enum { value = std::is_integral<T>::value || std::is_floating_point<T>::value || std::is_same<T, numeric::tNumber>::value }; 
    109109}; 
    110110template <> 
    111 struct tIsNumeric<bool> 
     111struct IsNumeric<bool> 
    112112{ 
    113113  enum { value = 0 }; 
    114114}; 
    115 static_assert(!tIsNumeric<bool>::value, "Bool should not be handled as numeric type"); 
     115static_assert(!IsNumeric<bool>::value, "Bool should not be handled as numeric type"); 
    116116 
    117117/*! 
     
    119119 */ 
    120120template <typename T> 
    121 struct tHasSmallerThanOperator 
     121struct HasSmallerThanOperator 
    122122{ 
    123123  template <typename U = T> 
     
    139139 */ 
    140140template <typename T> 
    141 struct tIsBoundable 
     141struct IsBoundable 
    142142{ 
    143   enum { value = tIsCheaplyCopiedType<T>::value && tHasSmallerThanOperator<T>::value && (!std::is_same<bool, T>::value) }; 
     143  enum { value = tIsCheaplyCopiedType<T>::value && HasSmallerThanOperator<T>::value && (!std::is_same<bool, T>::value) }; 
    144144}; 
    145145 
     
    148148 */ 
    149149template <typename T> 
    150 struct tIsString 
     150struct IsString 
    151151{ 
    152152  enum { value = std::is_same<T, std::string>::value || std::is_same<T, tString>::value || std::is_same<T, char*>::value || std::is_same<T, const char*>::value || std::is_same<typename std::remove_extent<T>::type, char>::value }; 
Note: See TracChangeset for help on using the changeset viewer.