summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-07-30 12:54:18 +0200
committerTor Egge <Tor.Egge@broadpark.no>2019-07-30 13:00:40 +0200
commitfba625e9a06308364f0c0e6728a9d2195b9354a0 (patch)
treef26a1979f4c5733331c11832a0256234a4a8b38b /searchlib
parentb53df1fcba1dae72a6e78c7892bc7b51408d4348 (diff)
Use proper scope for enum constants.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp38
-rw-r--r--searchlib/src/vespa/searchlib/attribute/configconverter.cpp34
-rw-r--r--searchlib/src/vespa/searchlib/common/tunefileinfo.h10
-rw-r--r--searchlib/src/vespa/searchlib/common/tunefileinfo.hpp18
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp4
5 files changed, 53 insertions, 51 deletions
diff --git a/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp b/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp
index 09f89494019..62cde4d2c9c 100644
--- a/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp
+++ b/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp
@@ -222,27 +222,29 @@ AttributeManagerTest::testConfigConvert()
// typedef AttributeVector::Config AVC;
typedef BT AVBT;
typedef CollectionType AVCT;
- typedef AttributesConfig::Attribute CACA;
+ using CACA = AttributesConfig::Attribute;
+ using CACAD = CACA::Datatype;
+ using CACAC = CACA::Collectiontype;
typedef ConfigConverter CC;
- EXPECT_TRUE(assertDataType(AVBT::STRING, CACA::STRING));
- EXPECT_TRUE(assertDataType(AVBT::INT8, CACA::INT8));
- EXPECT_TRUE(assertDataType(AVBT::INT16, CACA::INT16));
- EXPECT_TRUE(assertDataType(AVBT::INT32, CACA::INT32));
- EXPECT_TRUE(assertDataType(AVBT::INT64, CACA::INT64));
- EXPECT_TRUE(assertDataType(AVBT::FLOAT, CACA::FLOAT));
- EXPECT_TRUE(assertDataType(AVBT::DOUBLE, CACA::DOUBLE));
- EXPECT_TRUE(assertDataType(AVBT::PREDICATE, CACA::PREDICATE));
- EXPECT_TRUE(assertDataType(AVBT::TENSOR, CACA::TENSOR));
- EXPECT_TRUE(assertDataType(AVBT::NONE, CACA::NONE));
-
- EXPECT_TRUE(assertCollectionType(AVCT::SINGLE, CACA::SINGLE));
- EXPECT_TRUE(assertCollectionType(AVCT::ARRAY, CACA::ARRAY));
- EXPECT_TRUE(assertCollectionType(AVCT::WSET, CACA::WEIGHTEDSET));
+ EXPECT_TRUE(assertDataType(AVBT::STRING, CACAD::STRING));
+ EXPECT_TRUE(assertDataType(AVBT::INT8, CACAD::INT8));
+ EXPECT_TRUE(assertDataType(AVBT::INT16, CACAD::INT16));
+ EXPECT_TRUE(assertDataType(AVBT::INT32, CACAD::INT32));
+ EXPECT_TRUE(assertDataType(AVBT::INT64, CACAD::INT64));
+ EXPECT_TRUE(assertDataType(AVBT::FLOAT, CACAD::FLOAT));
+ EXPECT_TRUE(assertDataType(AVBT::DOUBLE, CACAD::DOUBLE));
+ EXPECT_TRUE(assertDataType(AVBT::PREDICATE, CACAD::PREDICATE));
+ EXPECT_TRUE(assertDataType(AVBT::TENSOR, CACAD::TENSOR));
+ EXPECT_TRUE(assertDataType(AVBT::NONE, CACAD::NONE));
+
+ EXPECT_TRUE(assertCollectionType(AVCT::SINGLE, CACAC::SINGLE));
+ EXPECT_TRUE(assertCollectionType(AVCT::ARRAY, CACAC::ARRAY));
+ EXPECT_TRUE(assertCollectionType(AVCT::WSET, CACAC::WEIGHTEDSET));
EXPECT_TRUE(assertCollectionType(AVCT(AVCT::SINGLE, true, false),
- CACA::SINGLE, true, false));
+ CACAC::SINGLE, true, false));
EXPECT_TRUE(assertCollectionType(AVCT(AVCT::SINGLE, false, true),
- CACA::SINGLE, false, true));
+ CACAC::SINGLE, false, true));
{ // fastsearch
CACA a;
@@ -270,7 +272,7 @@ AttributeManagerTest::testConfigConvert()
}
{ // tensor
CACA a;
- a.datatype = CACA::TENSOR;
+ a.datatype = CACAD::TENSOR;
a.tensortype = "tensor(x[5])";
AttributeVector::Config out = ConfigConverter::convert(a);
EXPECT_EQUAL("tensor(x[5])", out.tensorType().to_spec());
diff --git a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp
index ae08204f5bc..535e81fc032 100644
--- a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp
@@ -19,20 +19,20 @@ DataTypeMap
getDataTypeMap()
{
DataTypeMap map;
- map[AttributesConfig::Attribute::STRING] = BasicType::STRING;
- map[AttributesConfig::Attribute::BOOL] = BasicType::BOOL;
- map[AttributesConfig::Attribute::UINT2] = BasicType::UINT2;
- map[AttributesConfig::Attribute::UINT4] = BasicType::UINT4;
- map[AttributesConfig::Attribute::INT8] = BasicType::INT8;
- map[AttributesConfig::Attribute::INT16] = BasicType::INT16;
- map[AttributesConfig::Attribute::INT32] = BasicType::INT32;
- map[AttributesConfig::Attribute::INT64] = BasicType::INT64;
- map[AttributesConfig::Attribute::FLOAT] = BasicType::FLOAT;
- map[AttributesConfig::Attribute::DOUBLE] = BasicType::DOUBLE;
- map[AttributesConfig::Attribute::PREDICATE] = BasicType::PREDICATE;
- map[AttributesConfig::Attribute::TENSOR] = BasicType::TENSOR;
- map[AttributesConfig::Attribute::REFERENCE] = BasicType::REFERENCE;
- map[AttributesConfig::Attribute::NONE] = BasicType::NONE;
+ map[AttributesConfig::Attribute::Datatype::STRING] = BasicType::STRING;
+ map[AttributesConfig::Attribute::Datatype::BOOL] = BasicType::BOOL;
+ map[AttributesConfig::Attribute::Datatype::UINT2] = BasicType::UINT2;
+ map[AttributesConfig::Attribute::Datatype::UINT4] = BasicType::UINT4;
+ map[AttributesConfig::Attribute::Datatype::INT8] = BasicType::INT8;
+ map[AttributesConfig::Attribute::Datatype::INT16] = BasicType::INT16;
+ map[AttributesConfig::Attribute::Datatype::INT32] = BasicType::INT32;
+ map[AttributesConfig::Attribute::Datatype::INT64] = BasicType::INT64;
+ map[AttributesConfig::Attribute::Datatype::FLOAT] = BasicType::FLOAT;
+ map[AttributesConfig::Attribute::Datatype::DOUBLE] = BasicType::DOUBLE;
+ map[AttributesConfig::Attribute::Datatype::PREDICATE] = BasicType::PREDICATE;
+ map[AttributesConfig::Attribute::Datatype::TENSOR] = BasicType::TENSOR;
+ map[AttributesConfig::Attribute::Datatype::REFERENCE] = BasicType::REFERENCE;
+ map[AttributesConfig::Attribute::Datatype::NONE] = BasicType::NONE;
return map;
}
@@ -40,9 +40,9 @@ CollectionTypeMap
getCollectionTypeMap()
{
CollectionTypeMap map;
- map[AttributesConfig::Attribute::SINGLE] = CollectionType::SINGLE;
- map[AttributesConfig::Attribute::ARRAY] = CollectionType::ARRAY;
- map[AttributesConfig::Attribute::WEIGHTEDSET] = CollectionType::WSET;
+ map[AttributesConfig::Attribute::Collectiontype::SINGLE] = CollectionType::SINGLE;
+ map[AttributesConfig::Attribute::Collectiontype::ARRAY] = CollectionType::ARRAY;
+ map[AttributesConfig::Attribute::Collectiontype::WEIGHTEDSET] = CollectionType::WSET;
return map;
}
diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.h b/searchlib/src/vespa/searchlib/common/tunefileinfo.h
index d431a9cf78f..bcd6765845b 100644
--- a/searchlib/src/vespa/searchlib/common/tunefileinfo.h
+++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.h
@@ -26,10 +26,10 @@ public:
template <typename Config>
void setFromConfig(const enum Config::Io &config) {
switch (config) {
- case Config::NORMAL:
+ case Config::Io::NORMAL:
_tuneControl = NORMAL;
break;
- case Config::DIRECTIO:
+ case Config::Io::DIRECTIO:
_tuneControl = DIRECTIO;
break;
default:
@@ -70,13 +70,13 @@ public:
template <typename Config>
void setFromConfig(const enum Config::Io &config) {
switch (config) {
- case Config::NORMAL:
+ case Config::Io::NORMAL:
_tuneControl = NORMAL;
break;
- case Config::OSYNC:
+ case Config::Io::OSYNC:
_tuneControl = OSYNC;
break;
- case Config::DIRECTIO:
+ case Config::Io::DIRECTIO:
_tuneControl = DIRECTIO;
break;
default:
diff --git a/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp b/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp
index 17d7949e9b9..5f28f82c526 100644
--- a/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp
+++ b/searchlib/src/vespa/searchlib/common/tunefileinfo.hpp
@@ -12,9 +12,9 @@ template <typename TuneControlConfig, typename MMapConfig>
void
TuneFileRandRead::setFromConfig(const enum TuneControlConfig::Io & tuneControlConfig, const MMapConfig & mmapFlags) {
switch ( tuneControlConfig) {
- case TuneControlConfig::NORMAL: _tuneControl = NORMAL; break;
- case TuneControlConfig::DIRECTIO: _tuneControl = DIRECTIO; break;
- case TuneControlConfig::MMAP: _tuneControl = MMAP; break;
+ case TuneControlConfig::Io::NORMAL: _tuneControl = NORMAL; break;
+ case TuneControlConfig::Io::DIRECTIO: _tuneControl = DIRECTIO; break;
+ case TuneControlConfig::Io::MMAP: _tuneControl = MMAP; break;
default: _tuneControl = NORMAL; break;
}
setFromMmapConfig(mmapFlags);
@@ -25,15 +25,15 @@ void
TuneFileRandRead::setFromMmapConfig(const MMapConfig & mmapFlags) {
for (size_t i(0), m(mmapFlags.options.size()); i < m; i++) {
switch (mmapFlags.options[i]) {
- case MMapConfig::MLOCK: _mmapFlags |= MAP_LOCKED; break;
- case MMapConfig::POPULATE: _mmapFlags |= MAP_POPULATE; break;
- case MMapConfig::HUGETLB: _mmapFlags |= MAP_HUGETLB; break;
+ case MMapConfig::Options::MLOCK: _mmapFlags |= MAP_LOCKED; break;
+ case MMapConfig::Options::POPULATE: _mmapFlags |= MAP_POPULATE; break;
+ case MMapConfig::Options::HUGETLB: _mmapFlags |= MAP_HUGETLB; break;
}
}
switch (mmapFlags.advise) {
- case MMapConfig::NORMAL: setAdvise(POSIX_FADV_NORMAL); break;
- case MMapConfig::RANDOM: setAdvise(POSIX_FADV_RANDOM); break;
- case MMapConfig::SEQUENTIAL: setAdvise(POSIX_FADV_SEQUENTIAL); break;
+ case MMapConfig::Advise::NORMAL: setAdvise(POSIX_FADV_NORMAL); break;
+ case MMapConfig::Advise::RANDOM: setAdvise(POSIX_FADV_RANDOM); break;
+ case MMapConfig::Advise::SEQUENTIAL: setAdvise(POSIX_FADV_SEQUENTIAL); break;
}
}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp
index 0b02d10ffab..b8d21fb7465 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.cpp
@@ -28,9 +28,9 @@ DomainPart::Crc
getCrc(searchlib::TranslogserverConfig::Crcmethod crcType)
{
switch (crcType) {
- case searchlib::TranslogserverConfig::ccitt_crc32:
+ case searchlib::TranslogserverConfig::Crcmethod::ccitt_crc32:
return DomainPart::ccitt_crc32;
- case searchlib::TranslogserverConfig::xxh64:
+ case searchlib::TranslogserverConfig::Crcmethod::xxh64:
return DomainPart::xxh64;
}
LOG_ABORT("should not be reached");