Changeset 101:5459d665f262 in finroc_plugins_data_ports


Ignore:
Timestamp:
18.11.2015 21:56:30 (4 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Message:

Removed obsolete class finroc::data_ports::tUnit together with functionality related to it

Files:
2 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • api/tBoundedPort.h

    r69 r101  
    116116    tBufferType value_buffer = tBufferType(); 
    117117    this->CopyCurrentValue(value_buffer, tStrategy::NEVER_PULL); 
    118     T value = tImplementationVariation::ToValue(value_buffer, this->GetUnit()); 
     118    T value = tImplementationVariation::ToValue(value_buffer); 
    119119    if (!bounds.InBounds(value)) 
    120120    { 
    121121      typename tPortBase::tUnusedManagerPointer new_buffer(optimized::tGlobalBufferPools::Instance().GetUnusedBuffer(this->GetCheaplyCopyableTypeIndex()).release()); 
    122       tImplementationVariation::Assign(new_buffer->GetObject().template GetData<tBufferType>(), bounds.GetOutOfBoundsDefault(), this->GetUnit()); 
     122      tImplementationVariation::Assign(new_buffer->GetObject().template GetData<tBufferType>(), bounds.GetOutOfBoundsDefault()); 
    123123      this->BrowserPublishRaw(new_buffer); // If port is already connected, could this have undesirable side-effects? (I do not think so - otherwise we need to do something more sophisticated here) 
    124124    } 
     
    159159    } 
    160160    const tBufferType& value_buffer = buffer->GetObject().template GetData<tBufferType>(); 
    161     T value = tImplementationVariation::ToValue(value_buffer, this->GetUnit()); 
     161    T value = tImplementationVariation::ToValue(value_buffer); 
    162162    if (!bounds.InBounds(value)) 
    163163    { 
     
    219219  { 
    220220    const tBufferType& value_buffer = publishing_data.published_buffer->GetObject().template GetData<tBufferType>(); 
    221     T value = tImplementationVariation::ToValue(value_buffer, this->GetUnit()); 
     221    T value = tImplementationVariation::ToValue(value_buffer); 
    222222    if (!bounds.InBounds(value)) 
    223223    { 
     
    230230      publishing_data.Init(buffer); 
    231231      tImplementationVariation::Assign(publishing_data.published_buffer->GetObject().template GetData<tBufferType>(), 
    232                                        bounds.GetOutOfBoundsAction() == tOutOfBoundsAction::ADJUST_TO_RANGE ? bounds.ToBounds(value) : bounds.GetOutOfBoundsDefault(), this->GetUnit()); 
     232                                       bounds.GetOutOfBoundsAction() == tOutOfBoundsAction::ADJUST_TO_RANGE ? bounds.ToBounds(value) : bounds.GetOutOfBoundsDefault()); 
    233233      publishing_data.published_buffer->SetTimestamp(timestamp); 
    234234    } 
  • api/tPortBufferReturnCustomization.h

    r69 r101  
    8888    const tPortBuffer& value_buffer = locked_buffer->locked_buffer->GetObject().template GetData<tPortBuffer>(); 
    8989    locked_buffer->locked_buffer.reset(); 
    90     return tBase::ToValue(value_buffer, port.GetUnit()); 
     90    return tBase::ToValue(value_buffer); 
    9191  } 
    9292}; 
  • api/tPortDataPointerImplementation.h

    r87 r101  
    203203#ifndef RRLIB_SINGLE_THREADED 
    204204  inline tPortDataPointerImplementation(typename tPortImplementation::tPortBase::tLockingManagerPointer& pointer, optimized::tCheapCopyPort& port) : 
    205     buffer(tPortImplementation::ToValue(pointer->GetObject().template GetData<typename tPortImplementation::tPortBuffer>(), port.GetUnit())), 
     205    buffer(tPortImplementation::ToValue(pointer->GetObject().template GetData<typename tPortImplementation::tPortBuffer>())), 
    206206    timestamp(pointer->GetTimestamp()), 
    207207    null_pointer(false) 
  • api/tPortImplementation.h

    r100 r101  
    127127  typedef T tPortBuffer; 
    128128 
    129   static inline void Assign(T& buffer, const T& value, const tUnit& port_unit) 
     129  static inline void Assign(T& buffer, const T& value) 
    130130  { 
    131131    buffer = value; 
    132132  } 
    133133 
    134   static inline T ToValue(const T& value, const tUnit& port_unit) 
     134  static inline T ToValue(const T& value) 
    135135  { 
    136136    return value; 
     
    145145  typedef numeric::tNumber tPortBuffer; 
    146146 
    147   static inline void Assign(numeric::tNumber& buffer, T value, const tUnit& port_unit) 
    148   { 
    149     buffer.SetValue(value, port_unit); 
    150   } 
    151  
    152   static inline T ToCorrectUnit(const numeric::tNumber& number, const tUnit& port_unit) 
    153   { 
    154     T value = number.Value<T>(); 
    155     if (number.GetUnit() != tUnit::cNO_UNIT && port_unit != tUnit::cNO_UNIT && number.GetUnit() != port_unit) 
    156     { 
    157       value = number.GetUnit().ConvertTo(value, port_unit); 
    158     } 
    159     return value; 
    160   } 
    161  
    162   static inline T ToValue(const numeric::tNumber& value, const tUnit& port_unit) 
    163   { 
    164     return ToCorrectUnit(value, port_unit); 
     147  static inline void Assign(numeric::tNumber& buffer, T value) 
     148  { 
     149    buffer.SetValue(value); 
     150  } 
     151 
     152  static inline T ToValue(const numeric::tNumber& value) 
     153  { 
     154    return value.Value<T>(); 
    165155  } 
    166156}; 
     
    173163  typedef numeric::tNumber tPortBuffer; 
    174164 
    175   static inline void Assign(numeric::tNumber& buffer, const numeric::tNumber value, const tUnit& port_unit) 
     165  static inline void Assign(numeric::tNumber& buffer, const numeric::tNumber value) 
    176166  { 
    177167    buffer = value; 
    178     buffer.SetUnit(port_unit); 
    179   } 
    180  
    181   static inline numeric::tNumber ToCorrectUnit(const numeric::tNumber& number, const tUnit& port_unit) 
    182   { 
    183     if (number.GetUnit() != tUnit::cNO_UNIT && port_unit != tUnit::cNO_UNIT && number.GetUnit() != port_unit) 
    184     { 
    185       return numeric::tNumber(number.GetUnit().ConvertTo(number.Value<double>(), port_unit), port_unit); 
    186     } 
    187     return number; 
    188   } 
    189  
    190   static inline numeric::tNumber ToValue(const numeric::tNumber& value, const tUnit& port_unit) 
    191   { 
    192     return ToCorrectUnit(value, port_unit); 
     168  } 
     169 
     170  static inline numeric::tNumber ToValue(const numeric::tNumber& value) 
     171  { 
     172    return value; 
    193173  } 
    194174}; 
     
    205185    typename optimized::tCheapCopyPort::tUnusedManagerPointer buffer(optimized::tGlobalBufferPools::Instance().GetUnusedBuffer(port.GetCheaplyCopyableTypeIndex()).release()); 
    206186    buffer->SetTimestamp(timestamp); 
    207     tBase::Assign(buffer->GetObject().GetData<typename tBase::tPortBuffer>(), data, port.GetUnit()); 
     187    tBase::Assign(buffer->GetObject().GetData<typename tBase::tPortBuffer>(), data); 
    208188    port.BrowserPublishRaw(buffer); 
    209189  } 
     
    216196      typename optimized::tThreadLocalBufferPools::tBufferPointer buffer = thread_local_pools->GetUnusedBuffer(port.GetCheaplyCopyableTypeIndex()); 
    217197      buffer->SetTimestamp(timestamp); 
    218       tBase::Assign(buffer->GetObject().GetData<typename tBase::tPortBuffer>(), data, port.GetUnit()); 
     198      tBase::Assign(buffer->GetObject().GetData<typename tBase::tPortBuffer>(), data); 
    219199      common::tPublishOperation<optimized::tCheapCopyPort, typename optimized::tCheapCopyPort::tPublishingDataThreadLocalBuffer> publish_operation(buffer.release(), true); 
    220200      publish_operation.Execute<false, tChangeStatus::CHANGED, false, false>(port); 
     
    224204      typename optimized::tCheapCopyPort::tUnusedManagerPointer buffer(optimized::tGlobalBufferPools::Instance().GetUnusedBuffer(port.GetCheaplyCopyableTypeIndex()).release()); 
    225205      buffer->SetTimestamp(timestamp); 
    226       tBase::Assign(buffer->GetObject().GetData<typename tBase::tPortBuffer>(), data, port.GetUnit()); 
     206      tBase::Assign(buffer->GetObject().GetData<typename tBase::tPortBuffer>(), data); 
    227207      common::tPublishOperation<optimized::tCheapCopyPort, typename optimized::tCheapCopyPort::tPublishingDataGlobalBuffer> publish_operation(buffer); 
    228208      publish_operation.Execute<false, tChangeStatus::CHANGED, false, false>(port); 
     
    234214    typename tBase::tPortBuffer temp_buffer; 
    235215    port.CopyCurrentValue(temp_buffer, timestamp_buffer); 
    236     result_buffer = tBase::ToValue(temp_buffer, port.GetUnit()); 
     216    result_buffer = tBase::ToValue(temp_buffer); 
    237217  } 
    238218 
     
    242222    rrlib::time::tTimestamp timestamp; 
    243223    port.CopyCurrentValue(buffer, timestamp); 
    244     return tPortDataPointerImplementation<T, true>(tBase::ToValue(buffer, port.GetUnit()), timestamp); 
     224    return tPortDataPointerImplementation<T, true>(tBase::ToValue(buffer), timestamp); 
    245225  } 
    246226 
     
    265245  { 
    266246    typename tBase::tPortBuffer buffer; 
    267     tBase::Assign(buffer, new_default, port.GetUnit()); 
     247    tBase::Assign(buffer, new_default); 
    268248    rrlib::rtti::tGenericObjectWrapper<typename tBase::tPortBuffer> wrapper(buffer); 
    269249    port.SetDefault(wrapper); 
  • api/tPortListenerAdapter.h

    r69 r101  
    137137    this->PortChangedRawBase(change_context, lock_counter, value); 
    138138    T v = tImplementation::ToValue( 
    139             static_cast<optimized::tCheaplyCopiedBufferManager&>(value).GetObject().GetData<typename tImplementation::tPortBuffer>(), 
    140             static_cast<optimized::tCheapCopyPort&>(change_context.Origin()).GetUnit()); 
     139            static_cast<optimized::tCheaplyCopiedBufferManager&>(value).GetObject().GetData<typename tImplementation::tPortBuffer>()); 
    141140    this->listener.OnPortChange(v, change_context); 
    142141  } 
     
    242241  inline void PortChangedRawImplementation(tChangeContext& change_context, int& lock_counter, optimized::tCheaplyCopiedBufferManager& value) 
    243242  { 
    244     T data = tImplementation::ToValue(value.GetObject().GetData<typename tImplementation::tPortBuffer>(), 
    245                                       static_cast<optimized::tCheapCopyPort&>(change_context.Origin()).GetUnit()); 
     243    T data = tImplementation::ToValue(value.GetObject().GetData<typename tImplementation::tPortBuffer>()); 
    246244    tPortDataPointer<const T> pointer(tPortDataPointerImplementation<T, true>(data, change_context.Timestamp())); 
    247245    this->listener.OnPortChange(pointer, change_context); 
  • common/tAbstractDataPortCreationInfo.cpp

    r46 r101  
    7070 
    7171tAbstractDataPortCreationInfo::tAbstractDataPortCreationInfo() : 
    72   unit(), 
    7372  max_queue_size(-1), 
    7473  min_net_update_interval(-1), 
  • common/tAbstractDataPortCreationInfo.h

    r46 r101  
    4747#include "plugins/data_ports/tBounds.h" 
    4848#include "plugins/data_ports/tQueueSettings.h" 
    49 #include "plugins/data_ports/tUnit.h" 
    5049 
    5150//---------------------------------------------------------------------- 
     
    8483  /*! Base class */ 
    8584  typedef core::tAbstractPortCreationInfo tBase; 
    86  
    87   /*! SI Unit of port. NULL for no unit = provides raw numbers */ 
    88   tUnit unit; 
    8985 
    9086  /*! Input Queue size; value <= 0 means flexible size */ 
     
    146142  } 
    147143 
    148   void Set(const tUnit& unit) 
    149   { 
    150     this->unit = unit; 
    151   } 
    152  
    153144  void Set(const tAbstractDataPortCreationInfo& other) 
    154145  { 
  • make.xml

    r67 r101  
    1010      tEvent.h 
    1111      tQueueSettings.h 
    12       tUnit.cpp 
    1312      type_traits.h 
    1413      common/* 
  • numeric/tNumber.cpp

    r100 r101  
    7777// Implementation 
    7878//---------------------------------------------------------------------- 
    79 static inline int8_t PrepareFirstByte(int8_t value2, tUnit unit) 
    80 { 
    81   int tmp = (value2 << 1); 
    82   return static_cast<int8_t>((unit == tUnit::cNO_UNIT) ? tmp : (tmp | 1)); 
     79static inline int8_t PrepareFirstByte(int8_t value2) 
     80{ 
     81  return static_cast<int8_t>((value2 << 1)); 
    8382} 
    8483 
    8584bool tNumber::operator<(const tNumber& other) const 
    8685{ 
    87   if (unit != tUnit::cNO_UNIT && other.unit != tUnit::cNO_UNIT) 
    88   { 
    89     double o = other.unit.ConvertTo(other.double_value, unit); 
    90     return o < double_value; 
    91   } 
    9286  switch (number_type) 
    9387  { 
    9488  case tType::INT64: 
    95     return integer_value < other.integer_value; 
     89    return integer_value < other.Value<int64_t>(); 
    9690  case tType::DOUBLE: 
    97     return double_value < other.double_value; 
     91    return double_value < other.Value<double>(); 
    9892  case tType::FLOAT: 
    99     return float_value < other.float_value; 
     93    return float_value < other.Value<float>(); 
    10094  default: 
    10195    FINROC_LOG_PRINT(ERROR, "Memory error: Invalid enum."); 
     
    112106    if (value >= cMIN_BARRIER && value <= 63) 
    113107    { 
    114       stream.WriteByte(PrepareFirstByte(static_cast<int8_t>(value), number.GetUnit())); 
     108      stream.WriteByte(PrepareFirstByte(static_cast<int8_t>(value))); 
    115109    } 
    116110    else if (value >= std::numeric_limits<int16_t>::min() && value <= std::numeric_limits<int16_t>::max()) 
    117111    { 
    118       stream.WriteByte(PrepareFirstByte(cINT16, number.GetUnit())); 
     112      stream.WriteByte(PrepareFirstByte(cINT16)); 
    119113      stream.WriteShort(static_cast<int16_t>(value)); 
    120114    } 
    121115    else if (value >= std::numeric_limits<int32_t>::min() && value <= std::numeric_limits<int32_t>::max()) 
    122116    { 
    123       stream.WriteByte(PrepareFirstByte(cINT32, number.GetUnit())); 
     117      stream.WriteByte(PrepareFirstByte(cINT32)); 
    124118      stream.WriteInt(static_cast<int32_t>(value)); 
    125119    } 
    126120    else 
    127121    { 
    128       stream.WriteByte(PrepareFirstByte(cINT64, number.GetUnit())); 
     122      stream.WriteByte(PrepareFirstByte(cINT64)); 
    129123      stream.WriteLong(value); 
    130124    } 
     
    132126  else if (number.GetNumberType() == tNumber::tType::DOUBLE) 
    133127  { 
    134     stream.WriteByte(PrepareFirstByte(cFLOAT64, number.GetUnit())); 
     128    stream.WriteByte(PrepareFirstByte(cFLOAT64)); 
    135129    stream.WriteDouble(number.double_value); 
    136130  } 
    137131  else if (number.GetNumberType() == tNumber::tType::FLOAT) 
    138132  { 
    139     stream.WriteByte(PrepareFirstByte(cFLOAT32, number.GetUnit())); 
     133    stream.WriteByte(PrepareFirstByte(cFLOAT32)); 
    140134    stream.WriteFloat(number.float_value); 
    141   } 
    142   if (number.GetUnit() != tUnit::cNO_UNIT) 
    143   { 
    144     stream << number.GetUnit(); 
    145135  } 
    146136  return stream; 
     
    178168  if (has_unit) 
    179169  { 
    180     tUnit unit; 
    181     stream >> unit; 
    182     number.SetUnit(unit); 
     170    stream.ReadByte(); // for backward compatibility 
    183171  } 
    184172  return stream; 
     
    202190    abort(); 
    203191  } 
    204   stream << number.GetUnit().GetName(); 
    205192  return stream; 
    206193} 
     
    209196rrlib::serialization::tStringInputStream &operator >> (rrlib::serialization::tStringInputStream& stream, tNumber& number) 
    210197{ 
    211   // scan for unit 
     198  // scan for unit string (for backward compatibility) 
    212199  tString complete_string = stream.ReadWhile("-./", rrlib::serialization::tStringInputStream::cDIGIT | rrlib::serialization::tStringInputStream::cWHITESPACE | rrlib::serialization::tStringInputStream::cLETTER, true); 
    213200  tString number_string = complete_string; 
    214   tUnit unit; 
    215201  for (size_t i = 0; i < complete_string.length(); i++) 
    216202  { 
     
    223209      } 
    224210      number_string = complete_string.substr(0, i); // trimming not necessary, as ato* functions do this 
    225       tString unit_string = complete_string.substr(i); // first character is letter 
    226       assert(unit_string.length() > 0 && isalpha(unit_string[0])); 
    227       while (isspace(unit_string.back())) // trim back 
    228       { 
    229         unit_string.erase(unit_string.length() - 1); 
    230       } 
    231       unit = tUnit::GetUnit(unit_string); 
     211      //tString unit_string = complete_string.substr(i); // first character is letter 
    232212      break; 
    233213    } 
     
    236216  { 
    237217    double d = atof(number_string.c_str()); 
    238     number.SetValue(d, unit); 
     218    number.SetValue(d); 
    239219    if (d == 0.0) 
    240220    { 
     
    251231  { 
    252232    int64_t d = atoll(number_string.c_str()); 
    253     number.SetValue(d, unit); 
     233    number.SetValue(d); 
    254234    if (d == 0LL) 
    255235    { 
  • numeric/tNumber.h

    r46 r101  
    3131 * 
    3232 * Type used in backend of all numeric ports. 
    33  * Can store integer as well as floating point values - together with a unit. 
     33 * Can store integer as well as floating point values. 
    3434 * 
    3535 */ 
     
    4141// External includes (system with <>, local with "") 
    4242//---------------------------------------------------------------------- 
     43#include "rrlib/serialization/serialization.h" 
    4344 
    4445//---------------------------------------------------------------------- 
    4546// Internal includes with "" 
    4647//---------------------------------------------------------------------- 
    47 #include "plugins/data_ports/tUnit.h" 
    4848 
    4949//---------------------------------------------------------------------- 
     
    6767/*! 
    6868 * Type used in backend of all numeric ports. 
    69  * Can store integer as well as floating point values - together with a unit. 
     69 * Can store integer as well as floating point values. 
    7070 */ 
    7171class tNumber 
     
    8484  inline tNumber() : 
    8585    integer_value(0), 
    86     number_type(tType::INT64), 
    87     unit() 
     86    number_type(tType::INT64) 
    8887  {} 
    8988 
    9089  /*! constructor for all integral types. */ 
    9190  template<typename T> 
    92   inline tNumber(T value, typename std::enable_if<std::is_integral<T>::value, tUnit>::type unit = tUnit()) : 
     91  inline tNumber(T value, typename std::enable_if<std::is_integral<T>::value, void*>::type unused = nullptr) : 
    9392    integer_value(value), 
    94     number_type(tType::INT64), 
    95     unit(unit) 
    96   {} 
    97  
    98   inline tNumber(double value, tUnit unit = tUnit()) : 
     93    number_type(tType::INT64) 
     94  {} 
     95 
     96  inline tNumber(double value) : 
    9997    double_value(value), 
    100     number_type(tType::DOUBLE), 
    101     unit(unit) 
    102   {} 
    103  
    104   inline tNumber(float value, tUnit unit = tUnit()) : 
     98    number_type(tType::DOUBLE) 
     99  {} 
     100 
     101  inline tNumber(float value) : 
    105102    float_value(value), 
    106     number_type(tType::FLOAT), 
    107     unit(unit) 
     103    number_type(tType::FLOAT) 
    108104  {} 
    109105 
     
    116112  } 
    117113 
    118   /*! 
    119    * \return Unit of numeric value 
    120    */ 
    121   inline tUnit GetUnit() const 
    122   { 
    123     return unit; 
    124   } 
    125  
    126   /*! 
    127    * Changes unit 
    128    * 
    129    * \param new_unit new unit 
    130    */ 
    131   inline void SetUnit(tUnit new_unit) 
    132   { 
    133     unit = new_unit; 
    134   } 
    135  
    136114  // All kinds of variations of setters 
    137115  template<typename T> 
    138   inline void SetValue(T value, typename std::enable_if<std::is_integral<T>::value, tUnit>::type unit = tUnit()) 
     116  inline void SetValue(T value, typename std::enable_if<std::is_integral<T>::value, void*>::type unused = nullptr) 
    139117  { 
    140118    this->integer_value = value; 
    141     this->unit = unit; 
    142119    number_type = tType::INT64; 
    143120  } 
    144121 
    145   inline void SetValue(float value, tUnit unit = tUnit()) 
     122  inline void SetValue(float value) 
    146123  { 
    147124    this->float_value = value; 
    148     this->unit = unit; 
    149125    number_type = tType::FLOAT; 
    150126  } 
    151127 
    152   inline void SetValue(double value, tUnit unit = tUnit()) 
     128  inline void SetValue(double value) 
    153129  { 
    154130    this->double_value = value; 
    155     this->unit = unit; 
    156131    number_type = tType::DOUBLE; 
    157132  } 
     
    177152  bool operator==(const tNumber& other) const 
    178153  { 
    179     return integer_value == other.integer_value && number_type == other.number_type && unit == other.unit; 
     154    return integer_value == other.integer_value && number_type == other.number_type; 
    180155  } 
    181156 
     
    209184  tType number_type; 
    210185 
    211   /*! Unit of numeric value */ 
    212   tUnit unit; 
    213  
    214186}; 
    215187 
  • optimized/tCheapCopyPort.cpp

    r80 r101  
    100100  standard_assign(!GetFlag(tFlag::NON_STANDARD_ASSIGN) && (!GetFlag(tFlag::HAS_QUEUE))), 
    101101  input_queue(), 
    102   pull_request_handler(NULL), 
    103   unit(creation_info.unit) 
     102  pull_request_handler(NULL) 
    104103{ 
    105104  if ((!IsDataFlowType(GetDataType())) || (!IsCheaplyCopiedType(GetDataType()))) 
  • optimized/tCheapCopyPort.h

    r92 r101  
    375375  } 
    376376 
    377   /*! 
    378    * \return Unit of port 
    379    */ 
    380   inline tUnit GetUnit() 
    381   { 
    382     return unit; 
    383   } 
    384  
    385377//  /*! 
    386378//   * Publish data 
     
    699691  /*! Object that handles pull requests - null if there is none (typical case) */ 
    700692  tPullRequestHandlerRaw* pull_request_handler; 
    701  
    702   /*! Unit of port (currently only used for numeric ports) */ 
    703   tUnit unit; 
    704693 
    705694 
     
    969958    } 
    970959  } 
    971 #else 
    972  
    973 public: 
    974   inline tUnit GetUnit() 
    975   { 
    976     return tUnit::cNO_UNIT; 
    977   } 
    978  
    979960#endif // RRLIB_SINGLE_THREADED 
    980961}; 
  • tGenericPort.h

    r94 r101  
    103103   * A tQueueSettings argument creates an input queue with the specified settings. 
    104104   * tBounds<T> are port's bounds. 
    105    * tUnit argument is port's unit. 
    106105   * tPortCreationBase argument is copied. This is only allowed as first argument. 
    107106   */ 
  • tInputPort.h

    r76 r101  
    103103   * A tQueueSettings argument creates an input queue with the specified settings. 
    104104   * tBounds<T> are port's bounds. 
    105    * tUnit argument is port's unit. 
    106105   * const T& is interpreted as port's default value. 
    107106   * tPortCreationInfo<T> argument is copied. This is only allowed as first argument. 
     
    199198    if (buffer) 
    200199    { 
    201       result = tImplementation::ToValue(buffer->GetObject().template GetData<typename tPort<T>::tPortBuffer>(), this->GetWrapped()->GetUnit()); 
     200      result = tImplementation::ToValue(buffer->GetObject().template GetData<typename tPort<T>::tPortBuffer>()); 
    202201    } 
    203202    return buffer.get(); 
  • tOutputPort.h

    r76 r101  
    9696   * A tQueueSettings argument creates an input queue with the specified settings. 
    9797   * tBounds<T> are port's bounds. 
    98    * tUnit argument is port's unit. 
    9998   * const T& is interpreted as port's default value. 
    10099   * tPortCreationInfo<T> argument is copied. This is only allowed as first argument. 
  • tPort.h

    r99 r101  
    7575 *           can be used in Finroc data ports - even non-copyable ones. 
    7676 *           Get and dequeue operations will return T. Publish operations accept T. 
    77  *           TODO ?: Depending on the intended port use, T can be a plain, reference or smart pointer type: 
    78  *           1) If T is a plain type, Get() will return the port's current value  by value. 
    79  *              This is - naturally - not suitable for non-copyable types. 
    80  *           TODO ?: 2) If T is a reference type, Get() will return a const reference to the port's current value buffer. 
    81  *              This is suitable and efficient for all kinds of data types. 
    82  *              Data buffers are locked (and can be accessed safely) as long as inside the relevant 
    83  *              auto-lock scope (created by instantiating tAutoLockScope) 
    84  *              Such scopes are automatically created by Finroc for Update()/Sense()/Control() methods of modules. 
    85  *           TODO ?: 3) If T is tPortDataPtr<U>, the port returns a tPortDataPtr smart pointer - 
    86  *              used similarly as a standard unique pointer (movable, unique). 
    87  *              On smart pointer destruction, the lock on the buffer is released. 
    88  *              Smart pointers do not support numeric types (due to conversion overhead). 
    8977 */ 
    9078template<typename T> 
     
    138126   * A tQueueSettings argument creates an input queue with the specified settings. 
    139127   * tBounds<T> are port's bounds. 
    140    * tUnit argument is port's unit. 
    141128   * const T& is interpreted as port's default value. 
    142129   * tPortCreationInfo<T> argument is copied. 
     
    185172    tPortBuffer t; 
    186173    GetWrapped()->CopyCurrentValue(t); 
    187     return tImplementation::ToValue(t, GetWrapped()->GetUnit()); 
     174    return tImplementation::ToValue(t); 
    188175#else 
    189176    return GetWrapped()->CurrentValue(); 
     
    197184    tPortBuffer t; 
    198185    GetWrapped()->CopyCurrentValue(t, timestamp); 
    199     return tImplementation::ToValue(t, GetWrapped()->GetUnit()); 
     186    return tImplementation::ToValue(t); 
    200187#else 
    201188    timestamp = GetWrapped()->CurrentTimestamp(); 
  • tProxyPort.h

    r46 r101  
    9191   * A tQueueSettings argument creates an input queue with the specified settings. 
    9292   * tBounds<T> are port's bounds. 
    93    * tUnit argument is port's unit. 
    9493   * const T& is interpreted as port's default value. 
    9594   * tPortCreationInfo<T> argument is copied. This is only allowed as first argument. 
Note: See TracChangeset for help on using the changeset viewer.