Skip to content

Commit

Permalink
const a bunch more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
baperry2 committed Aug 30, 2024
1 parent de69923 commit fc3bac6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
44 changes: 22 additions & 22 deletions Src/Base/AMReX_ParmParse.H
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public:
bool& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, bool val);
void add (const char* name, bool val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to an int and stored
Expand Down Expand Up @@ -383,7 +383,7 @@ public:
int& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, int val);
void add (const char* name, int val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to an int and stored
Expand Down Expand Up @@ -417,7 +417,7 @@ public:
long& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, long val);
void add (const char* name, long val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to an int and stored
Expand Down Expand Up @@ -451,7 +451,7 @@ public:
long long& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, long long val);
void add (const char* name, long long val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to a float and stored
Expand Down Expand Up @@ -485,7 +485,7 @@ public:
float& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, float val);
void add (const char* name, float val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to a double and stored
Expand Down Expand Up @@ -519,7 +519,7 @@ public:
double& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, double val);
void add (const char* name, double val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to a std::string and stored
Expand Down Expand Up @@ -554,7 +554,7 @@ public:
std::string& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, const std::string& val);
void add (const char* name, const std::string& val) const;

/**
* \brief Get the ival'th value of kth occurrence of the requested name.
Expand Down Expand Up @@ -589,7 +589,7 @@ public:
IntVect& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, const IntVect& val);
void add (const char* name, const IntVect& val) const;
/**
* \brief Get the ival'th value of kth occurrence of the requested name.
* If successful, the value is converted to a Box and stored
Expand Down Expand Up @@ -623,7 +623,7 @@ public:
Box& ref,
int ival = FIRST) const;
//! Add a key 'name'with value 'ref' to the end of the PP table.
void add (const char* name, const Box& val);
void add (const char* name, const Box& val) const;
/**
* \brief Gets an std::vector\<int\> of num_val values from kth occurrence of
* given name. If successful, the values are converted to an int
Expand Down Expand Up @@ -658,7 +658,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<int>& ref);
void addarr (const char* name, const std::vector<int>& ref) const;

/**
* \brief Gets an std::vector\<long\> of num_val values from kth occurrence of
Expand Down Expand Up @@ -694,7 +694,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<long>& ref);
void addarr (const char* name, const std::vector<long>& ref) const;

/**
* \brief Gets an std::vector\<long long\> of num_val values from kth occurrence of
Expand Down Expand Up @@ -730,7 +730,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<long long>& ref);
void addarr (const char* name, const std::vector<long long>& ref) const;

/**
* \brief Gets an std::vector\<float\> of num_val values from kth occurrence of
Expand Down Expand Up @@ -766,7 +766,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<float>& ref);
void addarr (const char* name, const std::vector<float>& ref) const;
/**
* \brief Gets an std::vector\<double\> of num_val values from kth occurrence of
* given name. If successful, the values are converted to a double
Expand Down Expand Up @@ -801,7 +801,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<double>& ref);
void addarr (const char* name, const std::vector<double>& ref) const;
/**
* \brief Gets an std::vector<std::string> of num_val values from kth occurrence of
* given name. If successful, the values are converted to an
Expand Down Expand Up @@ -836,7 +836,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<std::string>& ref);
void addarr (const char* name, const std::vector<std::string>& ref) const;
/**
* \brief Gets an std::vector\<IntVect\> of num_val values from kth occurrence of
* given name. If successful, the values are converted to an
Expand Down Expand Up @@ -871,7 +871,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<IntVect>& ref);
void addarr (const char* name, const std::vector<IntVect>& ref) const;
/**
* \brief Gets an std::vector\<Box\> of num_val values from kth occurrence of
* given name. If successful, the values are converted to an
Expand Down Expand Up @@ -906,7 +906,7 @@ public:
int start_ix = FIRST,
int num_val = ALL) const;
//! Add a key 'name' with vector of values 'ref' to the end of the PP table.
void addarr (const char* name, const std::vector<Box>& refd);
void addarr (const char* name, const std::vector<Box>& refd) const;

/*
* \brief Query IntVect from array
Expand Down Expand Up @@ -960,15 +960,15 @@ public:
* existed previously.
*/
template <typename T, std::enable_if_t<!IsStdVector<T>::value, int> = 0>
int queryAdd (const char* name, T& ref) {
int queryAdd (const char* name, T& ref) const {
int exist = this->query(name, ref);
if (!exist) {
this->add(name, ref);
}
return exist;
}

int queryAdd (const char* name, std::string& ref) {
int queryAdd (const char* name, std::string& ref) const {
int exist = this->query(name, ref);
if (!exist && !ref.empty()) {
this->add(name, ref);
Expand All @@ -986,7 +986,7 @@ public:
* (and resized) according to the number of values in the inputs.
*/
template <typename T>
int queryAdd (const char* name, std::vector<T>& ref) {
int queryAdd (const char* name, std::vector<T>& ref) const {
std::vector<T> empty;
int exist = this->queryarr(name, empty);
if (exist) {
Expand All @@ -1005,7 +1005,7 @@ public:
* existed previously.
*/
template <typename T>
int queryAdd (const char* name, std::vector<T>& ref, int num_val) {
int queryAdd (const char* name, std::vector<T>& ref, int num_val) const {
int exist = this->queryarr(name, ref, 0, num_val);
if (!exist) {
this->addarr(name, ref);
Expand All @@ -1020,7 +1020,7 @@ public:
* existed previously.
*/
template <typename T, std::size_t N>
int queryAdd (const char* name, std::array<T,N>& ref) {
int queryAdd (const char* name, std::array<T,N>& ref) const {
std::vector<T> v;
int exist = this->queryarr(name, v);
if (exist) {
Expand Down
34 changes: 17 additions & 17 deletions Src/Base/AMReX_ParmParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ ParmParse::query (const char* name,

void
ParmParse::add (const char* name,
const bool val)
const bool val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1315,7 +1315,7 @@ ParmParse::query (const char* name, int& ref, int ival) const
}

void
ParmParse::add (const char* name, const int val)
ParmParse::add (const char* name, const int val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1349,7 +1349,7 @@ ParmParse::queryarr (const char* name, std::vector<int>& ref, int start_ix,
}

void
ParmParse::addarr (const char* name, const std::vector<int>& ref)
ParmParse::addarr (const char* name, const std::vector<int>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1382,7 +1382,7 @@ ParmParse::query (const char* name, long& ref, int ival) const

void
ParmParse::add (const char* name,
const long val)
const long val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1416,7 +1416,7 @@ ParmParse::queryarr (const char* name, std::vector<long>& ref, int start_ix,
}

void
ParmParse::addarr (const char* name, const std::vector<long>& ref)
ParmParse::addarr (const char* name, const std::vector<long>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1447,7 +1447,7 @@ ParmParse::query (const char* name, long long& ref, int ival) const
}

void
ParmParse::add (const char* name, const long long val)
ParmParse::add (const char* name, const long long val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1481,7 +1481,7 @@ ParmParse::queryarr (const char* name, std::vector<long long>& ref, int start_ix
}

void
ParmParse::addarr (const char* name, const std::vector<long long>& ref)
ParmParse::addarr (const char* name, const std::vector<long long>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1512,7 +1512,7 @@ ParmParse::query (const char* name, float& ref, int ival) const
}

void
ParmParse::add (const char* name, const float val)
ParmParse::add (const char* name, const float val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1546,7 +1546,7 @@ ParmParse::queryarr (const char* name, std::vector<float>& ref, int start_ix,
}

void
ParmParse::addarr (const char* name, const std::vector<float>& ref)
ParmParse::addarr (const char* name, const std::vector<float>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1579,7 +1579,7 @@ ParmParse::query (const char* name, double& ref, int ival) const
}

void
ParmParse::add (const char* name, const double val)
ParmParse::add (const char* name, const double val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1613,7 +1613,7 @@ ParmParse::queryarr (const char* name, std::vector<double>& ref, int start_ix,
}

void
ParmParse::addarr (const char* name, const std::vector<double>& ref)
ParmParse::addarr (const char* name, const std::vector<double>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1646,7 +1646,7 @@ ParmParse::query (const char* name, std::string& ref, int ival) const
}

void
ParmParse::add (const char* name, const std::string& val)
ParmParse::add (const char* name, const std::string& val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1680,7 +1680,7 @@ ParmParse::queryarr (const char* name, std::vector<std::string>& ref,
}

void
ParmParse::addarr (const char* name, const std::vector<std::string>& ref)
ParmParse::addarr (const char* name, const std::vector<std::string>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1713,7 +1713,7 @@ ParmParse::query (const char* name, IntVect& ref, int ival) const
}

void
ParmParse::add (const char* name, const IntVect& val)
ParmParse::add (const char* name, const IntVect& val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1747,7 +1747,7 @@ ParmParse::queryarr (const char* name, std::vector<IntVect>& ref,
}

void
ParmParse::addarr (const char* name, const std::vector<IntVect>& ref)
ParmParse::addarr (const char* name, const std::vector<IntVect>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down Expand Up @@ -1778,7 +1778,7 @@ ParmParse::query (const char* name, Box& ref, int ival) const
}

void
ParmParse::add (const char* name, const Box& val)
ParmParse::add (const char* name, const Box& val) const
{
saddval(prefixedName(name),val);
}
Expand Down Expand Up @@ -1812,7 +1812,7 @@ ParmParse::queryarr (const char* name, std::vector<Box>& ref,
}

void
ParmParse::addarr (const char* name, const std::vector<Box>& ref)
ParmParse::addarr (const char* name, const std::vector<Box>& ref) const
{
saddarr(prefixedName(name),ref);
}
Expand Down

0 comments on commit fc3bac6

Please sign in to comment.