Exemplo n.º 1
0
synindex
ConnectionManager::register_synapse_prototype( ConnectorModel* cf )
{
  std::string name = cf->get_name();

  if ( synapsedict_->known( name ) )
  {
    delete cf;
    throw NamingConflict("A synapse type called '" + name + "' already exists.\n"
                         "Please choose a different name!");
  }

  pristine_prototypes_.push_back( cf );

  const synindex id = prototypes_[ 0 ].size();
  pristine_prototypes_[ id ]->set_syn_id( id );

  for ( thread t = 0; t < net_.get_num_threads(); ++t )
  {
    prototypes_[ t ].push_back( cf->clone( name ) );
    prototypes_[ t ][ id ]->set_syn_id( id );
  }

  synapsedict_->insert( name, id );

  return id;
}
Exemplo n.º 2
0
synindex
ModelManager::register_connection_model_( ConnectorModel* cf )
{
  if ( synapsedict_->known( cf->get_name() ) )
  {
    delete cf;
    std::string msg = String::compose(
      "A synapse type called '%1' already exists.\n"
      "Please choose a different name!",
      cf->get_name() );
    throw NamingConflict( msg );
  }

  pristine_prototypes_.push_back( cf );

  const synindex syn_id = prototypes_[ 0 ].size();
  pristine_prototypes_[ syn_id ]->set_syn_id( syn_id );

  for ( thread t = 0;
        t < static_cast< thread >( kernel().vp_manager.get_num_threads() );
        ++t )
  {
    prototypes_[ t ].push_back( cf->clone( cf->get_name() ) );
    prototypes_[ t ][ syn_id ]->set_syn_id( syn_id );
  }

  synapsedict_->insert( cf->get_name(), syn_id );

  return syn_id;
}