GeNN  2.2.3
GPU enhanced Neuronal Networks (GeNN)
stringUtils.h
Go to the documentation of this file.
1 
2 #ifndef STRINGUTILS_H
3 #define STRINGUTILS_H
4 
5 #include <string>
6 #include <sstream>
7 #include <vector>
8 
9 
10 // Forward declarations
11 class NNmodel;
12 
13 using namespace std;
14 
15 
16 //--------------------------------------------------------------------------
19 //--------------------------------------------------------------------------
20 
21 template<class T> std::string toString(T t)
22 {
23  std::stringstream s;
24  s << std::showpoint << t;
25  return s.str();
26 }
27 
28 #define tS(X) toString(X)
29 
30 
31 //--------------------------------------------------------------------------
33 //--------------------------------------------------------------------------
34 
35 void substitute(string &s, const string &trg, const string &rep);
36 
37 
38 //--------------------------------------------------------------------------
40 //--------------------------------------------------------------------------
41 
42 void name_substitutions(string &code, const string &prefix, const vector<string> &names, const string &postfix= "");
43 
44 
45 //--------------------------------------------------------------------------
47 //--------------------------------------------------------------------------
48 
49 void value_substitutions(string &code, const vector<string> &names, const vector<double> &values);
50 
51 
52 //--------------------------------------------------------------------------
54 //--------------------------------------------------------------------------
55 
56 void extended_name_substitutions(string &code, const string &prefix, const vector<string> &names, const string &ext, const string &postfix= "");
57 
58 
59 //--------------------------------------------------------------------------
61 //--------------------------------------------------------------------------
62 
63 void extended_value_substitutions(string &code, const vector<string> &names, const string &ext, const vector<double> &values);
64 
65 
66 //--------------------------------------------------------------------------
69 //--------------------------------------------------------------------------
70 
71 string ensureFtype(const string &oldcode, const string &type);
72 
73 
74 //--------------------------------------------------------------------------
77 //--------------------------------------------------------------------------
78 
79 void checkUnreplacedVariables(string code, string codeName);
80 
81 
82 //-------------------------------------------------------------------------
86 //-------------------------------------------------------------------------
87 
89  string &wCode,
90  const NNmodel &model,
91  unsigned int src,
92  unsigned int trg,
93  unsigned int nt_pre,
94  unsigned int nt_post,
95  const string &offsetPre,
96  const string &offsetPost,
97  const string &preIdx,
98  const string &postIdx,
99  const string &devPrefix
100  );
101 
102 #endif // STRINGUTILS_H
void extended_name_substitutions(string &code, const string &prefix, const vector< string > &names, const string &ext, const string &postfix="")
This function performs a list of name substitutions for variables in code snippets where the variable...
Definition: stringUtils.cc:243
Definition: modelSpec.h:85
void value_substitutions(string &code, const vector< string > &names, const vector< double > &values)
This function performs a list of value substitutions for parameters in code snippets.
Definition: stringUtils.cc:229
void checkUnreplacedVariables(string code, string codeName)
This function checks for unknown variable definitions and returns a gennError if any are found...
Definition: stringUtils.cc:372
string ensureFtype(const string &oldcode, const string &type)
This function implements a parser that converts any floating point constant in a code snippet to a fl...
Definition: stringUtils.cc:269
void extended_value_substitutions(string &code, const vector< string > &names, const string &ext, const vector< double > &values)
This function performs a list of value substitutions for parameters in code snippets where the parame...
Definition: stringUtils.cc:254
void name_substitutions(string &code, const string &prefix, const vector< string > &names, const string &postfix="")
This function performs a list of name substitutions for variables in code snippets.
Definition: stringUtils.cc:218
void neuron_substitutions_in_synaptic_code(string &wCode, const NNmodel &model, unsigned int src, unsigned int trg, unsigned int nt_pre, unsigned int nt_post, const string &offsetPre, const string &offsetPost, const string &preIdx, const string &postIdx, const string &devPrefix)
Function for performing the code and value substitutions necessary to insert neuron related variables...
Definition: stringUtils.cc:399
std::string toString(T t)
template functions for conversion of various types to C++ strings
Definition: stringUtils.h:21
void substitute(string &s, const string &trg, const string &rep)
Tool for substituting strings in the neuron code strings or other templates.
Definition: stringUtils.cc:205