overall change of a variable name: array_ instead of array2_

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1823 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
nicolabertoldi 2008-06-05 11:42:00 +00:00
parent 930e67c5e3
commit 8e96e68476
2 changed files with 20 additions and 20 deletions

View File

@ -16,28 +16,28 @@ FeatureStats::FeatureStats()
{
available_ = AVAILABLE_;
entries_ = 0;
array2_ = new FeatureStatsType[available_];
array_ = new FeatureStatsType[available_];
};
FeatureStats::~FeatureStats()
{
delete array2_;
delete array_;
};
FeatureStats::FeatureStats(const FeatureStats &stats)
{
available_ = stats.available();
entries_ = stats.size();
array2_ = new FeatureStatsType[available_];
memcpy(array2_,stats.getArray(),bytes_);
array_ = new FeatureStatsType[available_];
memcpy(array_,stats.getArray(),bytes_);
};
FeatureStats::FeatureStats(const size_t size)
{
available_ = size;
entries_ = size;
array2_ = new FeatureStatsType[available_];
memset(array2_,0,bytes_);
array_ = new FeatureStatsType[available_];
memset(array_,0,bytes_);
};
@ -50,15 +50,15 @@ void FeatureStats::expand()
{
available_*=2;
featstats_t t_ = new FeatureStatsType[available_];
memcpy(t_,array2_,bytes_);
delete array2_;
array2_=t_;
memcpy(t_,array_,bytes_);
delete array_;
array_=t_;
}
void FeatureStats::add(FeatureStatsType v)
{
if (isfull()) expand();
array2_[entries_++]=v;
array_[entries_++]=v;
}
void FeatureStats::set(std::string &theString)
@ -75,7 +75,7 @@ void FeatureStats::set(std::string &theString)
void FeatureStats::loadbin(std::ifstream& inFile)
{
inFile.read((char*) array2_, bytes_);
inFile.read((char*) array_, bytes_);
}
void FeatureStats::loadtxt(std::ifstream& inFile)
@ -113,16 +113,16 @@ void FeatureStats::savetxt(std::ofstream& outFile)
void FeatureStats::savebin(std::ofstream& outFile)
{
outFile.write((char*) array2_, bytes_);
outFile.write((char*) array_, bytes_);
}
FeatureStats& FeatureStats::operator=(const FeatureStats &stats)
{
delete array2_;
delete array_;
available_ = stats.available();
entries_ = stats.size();
array2_ = new FeatureStatsType[available_];
memcpy(array2_,stats.getArray(),bytes_);
array_ = new FeatureStatsType[available_];
memcpy(array_,stats.getArray(),bytes_);
return *this;
}

View File

@ -25,7 +25,7 @@ using namespace std;
class FeatureStats
{
private:
featstats_t array2_;
featstats_t array_;
size_t entries_;
size_t available_;
@ -42,11 +42,11 @@ public:
void expand();
void add(FeatureStatsType v);
inline void clear() { memset((void*) array2_,0,bytes_); }
inline void clear() { memset((void*) array_,0,bytes_); }
inline FeatureStatsType get(size_t i){ return array2_[i]; }
inline FeatureStatsType get(size_t i)const{ return array2_[i]; }
inline featstats_t getArray() const { return array2_; }
inline FeatureStatsType get(size_t i){ return array_[i]; }
inline FeatureStatsType get(size_t i)const{ return array_[i]; }
inline featstats_t getArray() const { return array_; }
void set(std::string &theString);