83 for(
const auto &v : vec) {
91 template<class T, typename std::enable_if<std::is_floating_point<T>::value>::type * =
nullptr>
95 const std::streamsize previousPrecision = os.precision();
98 os << std::scientific;
101 os << std::setprecision(std::numeric_limits<T>::max_digits10);
108 os.unsetf(std::ios_base::floatfield);
112 os << std::setprecision(previousPrecision);
118 template<class T, typename std::enable_if<std::is_floating_point<T>::value>::type * =
nullptr>
127 template<typename T, typename std::enable_if<std::is_arithmetic<T>::value || std::is_enum<T>::value>::type* =
nullptr>
128 inline void updateHash(
const T& value, boost::uuids::detail::sha1& hash)
130 hash.process_bytes(&value,
sizeof(T));
134 inline void updateHash(
const std::string &
string, boost::uuids::detail::sha1 &hash)
137 hash.process_bytes(
string.data(),
string.size());
141 template<
typename T,
size_t N>
142 inline void updateHash(
const std::array<T, N> &array, boost::uuids::detail::sha1 &hash)
145 for(
const auto &v : array) {
152 inline void updateHash(
const std::vector<T> &vector, boost::uuids::detail::sha1 &hash)
155 for(
const auto &v : vector) {
161 inline void updateHash(
const std::vector<bool> &vector, boost::uuids::detail::sha1 &hash)
164 for(
bool v : vector) {
172 size_t operator()(
const boost::uuids::detail::sha1::digest_type &digest)
const 175 memcpy(&hash, &digest[0],
sizeof(
size_t));
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 i...
Definition: gennUtils.cc:65
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.
Definition: gennUtils.cc:107
GENN_EXPORT bool isTypePointerToPointer(const std::string &type)
Function to determine whether a string containing a type is a pointer to a pointer.
Definition: gennUtils.cc:80
#define GENN_EXPORT
Definition: gennExport.h:13
size_t operator()(const boost::uuids::detail::sha1::digest_type &digest) const
Definition: gennUtils.h:172
GENN_EXPORT std::string getUnderlyingType(const std::string &type)
Assuming type is a string containing a pointer type, function to return the underlying type...
Definition: gennUtils.cc:92
Functor for generating a hash suitable for use in std::unordered_map etc (i.e. size_t size) from a SH...
Definition: gennUtils.h:170
GENN_EXPORT bool isTypePointer(const std::string &type)
Function to determine whether a string containing a type is a pointer.
Definition: gennUtils.cc:75
GENN_EXPORT bool isTypeFloatingPoint(const std::string &type)
Function to determine whether a string containing a type is floating point.
Definition: gennUtils.cc:86
std::string writePreciseString(T value)
This function writes a floating point value to a string - setting the precision so no digits are lost...
Definition: gennUtils.h:119
GENN_EXPORT void updateHash(const Base::Var &v, boost::uuids::detail::sha1 &hash)
Definition: models.cc:222
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...
Definition: gennUtils.cc:127
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: gennUtils.h:22
Definition: gennUtils.h:30
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...
Definition: gennUtils.h:81
GENN_EXPORT void validateParamNames(const std::vector< std::string > ¶mNames)
Are all the parameter names in vector valid? GeNN variables and population names must obey C variable...
Definition: gennUtils.cc:142