[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 9ffdf78 4/9: Add const accessors to class dat
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 9ffdf78 4/9: Add const accessors to class database_index |
Date: |
Wed, 12 Jun 2019 12:53:00 -0400 (EDT) |
branch: master
commit 9ffdf7813256088a1870a8295df8d373d68a5562
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Add const accessors to class database_index
'static_cast<int>(some_integer)' does seem to be a useless cast, but it
doesn't elicit any gcc warning with '-Wuseless-cast', and it does make
parallelism obvious.
Incidentally moved one line, in order to group all const accessors
together. There's no reason not to set
git config diff.colormoved plain
which makes the transposition obvious.
---
dbindex.hpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/dbindex.hpp b/dbindex.hpp
index 4341177..7f25bb8 100644
--- a/dbindex.hpp
+++ b/dbindex.hpp
@@ -87,6 +87,15 @@ class database_index
idx_[5] = state ;
}
+ std::vector<int> const& index_vector() const {return idx_;}
+
+ mcenum_gender gender () const {return static_cast<mcenum_gender
>(idx_[0]);}
+ mcenum_class uw_class () const {return static_cast<mcenum_class
>(idx_[1]);}
+ mcenum_smoking smoking () const {return static_cast<mcenum_smoking
>(idx_[2]);}
+ int issue_age() const {return static_cast<int
>(idx_[3]);}
+ mcenum_uw_basis uw_basis () const {return
static_cast<mcenum_uw_basis>(idx_[4]);}
+ mcenum_state state () const {return static_cast<mcenum_state
>(idx_[5]);}
+
database_index& gender (mcenum_gender z) {idx_[0] = z; return *this;}
database_index& uw_class (mcenum_class z) {idx_[1] = z; return *this;}
database_index& smoking (mcenum_smoking z) {idx_[2] = z; return *this;}
@@ -95,8 +104,6 @@ class database_index
database_index& uw_basis (mcenum_uw_basis z) {idx_[4] = z; return *this;}
database_index& state (mcenum_state z) {idx_[5] = z; return *this;}
- std::vector<int> const& index_vector() const {return idx_;}
-
private:
void check_issue_age(int z) {LMI_ASSERT(0 <= z && z <
e_max_dim_issue_age);}
- [lmi-commits] [lmi] master updated (a9bcf09 -> d30e9b1), Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master b6c5d13 6/9: Improve const correctness, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master 1f1adcf 8/9: Prefer std::array to std::vector when size is fixed, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master 9ffdf78 4/9: Add const accessors to class database_index,
Greg Chicares <=
- [lmi-commits] [lmi] master 7b5da91 5/9: Use database_index const accessors, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master fad3d61 1/9: Use forward declarations to improve physical design, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master 89c8cc5 2/9: Use forward declarations to improve physical design, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master d30e9b1 9/9: Make {{ContractNameCap}} available for all formats, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master a8298c9 3/9: Improve list of handy commands, Greg Chicares, 2019/06/12
- [lmi-commits] [lmi] master 8862ffc 7/9: Improve const correctness, Greg Chicares, 2019/06/12