@@ -110,12 +110,13 @@ inline fast_any::any* SignalBus::GetSignal( int signalIndex )
110110{
111111 // You might be thinking: Why the raw pointer return here?
112112
113- // This is for usability, performance, and readably. Usability, because a pointer allows the
114- // user to manipulate the contained value externally. Performance, because returning a smart
115- // pointer here means having to store the value as a smart pointer too. This adds yet another
116- // level of indirection to the value, as well as some reference counting overhead. These Get()
117- // and Set() methods are VERY frequently called, so doing as little as possible with the data
118- // here is best, which ultimately aids in the readably of the code too.
113+ // This is for usability, design, and performance reasons. Usability, because a pointer allows
114+ // the user to manipulate the contained value externally. Design, because DSPatch doesn't use
115+ // exceptions - a nullptr return here is the equivalent of "signal does not exist".
116+ // Performance, because returning a smart pointer means having to store the value as a smart
117+ // pointer too - this adds yet another level of indirection to the value, as well as some
118+ // reference counting overhead. These Get() and Set() methods are VERY frequently called, so
119+ // doing as little as possible with the data here is best.
119120
120121 if ( (size_t )signalIndex < _signals.size () )
121122 {
@@ -142,6 +143,10 @@ inline bool SignalBus::HasValue( int signalIndex ) const
142143template <typename ValueType>
143144inline ValueType* SignalBus::GetValue ( int signalIndex ) const
144145{
146+ // You might be thinking: Why the raw pointer return here?
147+
148+ // See: GetSignal().
149+
145150 if ( (size_t )signalIndex < _signals.size () )
146151 {
147152 return _signals[signalIndex].as <ValueType>();
0 commit comments