Skip to content

Commit 6ff115c

Browse files
authored
Merge pull request #3 from bertof/master
Add const keywork where possible
2 parents 8a73817 + e034729 commit 6ff115c

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

sbf.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ int SBF::GetCell(unsigned int index) const
251251
// Prints the filter and related statistics to the standart output
252252
// mode: 0 prints SBF stats only
253253
// mode: 1 prints SBF information and the full SBF content
254-
void SBF::PrintFilter(int mode) const
254+
void SBF::PrintFilter(const int mode) const
255255
{
256256
int potential_elements;
257257

@@ -313,7 +313,7 @@ void SBF::PrintFilter(int mode) const
313313
// Prints the filter and related statistics onto a CSV file (path)
314314
// mode: 1 writes SBF metadata (CSV: key;value)
315315
// mode: 0 writes SBF cells (CSV: value)
316-
void SBF::SaveToDisk(std::string path, int mode)
316+
void SBF::SaveToDisk(const std::string path, int mode)
317317
{
318318
std::ofstream myfile;
319319

@@ -375,7 +375,7 @@ void SBF::SaveToDisk(std::string path, int mode)
375375
// char *string element to be mapped
376376
// int size length of the element
377377
// int area the area label
378-
void SBF::Insert(char *string, int size, int area)
378+
void SBF::Insert(const char *string, const int size, const int area)
379379
{
380380
char* buffer = new char[size];
381381

@@ -432,7 +432,7 @@ void SBF::Insert(char *string, int size, int area)
432432
// belongs to a set, 0 otherwise.
433433
// char *string the element to be verified
434434
// int size length of the element
435-
int SBF::Check(char *string, int size) const
435+
int SBF::Check(const char *string, const int size) const
436436
{
437437
char* buffer = new char[size];
438438
int area = 0;
@@ -622,7 +622,7 @@ void SBF::SetAreaFpp()
622622

623623

624624
// Returns the number of inserted elements for the input area
625-
int SBF::GetAreaMembers(int area) const
625+
int SBF::GetAreaMembers(const int area) const
626626
{
627627
return this->AREA_members[area];
628628
}
@@ -675,7 +675,7 @@ float SBF::GetFilterFpp() const
675675

676676

677677
// Returns the expected emersion value for the input area
678-
float SBF::GetExpectedAreaEmersion(int area) const
678+
float SBF::GetExpectedAreaEmersion(const int area) const
679679
{
680680
double p;
681681
int nfill = 0;
@@ -692,7 +692,7 @@ float SBF::GetExpectedAreaEmersion(int area) const
692692

693693

694694
// Returns the emersion value for the input area
695-
float SBF::GetAreaEmersion(int area) const
695+
float SBF::GetAreaEmersion(const int area) const
696696
{
697697
float ret, a, b;
698698
if((this->AREA_members[area]==0) || (this->HASH_number==0)) ret = -1;

sbf.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ namespace sbf {
226226

227227

228228
// Public methods (commented in the sbf.cpp)
229-
void PrintFilter(int mode) const;
230-
void SaveToDisk(std::string path, int mode);
231-
void Insert(char *string, int size, int area);
232-
int Check(char *string, int size) const;
233-
int GetAreaMembers(int area) const;
229+
void PrintFilter(const int mode) const;
230+
void SaveToDisk(const std::string path, int mode);
231+
void Insert(const char *string, const int size, const int area);
232+
int Check(const char *string, const int size) const;
233+
int GetAreaMembers(const int area) const;
234234
float GetFilterSparsity() const;
235235
float GetFilterFpp() const;
236236
float GetFilterAPrioriFpp() const;
@@ -239,8 +239,8 @@ namespace sbf {
239239
void SetAreaIsep();
240240
void SetAPrioriAreaIsep();
241241
void SetExpectedAreaCells();
242-
float GetExpectedAreaEmersion(int area) const;
243-
float GetAreaEmersion(int area) const;
242+
float GetExpectedAreaEmersion(const int area) const;
243+
float GetAreaEmersion(const int area) const;
244244
};
245245

246246
} //namespace sbf

0 commit comments

Comments
 (0)