summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-05 17:38:05 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-05 17:38:05 +0100
commitb7c2dd440523948bebca54a91a4ba06451b473f0 (patch)
tree779acaf038c93352de8d27f8fa6a1ad27a42864a
parentc2e5a26f355a7b51743740323c8e28156c0deee5 (diff)
transformed the last enum to uppercase.
-rw-r--r--src/core/Managed.cpp12
-rw-r--r--src/core/Managed.hpp2
-rw-r--r--test/core/ManagedTest.cpp42
3 files changed, 28 insertions, 28 deletions
diff --git a/src/core/Managed.cpp b/src/core/Managed.cpp
index 8cbbb17..f3a68a3 100644
--- a/src/core/Managed.cpp
+++ b/src/core/Managed.cpp
@@ -101,7 +101,7 @@ void ObjectDescriptor::incrDegree(RefDir dir, Managed *o)
}
// Fetch a reference to either the input or the output reference map
- auto &m = dir == RefDir::in ? refIn : refOut;
+ auto &m = dir == RefDir::IN ? refIn : refOut;
// Insert a new entry or increment the corresponding reference counter
auto it = m.find(o);
@@ -128,7 +128,7 @@ bool ObjectDescriptor::decrDegree(RefDir dir, Managed *o, bool all)
}
// Fetch a reference to either the input or the output reference map
- auto &m = dir == RefDir::in ? refIn : refOut;
+ auto &m = dir == RefDir::IN ? refIn : refOut;
// Decrement corresponding reference counter, delete the entry if the
// reference counter reaches zero
@@ -187,11 +187,11 @@ void Manager::addRef(Managed *tar, Managed *src)
// Store the tar <- src reference
assert(dTar);
- dTar->incrDegree(RefDir::in, src);
+ dTar->incrDegree(RefDir::IN, src);
if (src) {
// Store the src -> tar reference
assert(dSrc);
- dSrc->incrDegree(RefDir::out, tar);
+ dSrc->incrDegree(RefDir::OUT, tar);
} else {
// We have just added a root reference, remove the element from the
// list of marked objects
@@ -207,11 +207,11 @@ void Manager::deleteRef(Managed *tar, Managed *src, bool all)
// Decrement the output degree of the source Managed first
if (dSrc) {
- dSrc->decrDegree(RefDir::out, tar, all);
+ dSrc->decrDegree(RefDir::OUT, tar, all);
}
// Decrement the input degree of the input Managed
- if (dTar && dTar->decrDegree(RefDir::in, src, all)) {
+ if (dTar && dTar->decrDegree(RefDir::IN, src, all)) {
// If the Managed has a zero in degree, it can be safely deleted, otherwise
// if it has no root reference, add it to the "marked" set which is
// subject to tracing garbage collection
diff --git a/src/core/Managed.hpp b/src/core/Managed.hpp
index 6199e33..25fa14b 100644
--- a/src/core/Managed.hpp
+++ b/src/core/Managed.hpp
@@ -45,7 +45,7 @@ class Owned;
* Enum used to specify the direction of a object reference (inbound or
* outbound).
*/
-enum class RefDir { in, out };
+enum class RefDir { IN, OUT };
/**
* The ObjectDescriptor struct is used by the Manager for reference counting and
diff --git a/test/core/ManagedTest.cpp b/test/core/ManagedTest.cpp
index a52ba88..a4011f1 100644
--- a/test/core/ManagedTest.cpp
+++ b/test/core/ManagedTest.cpp
@@ -42,49 +42,49 @@ TEST(ObjectDescriptor, Degree)
ASSERT_EQ(0, nd.refIn.size());
ASSERT_EQ(0, nd.refInCount(n1));
- nd.incrDegree(RefDir::in, n1);
+ nd.incrDegree(RefDir::IN, n1);
ASSERT_EQ(1, nd.refInCount());
ASSERT_EQ(1, nd.refInCount(n1));
ASSERT_EQ(0, nd.refInCount(n2));
ASSERT_EQ(1, nd.refIn.size());
- nd.incrDegree(RefDir::in, n1);
+ nd.incrDegree(RefDir::IN, n1);
ASSERT_EQ(2, nd.refInCount());
ASSERT_EQ(2, nd.refInCount(n1));
ASSERT_EQ(0, nd.refInCount(n2));
ASSERT_EQ(1, nd.refIn.size());
- nd.incrDegree(RefDir::in, n2);
+ nd.incrDegree(RefDir::IN, n2);
ASSERT_EQ(3, nd.refInCount());
ASSERT_EQ(2, nd.refInCount(n1));
ASSERT_EQ(1, nd.refInCount(n2));
ASSERT_EQ(2, nd.refIn.size());
- nd.incrDegree(RefDir::in, nullptr);
+ nd.incrDegree(RefDir::IN, nullptr);
ASSERT_EQ(4, nd.refInCount());
ASSERT_EQ(2, nd.refInCount(n1));
ASSERT_EQ(1, nd.refInCount(n2));
ASSERT_EQ(2, nd.refIn.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::in, n1));
+ ASSERT_TRUE(nd.decrDegree(RefDir::IN, n1));
ASSERT_EQ(3, nd.refInCount());
ASSERT_EQ(1, nd.refInCount(n1));
ASSERT_EQ(1, nd.refInCount(n2));
ASSERT_EQ(2, nd.refIn.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::in, n1));
+ ASSERT_TRUE(nd.decrDegree(RefDir::IN, n1));
ASSERT_EQ(2, nd.refInCount());
ASSERT_EQ(0, nd.refInCount(n1));
ASSERT_EQ(1, nd.refInCount(n2));
ASSERT_EQ(1, nd.refIn.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::in, n2));
+ ASSERT_TRUE(nd.decrDegree(RefDir::IN, n2));
ASSERT_EQ(1, nd.refInCount());
ASSERT_EQ(0, nd.refInCount(n1));
ASSERT_EQ(0, nd.refInCount(n2));
ASSERT_EQ(0, nd.refIn.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::in, nullptr));
+ ASSERT_TRUE(nd.decrDegree(RefDir::IN, nullptr));
ASSERT_EQ(0, nd.refInCount());
ASSERT_EQ(0, nd.refInCount(n1));
ASSERT_EQ(0, nd.refInCount(n2));
@@ -94,49 +94,49 @@ TEST(ObjectDescriptor, Degree)
ASSERT_EQ(0, nd.refOut.size());
ASSERT_EQ(0, nd.refOutCount(n1));
- nd.incrDegree(RefDir::out, n1);
+ nd.incrDegree(RefDir::OUT, n1);
ASSERT_EQ(1, nd.refOutCount());
ASSERT_EQ(1, nd.refOutCount(n1));
ASSERT_EQ(0, nd.refOutCount(n2));
ASSERT_EQ(1, nd.refOut.size());
- nd.incrDegree(RefDir::out, n1);
+ nd.incrDegree(RefDir::OUT, n1);
ASSERT_EQ(2, nd.refOutCount());
ASSERT_EQ(2, nd.refOutCount(n1));
ASSERT_EQ(0, nd.refOutCount(n2));
ASSERT_EQ(1, nd.refOut.size());
- nd.incrDegree(RefDir::out, n2);
+ nd.incrDegree(RefDir::OUT, n2);
ASSERT_EQ(3, nd.refOutCount());
ASSERT_EQ(2, nd.refOutCount(n1));
ASSERT_EQ(1, nd.refOutCount(n2));
ASSERT_EQ(2, nd.refOut.size());
- nd.incrDegree(RefDir::out, nullptr);
+ nd.incrDegree(RefDir::OUT, nullptr);
ASSERT_EQ(3, nd.refOutCount());
ASSERT_EQ(2, nd.refOutCount(n1));
ASSERT_EQ(1, nd.refOutCount(n2));
ASSERT_EQ(2, nd.refOut.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::out, n1));
+ ASSERT_TRUE(nd.decrDegree(RefDir::OUT, n1));
ASSERT_EQ(2, nd.refOutCount());
ASSERT_EQ(1, nd.refOutCount(n1));
ASSERT_EQ(1, nd.refOutCount(n2));
ASSERT_EQ(2, nd.refOut.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::out, n1));
+ ASSERT_TRUE(nd.decrDegree(RefDir::OUT, n1));
ASSERT_EQ(1, nd.refOutCount());
ASSERT_EQ(0, nd.refOutCount(n1));
ASSERT_EQ(1, nd.refOutCount(n2));
ASSERT_EQ(1, nd.refOut.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::out, n2));
+ ASSERT_TRUE(nd.decrDegree(RefDir::OUT, n2));
ASSERT_EQ(0, nd.refOutCount());
ASSERT_EQ(0, nd.refOutCount(n1));
ASSERT_EQ(0, nd.refOutCount(n2));
ASSERT_EQ(0, nd.refOut.size());
- ASSERT_TRUE(nd.decrDegree(RefDir::out, nullptr));
+ ASSERT_TRUE(nd.decrDegree(RefDir::OUT, nullptr));
ASSERT_EQ(0, nd.refOutCount());
ASSERT_EQ(0, nd.refOutCount(n1));
ASSERT_EQ(0, nd.refOutCount(n2));
@@ -148,10 +148,10 @@ TEST(ObjectDescriptor, rootRefCount)
ObjectDescriptor nd;
ASSERT_EQ(0, nd.rootRefCount);
- nd.incrDegree(RefDir::in, nullptr);
+ nd.incrDegree(RefDir::IN, nullptr);
ASSERT_EQ(1, nd.rootRefCount);
- nd.incrDegree(RefDir::out, nullptr);
+ nd.incrDegree(RefDir::OUT, nullptr);
ASSERT_EQ(2, nd.rootRefCount);
ASSERT_EQ(2, nd.refInCount(nullptr));
@@ -159,13 +159,13 @@ TEST(ObjectDescriptor, rootRefCount)
ASSERT_EQ(0, nd.refOutCount(nullptr));
ASSERT_EQ(0, nd.refOutCount());
- ASSERT_TRUE(nd.decrDegree(RefDir::out, nullptr));
+ ASSERT_TRUE(nd.decrDegree(RefDir::OUT, nullptr));
ASSERT_EQ(1, nd.rootRefCount);
- ASSERT_TRUE(nd.decrDegree(RefDir::in, nullptr));
+ ASSERT_TRUE(nd.decrDegree(RefDir::IN, nullptr));
ASSERT_EQ(0, nd.rootRefCount);
- ASSERT_FALSE(nd.decrDegree(RefDir::in, nullptr));
+ ASSERT_FALSE(nd.decrDegree(RefDir::IN, nullptr));
ASSERT_EQ(0, nd.rootRefCount);
}