Skip to content

Commit

Permalink
Pass strings as references
Browse files Browse the repository at this point in the history
  • Loading branch information
yolandab committed Jun 20, 2024
1 parent aab1745 commit 4413f2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hecuba_core/src/api/AttributeClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AttributeClass {
HecubaExtrae_event(HECUBAEV, HECUBA_END);
};
// Constructor called when instantiating a new value with parameters: MyValueClass v(value);
AttributeClass(std::string attrBaseName, const V1& part, const rest&... vals) {
AttributeClass(const std::string& attrBaseName, const V1& part, const rest&... vals) {
HecubaExtrae_event(HECUBAEV, HECUBA_ATTRCLASS|HECUBA_INSTANTIATION);
//DEBUG("Number of clustering keys: "<<sizeof...(values)<<std::endl);
// first element is the partition key, the rest of elements are clustering keys
Expand Down Expand Up @@ -71,7 +71,7 @@ class AttributeClass {
return *this;
}

template <class V> void manageAttr(std::string attrBaseName, const V& value) {
template <class V> void manageAttr(const std::string& attrBaseName, const V& value) {
DBG("Clust Key " <<std::string(typeid(decltype(value)).name())<<std::endl);
std::string valuetype=ObjSpec::c_to_cass(typeid(decltype(value)).name());
std::pair<std::string, std::string> valuedesc(attrBaseName+std::to_string(managedValues), valuetype);
Expand All @@ -80,7 +80,7 @@ class AttributeClass {
managedValues++;
}

template <class V1alt, class...restalt> void manageRest(std::string attrBaseName, const V1alt& part, const restalt&... restValues){
template <class V1alt, class...restalt> void manageRest(const std::string& attrBaseName, const V1alt& part, const restalt&... restValues){
/* deal with the first parameter */
//DBG("Clust Key " << part << " "<<std::string(typeid(decltype(part)).name())<<std::endl);
manageAttr<V1alt>(attrBaseName, part);
Expand Down Expand Up @@ -151,7 +151,7 @@ class AttributeClass {
return buf;

}
template <class V> void createAttributeBuffer(std::string valuetype, const V& value) {
template <class V> void createAttributeBuffer(const std::string& valuetype, const V& value) {
char * buf;
int size=0;
if (ObjSpec::isBasicType(valuetype)) {
Expand Down Expand Up @@ -198,7 +198,7 @@ class AttributeClass {
}
}

void generateAttrDescr(std::string attrBaseName) {
void generateAttrDescr(const std::string& attrBaseName) {
if (managedValues == 0) {
std::vector<const char *> v={typeid(V1).name(),typeid(rest).name()...};
std::vector<const char *>::iterator it = v.begin();
Expand All @@ -212,7 +212,7 @@ class AttributeClass {

}

std::vector<std::pair<std::string, std::string>> getValuesDesc(std::string attrBaseName) {
std::vector<std::pair<std::string, std::string>> getValuesDesc(const std::string& attrBaseName) {
if (managedValues == 0) {
generateAttrDescr(attrBaseName);
}
Expand Down

0 comments on commit 4413f2e

Please sign in to comment.