Skip to content

Commit 5381b70

Browse files
fixed enum classes
1 parent 920b2ee commit 5381b70

File tree

9 files changed

+19
-9
lines changed

9 files changed

+19
-9
lines changed

Simulator/Edges/AllEdges.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void AllEdges::writeEdge(ostream &output, BGSIZE iEdg) const
116116
output << sourceVertexIndex_[iEdg] << ends;
117117
output << destVertexIndex_[iEdg] << ends;
118118
output << W_[iEdg] << ends;
119-
output << static_cast<int>(type_[iEdg]) << ends;
119+
output << type_[iEdg] << ends;
120120
output << (inUse_[iEdg] == 1 ? "true" : "false") << ends;
121121
}
122122

Simulator/Edges/Neuro/AllDSSynapses_d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ void AllDSSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const
310310
cout << "GPU W[" << i << "] = " << WPrint[i];
311311
cout << " GPU sourNeuron: " << sourceNeuronIndexPrint[i];
312312
cout << " GPU desNeuron: " << destNeuronIndexPrint[i];
313-
cout << " GPU type: " << static_cast<int>(typePrint[i]);
313+
cout << " GPU type: " << typePrint[i];
314314
cout << " GPU psr: " << psrPrint[i];
315315
cout << " GPU in_use:" << (inUsePrint[i] == 1 ? "true" : "false");
316316

Simulator/Edges/Neuro/AllDynamicSTDPSynapses_d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ void AllDynamicSTDPSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const
349349
cout << "GPU W[" << i << "] = " << WPrint[i];
350350
cout << " GPU sourNeuron: " << sourceNeuronIndexPrint[i];
351351
cout << " GPU desNeuron: " << destNeuronIndexPrint[i];
352-
cout << " GPU type: " << static_cast<int>(typePrint[i]);
352+
cout << " GPU type: " << typePrint[i];
353353
cout << " GPU psr: " << psrPrint[i];
354354
cout << " GPU in_use:" << (inUsePrint[i] == 1 ? "true" : "false");
355355

Simulator/Edges/Neuro/AllNeuroEdges.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void AllNeuroEdges::writeEdge(ostream &output, BGSIZE iEdg) const
7272
output << destVertexIndex_[iEdg] << ends;
7373
output << W_[iEdg] << ends;
7474
output << psr_[iEdg] << ends;
75-
output << static_cast<int>(type_[iEdg]) << ends;
75+
output << type_[iEdg] << ends;
7676
output << (inUse_[iEdg] == 1 ? "true" : "false") << ends;
7777
}
7878

@@ -107,7 +107,7 @@ void AllNeuroEdges::printSynapsesProps() const
107107
cout << "W[" << i << "] = " << W_[i];
108108
cout << " sourNeuron: " << sourceVertexIndex_[i];
109109
cout << " desNeuron: " << destVertexIndex_[i];
110-
cout << " type: " << static_cast<int>(type_[i]);
110+
cout << " type: " << type_[i];
111111
cout << " psr: " << psr_[i];
112112
cout << " in_use:" << (inUse_[i] == 1 ? "true" : "false");
113113
}

Simulator/Edges/Neuro/AllSTDPSynapses_d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void AllSTDPSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const
387387
cout << "GPU W[" << i << "] = " << WPrint[i];
388388
cout << " GPU sourNeuron: " << sourceNeuronIndexPrint[i];
389389
cout << " GPU desNeuron: " << destNeuronIndexPrint[i];
390-
cout << " GPU type: " << static_cast<int>(typePrint[i]);
390+
cout << " GPU type: " << typePrint[i];
391391
cout << " GPU psr: " << psrPrint[i];
392392
cout << " GPU in_use:" << (inUsePrint[i] == 1 ? "true" : "false");
393393

Simulator/Edges/Neuro/AllSpikingSynapses_d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ void AllSpikingSynapses::printGPUEdgesProps(void *allEdgesDeviceProps) const
405405
cout << "GPU W[" << i << "] = " << WPrint[i];
406406
cout << " GPU sourNeuron: " << sourceNeuronIndexPrint[i];
407407
cout << " GPU desNeuron: " << destNeuronIndexPrint[i];
408-
cout << " GPU type: " << static_cast<int>(typePrint[i]);
408+
cout << " GPU type: " << typePrint[i];
409409
cout << " GPU psr: " << psrPrint[i];
410410
cout << " GPU in_use:" << (inUsePrint[i] == 1 ? "true" : "false");
411411
cout << " GPU decay: " << decayPrint[i];

Simulator/Utils/Global.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ string neuronTypeToString(vertexType t)
6262
case vertexType::EXC:
6363
return "EXC";
6464
default:
65-
cerr << "ERROR->neuronTypeToString() failed, unknown type: " << static_cast<int>(t) << endl;
65+
cerr << "ERROR->neuronTypeToString() failed, unknown type: " << t << endl;
6666
assert(false);
6767
return nullptr; // Must return a value -- this will probably cascade to another failure
6868
}

Simulator/Utils/Global.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ enum class vertexType {
111111
// UNDEF
112112
VTYPE_UNDEF = 0
113113
};
114+
// Custom streaming operator<< for the enum class vertexType
115+
inline std::ostream& operator<<(std::ostream& os, vertexType vT) {
116+
os << static_cast<int>(vT);
117+
return os;
118+
}
114119

115120
// Edge types.
116121
// NEURO:
@@ -140,6 +145,11 @@ enum class edgeType {
140145
// UNDEF
141146
ETYPE_UNDEF = -1
142147
};
148+
// Custom streaming operator<< for the enum class edgeType
149+
inline std::ostream& operator<<(std::ostream& os, edgeType eT) {
150+
os << static_cast<int>(eT);
151+
return os;
152+
}
143153

144154
// The default membrane capacitance.
145155
#define DEFAULT_Cm (3e-8)

Simulator/Vertices/Neuro/AllIFNeurons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void AllIFNeurons::createNeuron(int i, Layout &layout)
142142

143143
default:
144144
LOG4CPLUS_DEBUG(vertexLogger_,
145-
"ERROR: unknown neuron type: " << static_cast<int>(layout.vertexTypeMap_[i]) << "@" << i);
145+
"ERROR: unknown neuron type: " << layout.vertexTypeMap_[i] << "@" << i);
146146
assert(false);
147147
break;
148148
}

0 commit comments

Comments
 (0)