Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix to issue nest#683.
- A second template argument to member function register_connection_model of the ModelManager has been added, which allows the user to specify the type of connector model.
- An overloaded function to register_connection_model has been added that uses the default connector model GenericConnectorModel.
  • Loading branch information
Kappel David authored and Kappel David committed Mar 20, 2017
1 parent 4a373f7 commit 9de540f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
14 changes: 12 additions & 2 deletions nestkernel/model_manager.h
Expand Up @@ -180,13 +180,23 @@ class ModelManager : public ManagerInterface
void set_model_defaults( Name name, DictionaryDatum params );

/**
* Register a synape with default Connector and without any common properties.
* Register a synape model with default Connector and without any common
* properties. Convenience function that used the default Connector model
* GenericConnectorModel.
* @param name The name under which the ConnectorModel will be registered.
* @return an ID for the synapse prototype.
*/
template < class ConnectionT >
void register_connection_model( const std::string& name,
bool requires_symmetric = false );

/**
* Register a synape model with a costom Connector model and without any
* common properties.
* @param name The name under which the ConnectorModel will be registered.
*/
template < class ConnectionT, template<class> class ConnectorModelT >
void register_connection_model( const std::string& name,
bool requires_symmetric = false );

template < class ConnectionT >
void register_secondary_connection_model( const std::string& name,
Expand Down
14 changes: 11 additions & 3 deletions nestkernel/model_manager_impl.h
Expand Up @@ -83,18 +83,18 @@ ModelManager::register_preconf_node_model( const Name& name,
return register_node_model_( model, private_model );
}

template < class ConnectionT >
template < class ConnectionT, template<class> class ConnectorModelT >
void
ModelManager::register_connection_model( const std::string& name,
bool requires_symmetric )
{
ConnectorModel* cf = new GenericConnectorModel< ConnectionT >(
ConnectorModel* cf = new ConnectorModelT< ConnectionT >(
name, /*is_primary=*/true, /*has_delay=*/true, requires_symmetric );
register_connection_model_( cf );

if ( not ends_with( name, "_hpc" ) )
{
cf = new GenericConnectorModel< ConnectionLabel< ConnectionT > >(
cf = new ConnectorModelT< ConnectionLabel< ConnectionT > >(
name + "_lbl",
/*is_primary=*/true,
/*has_delay=*/true,
Expand All @@ -103,6 +103,14 @@ ModelManager::register_connection_model( const std::string& name,
}
}

template < class ConnectionT >
void
ModelManager::register_connection_model( const std::string& name,
bool requires_symmetric )
{
register_connection_model< ConnectionT, GenericConnectorModel >( name, requires_symmetric );
}

/**
* Register a synape with default Connector and without any common properties.
*/
Expand Down

0 comments on commit 9de540f

Please sign in to comment.