From 3d6b2c1d78fcbb8a24d36f22a35d51c7dca1ad2d Mon Sep 17 00:00:00 2001
From: Gerardo Tauriello <gerardo.tauriello@unibas.ch>
Date: Thu, 11 Aug 2016 14:15:39 +0200
Subject: [PATCH] Code cleanup: use C++ style enums.
---
core/src/cluster.hh | 8 +++++---
core/tests/test_portable_binary.cc | 4 ++--
loop/src/backbone_loop_score.hh | 2 +-
loop/src/fragger.hh | 4 ++--
scoring/src/backbone_score_base.hh | 10 +++++-----
sidechain/src/particle.hh | 17 +++++++++++------
sidechain/src/rotamer_id.hh | 4 ++--
7 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/core/src/cluster.hh b/core/src/cluster.hh
index 37f5b536..e2a04159 100644
--- a/core/src/cluster.hh
+++ b/core/src/cluster.hh
@@ -7,9 +7,11 @@
namespace promod3 { namespace core {
-typedef enum{AVG_DIST_METRIC,
- MAX_DIST_METRIC,
- MIN_DIST_METRIC} DistanceMetric;
+enum DistanceMetric {
+ AVG_DIST_METRIC,
+ MAX_DIST_METRIC,
+ MIN_DIST_METRIC
+};
struct Cluster{
diff --git a/core/tests/test_portable_binary.cc b/core/tests/test_portable_binary.cc
index 9bac9e03..31102f39 100644
--- a/core/tests/test_portable_binary.cc
+++ b/core/tests/test_portable_binary.cc
@@ -11,7 +11,7 @@ BOOST_AUTO_TEST_SUITE( core );
using namespace promod3::core;
-typedef enum {
+enum MyEnum {
ARG, ASN, ASP,
GLN, GLU, LYS,
SER, CYS, CYH,
@@ -21,7 +21,7 @@ typedef enum {
CPR, TPR, HSD,
HSE, HIS, PHE,
GLY, ALA, XXX
-} MyEnum;
+};
struct MyStruct {
// types used in binaries (as of Jan 21, 2016)
diff --git a/loop/src/backbone_loop_score.hh b/loop/src/backbone_loop_score.hh
index c95ac70b..0faa991f 100644
--- a/loop/src/backbone_loop_score.hh
+++ b/loop/src/backbone_loop_score.hh
@@ -24,7 +24,7 @@ namespace promod3 { namespace loop {
class BackboneLoopScorer;
typedef boost::shared_ptr<BackboneLoopScorer> BackboneLoopScorerPtr;
-enum ClashType{
+enum ClashType {
CLASH_C,
CLASH_N,
CLASH_O
diff --git a/loop/src/fragger.hh b/loop/src/fragger.hh
index d935bf1a..30938b0b 100644
--- a/loop/src/fragger.hh
+++ b/loop/src/fragger.hh
@@ -23,14 +23,14 @@ typedef boost::shared_ptr<Fragger> FraggerPtr;
typedef boost::shared_ptr<FraggerMap> FraggerMapPtr;
typedef std::vector<FraggerPtr> FraggerList;
-typedef enum{
+enum FraggerScoreType {
SeqSim,
SeqID,
SSAgree,
TorsionProb,
SequenceProfile,
StructureProfile
-} FraggerScoreType;
+};
// portable serialization (with fixed-width base-types)
inline void Serialize(ost::io::BinaryDataSource& ds, FraggerScoreType& st) {
diff --git a/scoring/src/backbone_score_base.hh b/scoring/src/backbone_score_base.hh
index e9b0154e..83eb7483 100644
--- a/scoring/src/backbone_score_base.hh
+++ b/scoring/src/backbone_score_base.hh
@@ -55,27 +55,27 @@ private:
};
-typedef enum{
+enum PairwiseFunctionType {
CA_PAIRWISE_FUNCTION,
CB_PAIRWISE_FUNCTION
-} PairwiseFunctionType;
+};
-struct PairwiseFunctionData{
+struct PairwiseFunctionData {
PairwiseFunctionPtr f;
PairwiseFunctionType ft;
uint other_idx;
};
-struct DensityMapData{
+struct DensityMapData {
ost::img::MapHandle map;
Real resolution;
bool all_atom;
};
-class BackboneScoreEnv{
+class BackboneScoreEnv {
public:
diff --git a/sidechain/src/particle.hh b/sidechain/src/particle.hh
index 155c21bf..61672fce 100644
--- a/sidechain/src/particle.hh
+++ b/sidechain/src/particle.hh
@@ -4600,12 +4600,17 @@ namespace{
namespace promod3{ namespace sidechain{
-typedef enum{
- HParticle, CParticle,
- CH1Particle, CH2Particle,
- CH3Particle, NParticle,
- OParticle, OCParticle,
- SParticle} SidechainParticle;
+enum SidechainParticle {
+ HParticle,
+ CParticle,
+ CH1Particle,
+ CH2Particle,
+ CH3Particle,
+ NParticle,
+ OParticle,
+ OCParticle,
+ SParticle
+};
class Particle;
typedef boost::shared_ptr<Particle> ParticlePtr;
diff --git a/sidechain/src/rotamer_id.hh b/sidechain/src/rotamer_id.hh
index 1a94467a..56945004 100644
--- a/sidechain/src/rotamer_id.hh
+++ b/sidechain/src/rotamer_id.hh
@@ -7,7 +7,7 @@
namespace promod3{ namespace sidechain{
-typedef enum {
+enum RotamerID {
ARG, ASN, ASP,
GLN, GLU, LYS,
SER, CYS, CYH,
@@ -17,7 +17,7 @@ typedef enum {
CPR, TPR, HSD,
HSE, HIS, PHE,
GLY, ALA, XXX
-} RotamerID;
+};
// portable serialization (with fixed-width base-types)
inline void Serialize(core::PortableBinaryDataSink& ds, RotamerID t) {
--
GitLab