Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions models/diffusion_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class diffusion_connection : public Connection< targetidentifierT >
{
}

SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

// Explicitly declare all methods inherited from the dependent base
// ConnectionBase.
Expand Down Expand Up @@ -214,10 +214,10 @@ diffusion_connection< targetidentifierT >::set_status( const DictionaryDatum& d,


template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
diffusion_connection< targetidentifierT >::get_secondary_event()
{
return new DiffusionConnectionEvent();
return std::make_unique< DiffusionConnectionEvent >();
}

} // namespace
Expand Down
6 changes: 3 additions & 3 deletions models/eprop_learning_signal_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class eprop_learning_signal_connection : public Connection< targetidentifierT >
}

//! Get the secondary learning signal event.
SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

using ConnectionBase::get_delay_steps;
using ConnectionBase::get_rport;
Expand Down Expand Up @@ -220,10 +220,10 @@ eprop_learning_signal_connection< targetidentifierT >::set_status( const Diction
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
eprop_learning_signal_connection< targetidentifierT >::get_secondary_event()
{
return new LearningSignalConnectionEvent();
return std::make_unique< LearningSignalConnectionEvent >();
}

} // namespace nest
Expand Down
6 changes: 3 additions & 3 deletions models/eprop_learning_signal_connection_bsshslm_2020.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class eprop_learning_signal_connection_bsshslm_2020 : public Connection< targeti
}

//! Get the secondary learning signal event.
SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

using ConnectionBase::get_delay_steps;
using ConnectionBase::get_rport;
Expand Down Expand Up @@ -224,10 +224,10 @@ eprop_learning_signal_connection_bsshslm_2020< targetidentifierT >::set_status(
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
eprop_learning_signal_connection_bsshslm_2020< targetidentifierT >::get_secondary_event()
{
return new LearningSignalConnectionEvent();
return std::make_unique< LearningSignalConnectionEvent >();
}

} // namespace nest
Expand Down
6 changes: 3 additions & 3 deletions models/gap_junction.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class gap_junction : public Connection< targetidentifierT >
{
}

SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

// Explicitly declare all methods inherited from the dependent base
// ConnectionBase. This avoids explicit name prefixes in all places these
Expand Down Expand Up @@ -177,10 +177,10 @@ gap_junction< targetidentifierT >::get_status( DictionaryDatum& d ) const
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
gap_junction< targetidentifierT >::get_secondary_event()
{
return new GapJunctionEvent();
return std::make_unique< GapJunctionEvent >();
}

template < typename targetidentifierT >
Expand Down
6 changes: 3 additions & 3 deletions models/rate_connection_delayed.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class rate_connection_delayed : public Connection< targetidentifierT >
{
}

SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

// Explicitly declare all methods inherited from the dependent base
// ConnectionBase.
Expand Down Expand Up @@ -174,10 +174,10 @@ rate_connection_delayed< targetidentifierT >::set_status( const DictionaryDatum&
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
rate_connection_delayed< targetidentifierT >::get_secondary_event()
{
return new DelayedRateConnectionEvent();
return std::make_unique< DelayedRateConnectionEvent >();
}

} // namespace
Expand Down
6 changes: 3 additions & 3 deletions models/rate_connection_instantaneous.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class rate_connection_instantaneous : public Connection< targetidentifierT >
{
}

SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

// Explicitly declare all methods inherited from the dependent base
// ConnectionBase.
Expand Down Expand Up @@ -189,10 +189,10 @@ rate_connection_instantaneous< targetidentifierT >::set_status( const Dictionary
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
rate_connection_instantaneous< targetidentifierT >::get_secondary_event()
{
return new InstantaneousRateConnectionEvent();
return std::make_unique< InstantaneousRateConnectionEvent >();
}

} // namespace
Expand Down
6 changes: 3 additions & 3 deletions models/sic_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class sic_connection : public Connection< targetidentifierT >
{
}

SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

// Explicitly declare all methods inherited from the dependent base
// ConnectionBase. This avoids explicit name prefixes in all places these
Expand Down Expand Up @@ -154,10 +154,10 @@ sic_connection< targetidentifierT >::get_status( DictionaryDatum& d ) const
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
sic_connection< targetidentifierT >::get_secondary_event()
{
return new SICEvent();
return std::make_unique< SICEvent >();
}

template < typename targetidentifierT >
Expand Down
4 changes: 2 additions & 2 deletions nestkernel/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Connection
* To prevent erronous calls of this function on primary connections, the base class implementation
* below just contains `assert(false)`.
*/
SecondaryEvent* get_secondary_event();
std::unique_ptr< SecondaryEvent > get_secondary_event();

/**
* Get all properties of this connection and put them into a dictionary.
Expand Down Expand Up @@ -399,7 +399,7 @@ Connection< targetidentifierT >::trigger_update_weight( const size_t,
}

template < typename targetidentifierT >
SecondaryEvent*
std::unique_ptr< SecondaryEvent >
Connection< targetidentifierT >::get_secondary_event()
{
assert( false and "Non-primary connections have to provide get_secondary_event()" );
Expand Down
9 changes: 5 additions & 4 deletions nestkernel/connection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,19 +1681,20 @@ nest::ConnectionManager::deliver_secondary_events( const size_t tid,
{
if ( positions_tid[ syn_id ].size() > 0 )
{
SecondaryEvent& prototype = kernel().model_manager.get_secondary_event_prototype( syn_id, tid );
std::unique_ptr< SecondaryEvent > prototype =
kernel().model_manager.get_secondary_event_prototype( syn_id, tid );

size_t lcid = 0;
const size_t lcid_end = positions_tid[ syn_id ].size();
while ( lcid < lcid_end )
{
std::vector< unsigned int >::iterator readpos = recv_buffer.begin() + positions_tid[ syn_id ][ lcid ];
prototype << readpos;
prototype.set_stamp( stamp );
*prototype << readpos;
prototype->set_stamp( stamp );

// send delivers event to all targets with the same source
// and returns how many targets this event was delivered to
lcid += connections_[ tid ][ syn_id ]->send( tid, lcid, cm, prototype );
lcid += connections_[ tid ][ syn_id ]->send( tid, lcid, cm, *prototype );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions nestkernel/connector_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ConnectorModel
*/
virtual void check_synapse_params( const DictionaryDatum& ) const = 0;

virtual SecondaryEvent* get_secondary_event() = 0;
virtual std::unique_ptr< SecondaryEvent > get_secondary_event() = 0;

virtual size_t get_syn_id() const = 0;
virtual void set_syn_id( synindex syn_id ) = 0;
Expand Down Expand Up @@ -199,7 +199,7 @@ class GenericConnectorModel : public ConnectorModel

void check_synapse_params( const DictionaryDatum& syn_spec ) const override;

SecondaryEvent*
std::unique_ptr< SecondaryEvent >
get_secondary_event() override
{
return default_connection_.get_secondary_event();
Expand Down
6 changes: 3 additions & 3 deletions nestkernel/model_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class ModelManager : public ManagerInterface
*/
void memory_info() const;

SecondaryEvent& get_secondary_event_prototype( const synindex syn_id, const size_t tid );
std::unique_ptr< SecondaryEvent > get_secondary_event_prototype( const synindex syn_id, const size_t tid );

private:
/**
Expand Down Expand Up @@ -319,11 +319,11 @@ ModelManager::assert_valid_syn_id( synindex syn_id, size_t t ) const
}
}

inline SecondaryEvent&
inline std::unique_ptr< SecondaryEvent >
ModelManager::get_secondary_event_prototype( const synindex syn_id, const size_t tid )
{
assert_valid_syn_id( syn_id, tid );
return *get_connection_model( syn_id, tid ).get_secondary_event();
return get_connection_model( syn_id, tid ).get_secondary_event();
}

} // namespace nest
Expand Down
2 changes: 1 addition & 1 deletion nestkernel/source_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ nest::SourceTable::compute_buffer_pos_for_unique_secondary_sources( const size_t
++cit )
{
const size_t source_rank = kernel().mpi_manager.get_process_id_of_node_id( cit->first );
const size_t event_size = kernel().model_manager.get_secondary_event_prototype( cit->second, tid ).size();
const size_t event_size = kernel().model_manager.get_secondary_event_prototype( cit->second, tid )->size();

buffer_pos_of_source_node_id_syn_id.insert(
std::make_pair( pack_source_node_id_and_syn_id( cit->first, cit->second ),
Expand Down
Loading