diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2011-11-14 07:20:04 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2011-11-14 07:20:04 +0400 |
commit | 625fe118e0a5ddc4f49f8b368b0cfc3947cbe5c5 (patch) | |
tree | 55eb9896525cfeee9b663f9d0310b5c3a8addeac /mert | |
parent | 8f0ba037f387505a1deb87c0ac85c68d2de521b7 (diff) |
Fix bugs, private members were not initialized when the instances are created.
When the objects of Data and FeatureData classes are created,
the primitive private members were not initialized properly.
Diffstat (limited to 'mert')
-rw-r--r-- | mert/Data.cpp | 7 | ||||
-rw-r--r-- | mert/Data.h | 1 | ||||
-rw-r--r-- | mert/FeatureData.cpp | 4 | ||||
-rw-r--r-- | mert/FeatureData.h | 11 |
4 files changed, 16 insertions, 7 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp index 4c8bd1904..2cca6a4bf 100644 --- a/mert/Data.cpp +++ b/mert/Data.cpp @@ -15,6 +15,13 @@ #include "ScorerFactory.h" #include "Util.h" +Data::Data() + : theScorer(NULL), + number_of_scores(0), + _sparse_flag(false), + scoredata(NULL), + featdata(NULL) {} + Data::Data(Scorer& ptr) : theScorer(&ptr), score_type(theScorer->getName()), diff --git a/mert/Data.h b/mert/Data.h index ea2ddd33d..b1d559535 100644 --- a/mert/Data.h +++ b/mert/Data.h @@ -36,6 +36,7 @@ protected: public: explicit Data(Scorer& sc); + Data(); ~Data(); inline void clear() { diff --git a/mert/FeatureData.cpp b/mert/FeatureData.cpp index 706216d8f..b72dc5b04 100644 --- a/mert/FeatureData.cpp +++ b/mert/FeatureData.cpp @@ -14,7 +14,9 @@ static const float MIN_FLOAT=-1.0*numeric_limits<float>::max(); static const float MAX_FLOAT=numeric_limits<float>::max(); -FeatureData::FeatureData() {} +FeatureData::FeatureData() + : number_of_features(0), + _sparse_flag(false) {} void FeatureData::save(std::ofstream& outFile, bool bin) { diff --git a/mert/FeatureData.h b/mert/FeatureData.h index 9232ece80..cc474ce71 100644 --- a/mert/FeatureData.h +++ b/mert/FeatureData.h @@ -20,12 +20,6 @@ using namespace std; class FeatureData { - -protected: - featdata_t array_; - idx2name idx2arrayname_; // map from index to name of array - name2idx arrayname2idx_; // map from name to index of array - private: size_t number_of_features; std::string features; @@ -34,6 +28,11 @@ private: map<std::string, size_t> featname2idx_; // map from name to index of features map<size_t, std::string> idx2featname_; // map from index to name of features +protected: + featdata_t array_; + idx2name idx2arrayname_; // map from index to name of array + name2idx arrayname2idx_; // map from name to index of array + public: FeatureData(); ~FeatureData() {} |