Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230>2011-02-24 15:42:19 +0300
committerhieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230>2011-02-24 15:42:19 +0300
commit148c1e8305fbcf8dc0acd021fe5825842e0b3c8d (patch)
tree04041cbc625ff61db8d94471c6d2d1c61264f653 /mert/FeatureStats.cpp
parenta59ad11b58acf5dd64ec6f5990bb4ef5b74ebf28 (diff)
run beautify.perl. Consistent formatting for .h & .cpp files
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3899 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'mert/FeatureStats.cpp')
-rw-r--r--mert/FeatureStats.cpp105
1 files changed, 53 insertions, 52 deletions
diff --git a/mert/FeatureStats.cpp b/mert/FeatureStats.cpp
index d9a80ce7d..74f1ff8a9 100644
--- a/mert/FeatureStats.cpp
+++ b/mert/FeatureStats.cpp
@@ -14,123 +14,124 @@
FeatureStats::FeatureStats()
{
- available_ = AVAILABLE_;
- entries_ = 0;
- array_ = new FeatureStatsType[available_];
+ available_ = AVAILABLE_;
+ entries_ = 0;
+ array_ = new FeatureStatsType[available_];
};
FeatureStats::~FeatureStats()
{
- delete array_;
+ delete array_;
};
FeatureStats::FeatureStats(const FeatureStats &stats)
{
- available_ = stats.available();
- entries_ = stats.size();
- array_ = new FeatureStatsType[available_];
- memcpy(array_,stats.getArray(),featbytes_);
+ available_ = stats.available();
+ entries_ = stats.size();
+ array_ = new FeatureStatsType[available_];
+ memcpy(array_,stats.getArray(),featbytes_);
};
FeatureStats::FeatureStats(const size_t size)
{
- available_ = size;
- entries_ = size;
- array_ = new FeatureStatsType[available_];
- memset(array_,0,featbytes_);
+ available_ = size;
+ entries_ = size;
+ array_ = new FeatureStatsType[available_];
+ memset(array_,0,featbytes_);
};
FeatureStats::FeatureStats(std::string &theString)
{
- set(theString);
+ set(theString);
}
void FeatureStats::expand()
{
- available_*=2;
- featstats_t t_ = new FeatureStatsType[available_];
- memcpy(t_,array_,featbytes_);
- delete array_;
- array_=t_;
+ available_*=2;
+ featstats_t t_ = new FeatureStatsType[available_];
+ memcpy(t_,array_,featbytes_);
+ delete array_;
+ array_=t_;
}
void FeatureStats::add(FeatureStatsType v)
{
- if (isfull()) expand();
- array_[entries_++]=v;
+ if (isfull()) expand();
+ array_[entries_++]=v;
}
void FeatureStats::set(std::string &theString)
{
std::string substring, stringBuf;
- reset();
-
- while (!theString.empty()){
- getNextPound(theString, substring);
- add(ATOFST(substring.c_str()));
- }
+ reset();
+
+ while (!theString.empty()) {
+ getNextPound(theString, substring);
+ add(ATOFST(substring.c_str()));
+ }
}
void FeatureStats::loadbin(std::ifstream& inFile)
{
- inFile.read((char*) array_, featbytes_);
-}
+ inFile.read((char*) array_, featbytes_);
+}
void FeatureStats::loadtxt(std::ifstream& inFile)
{
- std::string theString;
- std::getline(inFile, theString);
- set(theString);
+ std::string theString;
+ std::getline(inFile, theString);
+ set(theString);
}
void FeatureStats::loadtxt(const std::string &file)
{
- // TRACE_ERR("loading the stats from " << file << std::endl);
+ // TRACE_ERR("loading the stats from " << file << std::endl);
- std::ifstream inFile(file.c_str(), std::ios::in); // matches a stream with a file. Opens the file
+ std::ifstream inFile(file.c_str(), std::ios::in); // matches a stream with a file. Opens the file
- loadtxt(inFile);
+ loadtxt(inFile);
}
void FeatureStats::savetxt(const std::string &file)
{
-// TRACE_ERR("saving the stats into " << file << std::endl);
+// TRACE_ERR("saving the stats into " << file << std::endl);
- std::ofstream outFile(file.c_str(), std::ios::out); // matches a stream with a file. Opens the file
+ std::ofstream outFile(file.c_str(), std::ios::out); // matches a stream with a file. Opens the file
- savetxt(outFile);
+ savetxt(outFile);
}
void FeatureStats::savetxt(std::ofstream& outFile)
{
-// TRACE_ERR("saving the stats" << std::endl);
- outFile << *this;
+// TRACE_ERR("saving the stats" << std::endl);
+ outFile << *this;
}
void FeatureStats::savebin(std::ofstream& outFile)
{
- outFile.write((char*) array_, featbytes_);
-}
+ outFile.write((char*) array_, featbytes_);
+}
FeatureStats& FeatureStats::operator=(const FeatureStats &stats)
{
- delete array_;
- available_ = stats.available();
- entries_ = stats.size();
- array_ = new FeatureStatsType[available_];
- memcpy(array_,stats.getArray(),featbytes_);
-
- return *this;
+ delete array_;
+ available_ = stats.available();
+ entries_ = stats.size();
+ array_ = new FeatureStatsType[available_];
+ memcpy(array_,stats.getArray(),featbytes_);
+
+ return *this;
}
/**write the whole object to a stream*/
-ostream& operator<<(ostream& o, const FeatureStats& e){
- for (size_t i=0; i< e.size(); i++)
- o << e.get(i) << " ";
- return o;
+ostream& operator<<(ostream& o, const FeatureStats& e)
+{
+ for (size_t i=0; i< e.size(); i++)
+ o << e.get(i) << " ";
+ return o;
}