synindex ConnectionManager::copy_synapse_prototype( synindex old_id, std::string new_name ) { // we can assert here, as nestmodule checks this for us assert( !synapsedict_->known( new_name ) ); int new_id = prototypes_[ 0 ].size(); if ( new_id == invalid_synindex ) // we wrapped around (=255), maximal id of synapse_model = 254 { net_.message( SLIInterpreter::M_ERROR, "ConnectionManager::copy_synapse_prototype", "CopyModel cannot generate another synapse. Maximal synapse model count of 255 exceeded." ); throw KernelException( "Synapse model count exceeded" ); } assert( new_id != invalid_synindex ); // if the copied synapse is a secondary connector model the synid of the copy has to // be mapped to the corresponding secondary event type if ( not get_synapse_prototype( old_id ).is_primary() ) { ( get_synapse_prototype( old_id ).get_event() )->add_syn_id( new_id ); } for ( thread t = 0; t < net_.get_num_threads(); ++t ) { prototypes_[ t ].push_back( get_synapse_prototype( old_id ).clone( new_name ) ); prototypes_[ t ][ new_id ]->set_syn_id( new_id ); } synapsedict_->insert( new_name, new_id ); return new_id; }
index ModelManager::copy_synapse_model_( index old_id, Name new_name ) { size_t new_id = prototypes_[ 0 ].size(); if ( new_id == invalid_synindex ) // we wrapped around (=255), maximal id of // synapse_model = 254 { LOG( M_ERROR, "ModelManager::copy_synapse_model_", "CopyModel cannot generate another synapse. Maximal synapse model count " "of 255 exceeded." ); throw KernelException( "Synapse model count exceeded" ); } assert( new_id != invalid_synindex ); // if the copied synapse is a secondary connector model the synid of the copy // has to be mapped to the corresponding secondary event type if ( not get_synapse_prototype( old_id ).is_primary() ) { ( get_synapse_prototype( old_id ).get_event() )->add_syn_id( new_id ); } for ( thread t = 0; t < static_cast< thread >( kernel().vp_manager.get_num_threads() ); ++t ) { prototypes_[ t ].push_back( get_synapse_prototype( old_id ).clone( new_name.toString() ) ); prototypes_[ t ][ new_id ]->set_syn_id( new_id ); } synapsedict_->insert( new_name, new_id ); return new_id; }
DictionaryDatum ConnectionManager::get_synapse_status( index gid, synindex syn_id, port p, thread tid ) { assert_valid_syn_id( syn_id ); DictionaryDatum dict( new Dictionary ); validate_pointer( connections_[ tid ].get( gid ) )->get_synapse_status( syn_id, dict, p ); ( *dict )[ names::source ] = gid; ( *dict )[ names::synapse_model ] = LiteralDatum( get_synapse_prototype( syn_id ).get_name() ); return dict; }