Changeset 22:5936c5426df0 in finroc_plugins_network_transport


Ignore:
Timestamp:
14.05.2017 13:26:43 (23 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Unifies serialization of tConnectorInfo and tUriConnectorInfo with tConnectOptions and tUriConnectOptions (removes redundant code)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • generic_protocol/tUriConnector.cpp

    r19 r22  
    8787local_runtime_info(*plugin.LocalRuntimeInfo()) 
    8888{ 
     89  this->flags |= core::tConnectionFlag::NAMED_PARAMETERS; 
    8990  assert(plugin.LocalRuntimeInfo()); 
    9091  this->owner_port = &owner_port; 
  • runtime_info/tConnectorInfo.h

    r18 r22  
    8787  struct tStaticInfo 
    8888  { 
    89     /*! Flags set for this connector */ 
    90     core::tConnectionFlags flags; 
    91  
    92     /*! Conversion operations for this connector */ 
    93     rrlib::rtti::conversion::tConversionOperationSequence conversion_operations; 
     89    /*! Flags and conversion operations for this connector */ 
     90    core::tConnectOptions flags_and_conversion_operations; 
    9491 
    9592    tStaticInfo(const core::tConnector& connector) : 
    96       flags(connector.Flags()), 
    97       conversion_operations(connector.ConversionOperations()) 
     93      flags_and_conversion_operations({ connector.ConversionOperations(), connector.Flags() }) 
    9894    {} 
    9995 
     
    105101    static_info(connector) 
    106102  {} 
     103 
     104  friend inline rrlib::serialization::tOutputStream& operator << (rrlib::serialization::tOutputStream& stream, const tID& info); 
     105  friend inline rrlib::serialization::tOutputStream& operator << (rrlib::serialization::tOutputStream& stream, const tStaticInfo& info); 
    107106 
    108107  /*! 
     
    116115  { 
    117116    stream << tID(connector); 
    118     auto& flags = connector.Flags(); 
    119     stream.WriteShort(flags.Raw() & 0xFFFF); 
    120     if (flags.Get(core::tConnectionFlag::CONVERSION)) 
    121     { 
    122       stream << connector.ConversionOperations(); 
    123     } 
     117    stream << tStaticInfo(connector); 
    124118  } 
    125119}; 
     
    133127inline rrlib::serialization::tOutputStream& operator << (rrlib::serialization::tOutputStream& stream, const tConnectorInfo::tStaticInfo& info) 
    134128{ 
    135   stream.WriteShort(info.flags.Raw() & 0xFFFF); 
    136   if (info.flags.Get(core::tConnectionFlag::CONVERSION)) 
    137   { 
    138     stream << info.conversion_operations; 
    139   } 
     129  stream << info.flags_and_conversion_operations; 
    140130  return stream; 
    141131} 
  • runtime_info/tUriConnectorInfo.cpp

    r18 r22  
    8585{ 
    8686  stream << tID(connector); 
    87   tStaticInfo::Serialize(stream, connector.Flags(), connector.ConversionOperations(), connector.Uri(), connector.GetSchemeHandler()); 
     87  core::tConnectOptions options = { connector.ConversionOperations(), connector.Flags() }; 
     88  tStaticInfo::Serialize(stream, options, connector.Uri(), connector.GetSchemeHandler()); 
    8889  stream << tDynamicInfo(connector); 
    8990} 
    9091 
    91 void tUriConnectorInfo::tStaticInfo::Serialize(rrlib::serialization::tOutputStream& stream, const core::tUriConnector::tFlags& flags, const rrlib::rtti::conversion::tConversionOperationSequence& conversion_operations, const rrlib::uri::tURI& uri, const core::tUriConnector::tSchemeHandler& scheme_handler) 
     92void tUriConnectorInfo::tStaticInfo::Serialize(rrlib::serialization::tOutputStream& stream, const core::tConnectOptions& flags_and_conversion_operations, const rrlib::uri::tURI& uri, const core::tUriConnector::tSchemeHandler& scheme_handler) 
    9293{ 
    93   stream.WriteShort(flags.Raw() & 0xFFFF); 
    94   if (flags.Get(core::tConnectionFlag::CONVERSION)) 
    95   { 
    96     stream << conversion_operations; 
    97   } 
     94  flags_and_conversion_operations.Serialize(stream, false); 
    9895  stream << uri << scheme_handler; 
    9996} 
  • runtime_info/tUriConnectorInfo.h

    r18 r22  
    7474    core::tFrameworkElement::tHandle owner_handle = 0; 
    7575 
    76     /*! Index of URI connector */ 
     76    /*! Index of URI connector in owner list */ 
    7777    uint8_t index = 0; 
    7878 
     
    8686  struct tStaticInfo 
    8787  { 
    88     /*! Flags set for this connector */ 
    89     core::tUriConnector::tFlags flags; 
    90  
    91     /*! Conversion operations for this connector */ 
    92     rrlib::rtti::conversion::tConversionOperationSequence conversion_operations; 
     88    /*! Flags and conversion operations for this connector */ 
     89    core::tConnectOptions flags_and_conversion_operations; 
    9390 
    9491    /*! URI of partner port (preferably normalized) */ 
     
    9996 
    10097    tStaticInfo(const core::tUriConnector& connector) : 
    101       flags(connector.Flags()), 
    102       conversion_operations(connector.ConversionOperations()), 
    103       uri(connector.Uri()), 
    104       scheme_handler(&connector.GetSchemeHandler()) 
     98      flags_and_conversion_operations({ connector.ConversionOperations(), connector.Flags() }), 
     99                                    uri(connector.Uri()), 
     100                                    scheme_handler(&connector.GetSchemeHandler()) 
    105101    {} 
    106102 
    107     static void Serialize(rrlib::serialization::tOutputStream& stream, const core::tUriConnector::tFlags& flags, const rrlib::rtti::conversion::tConversionOperationSequence& conversion_operations, 
     103    static void Serialize(rrlib::serialization::tOutputStream& stream, const core::tConnectOptions& flags_and_conversion_operations, 
    108104                          const rrlib::uri::tURI& uri, const core::tUriConnector::tSchemeHandler& scheme_handler); 
    109105 
     
    153149inline rrlib::serialization::tOutputStream& operator << (rrlib::serialization::tOutputStream& stream, const tUriConnectorInfo::tStaticInfo& info) 
    154150{ 
    155   tUriConnectorInfo::tStaticInfo::Serialize(stream, info.flags, info.conversion_operations, info.uri, *info.scheme_handler); 
     151  tUriConnectorInfo::tStaticInfo::Serialize(stream, info.flags_and_conversion_operations, info.uri, *info.scheme_handler); 
    156152  return stream; 
    157153} 
Note: See TracChangeset for help on using the changeset viewer.