GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
Utils Namespace Reference

Classes

struct  SHA1Hash
 Functor for generating a hash suitable for use in std::unordered_map etc (i.e. size_t size) from a SHA1 digests. More...
 

Functions

GENN_EXPORT bool isRNGRequired (const std::string &code)
 Does the code string contain any functions requiring random number generator. More...
 
GENN_EXPORT bool isRNGRequired (const std::vector< Models::VarInit > &varInitialisers)
 Does the model with the vectors of variable initialisers and modes require an RNG for the specified init location i.e. host or device. More...
 
GENN_EXPORT bool isTypePointer (const std::string &type)
 Function to determine whether a string containing a type is a pointer. More...
 
GENN_EXPORT bool isTypePointerToPointer (const std::string &type)
 Function to determine whether a string containing a type is a pointer to a pointer. More...
 
GENN_EXPORT bool isTypeFloatingPoint (const std::string &type)
 Function to determine whether a string containing a type is floating point. More...
 
GENN_EXPORT std::string getUnderlyingType (const std::string &type)
 Assuming type is a string containing a pointer type, function to return the underlying type. More...
 
GENN_EXPORT void validateVarName (const std::string &name, const std::string &description)
 Is the variable name valid? GeNN variable names must obey C variable naming rules. More...
 
GENN_EXPORT void validatePopName (const std::string &name, const std::string &description)
 Is the population name valid? GeNN population names obey C variable naming rules but can start with a number. More...
 
GENN_EXPORT void validateParamNames (const std::vector< std::string > &paramNames)
 Are all the parameter names in vector valid? GeNN variables and population names must obey C variable naming rules. More...
 
template<typename T >
void validateVecNames (const std::vector< T > &vec, const std::string &description)
 Are the 'name' fields of all structs in vector valid? GeNN variables and population names must obey C variable naming rules. More...
 
template<class T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
void writePreciseString (std::ostream &os, T value)
 This function writes a floating point value to a stream -setting the precision so no digits are lost. More...
 
template<class T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
std::string writePreciseString (T value)
 This function writes a floating point value to a string - setting the precision so no digits are lost. More...
 
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value||std::is_enum< T >::value >::type * = nullptr>
void updateHash (const T &value, boost::uuids::detail::sha1 &hash)
 Hash arithmetic types and enums. More...
 
void updateHash (const std::string &string, boost::uuids::detail::sha1 &hash)
 Hash strings. More...
 
template<typename T , size_t N>
void updateHash (const std::array< T, N > &array, boost::uuids::detail::sha1 &hash)
 Hash arrays of types which can, themselves, be hashed. More...
 
template<typename T >
void updateHash (const std::vector< T > &vector, boost::uuids::detail::sha1 &hash)
 Hash vectors of types which can, themselves, be hashed. More...
 
void updateHash (const std::vector< bool > &vector, boost::uuids::detail::sha1 &hash)
 Hash vectors of bools. More...
 

Function Documentation

◆ getUnderlyingType()

std::string Utils::getUnderlyingType ( const std::string &  type)

Assuming type is a string containing a pointer type, function to return the underlying type.

◆ isRNGRequired() [1/2]

bool Utils::isRNGRequired ( const std::string &  code)

Does the code string contain any functions requiring random number generator.

◆ isRNGRequired() [2/2]

bool Utils::isRNGRequired ( const std::vector< Models::VarInit > &  varInitialisers)

Does the model with the vectors of variable initialisers and modes require an RNG for the specified init location i.e. host or device.

◆ isTypeFloatingPoint()

bool Utils::isTypeFloatingPoint ( const std::string &  type)

Function to determine whether a string containing a type is floating point.

◆ isTypePointer()

bool Utils::isTypePointer ( const std::string &  type)

Function to determine whether a string containing a type is a pointer.

◆ isTypePointerToPointer()

bool Utils::isTypePointerToPointer ( const std::string &  type)

Function to determine whether a string containing a type is a pointer to a pointer.

◆ updateHash() [1/5]

template<typename T , typename std::enable_if< std::is_arithmetic< T >::value||std::is_enum< T >::value >::type * = nullptr>
void Utils::updateHash ( const T &  value,
boost::uuids::detail::sha1 &  hash 
)
inline

Hash arithmetic types and enums.

◆ updateHash() [2/5]

void Utils::updateHash ( const std::string &  string,
boost::uuids::detail::sha1 &  hash 
)
inline

Hash strings.

◆ updateHash() [3/5]

template<typename T , size_t N>
void Utils::updateHash ( const std::array< T, N > &  array,
boost::uuids::detail::sha1 &  hash 
)
inline

Hash arrays of types which can, themselves, be hashed.

◆ updateHash() [4/5]

template<typename T >
void Utils::updateHash ( const std::vector< T > &  vector,
boost::uuids::detail::sha1 &  hash 
)
inline

Hash vectors of types which can, themselves, be hashed.

◆ updateHash() [5/5]

void Utils::updateHash ( const std::vector< bool > &  vector,
boost::uuids::detail::sha1 &  hash 
)
inline

Hash vectors of bools.

◆ validateParamNames()

void Utils::validateParamNames ( const std::vector< std::string > &  paramNames)

Are all the parameter names in vector valid? GeNN variables and population names must obey C variable naming rules.

◆ validatePopName()

void Utils::validatePopName ( const std::string &  name,
const std::string &  description 
)

Is the population name valid? GeNN population names obey C variable naming rules but can start with a number.

◆ validateVarName()

void Utils::validateVarName ( const std::string &  name,
const std::string &  description 
)

Is the variable name valid? GeNN variable names must obey C variable naming rules.

◆ validateVecNames()

template<typename T >
void Utils::validateVecNames ( const std::vector< T > &  vec,
const std::string &  description 
)

Are the 'name' fields of all structs in vector valid? GeNN variables and population names must obey C variable naming rules.

◆ writePreciseString() [1/2]

template<class T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
void Utils::writePreciseString ( std::ostream &  os,
value 
)

This function writes a floating point value to a stream -setting the precision so no digits are lost.

◆ writePreciseString() [2/2]

template<class T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
std::string Utils::writePreciseString ( value)
inline

This function writes a floating point value to a string - setting the precision so no digits are lost.