virtual void set_max_duration(double duration);
/** @brief Get the tracing category associated to the current action */
- std::string get_category() const { return category_; }
+ const std::string& get_category() const { return category_; }
/** @brief Set the tracing category of the current Action */
void set_category(std::string category) { category_ = std::move(category); }
T& get() { return value_; }
T const& get() const { return value_; }
- std::string get_name() const { return name_; }
+ const std::string& get_name() const { return name_; }
// Implicit conversion to the underlying type:
operator T&() { return value_; }
operator T const&() const{ return value_; }
explicit Path(std::string path): path_(std::move(path)) {}
/** @brief Returns the full path name */
- std::string get_name() { return path_; }
+ const std::string& get_name() const { return path_; }
/** @brief Returns the directory component of a path (reimplementation of POSIX dirname) */
std::string get_dir_name();
/** @brief Returns the file component of a path (reimplementation of POSIX basename) */
static Container* by_name_or_null(const std::string& name);
static Container* by_name(const std::string& name);
- std::string get_name() { return name_; }
+ const std::string& get_name() const { return name_; }
const char* get_cname() { return name_.c_str(); }
long long int get_id() { return id_; }
void remove_from_parent();
/* Unimplemented calls are: WAITANY, SENDRECV, SCAN, EXSCAN, SSEND, and ISSEND. */
// FIXME: dirty extract "rank-" from the name, as we want the bare process id here
- if (get_container()->get_name().find("rank-") != 0)
+ if (get_container()->get_name().find("rank-") != 0) {
stream_ << get_container()->get_name() << " " << extra_->print();
- else
+ } else {
/* Subtract -1 because this is the process id and we transform it to the rank id */
- stream_ << stoi(get_container()->get_name().erase(0, 5)) - 1 << " " << extra_->print();
-
+ std::string container_name(get_container()->get_name());
+ stream_ << stoi(container_name.erase(0, 5)) - 1 << " " << extra_->print();
+ }
*tracing_files.at(get_container()) << stream_.str() << std::endl;
} else {
THROW_IMPOSSIBLE;
Type(std::string name, std::string alias, std::string color, Type* father);
virtual ~Type();
- std::string get_name() { return name_; }
+ const std::string& get_name() const { return name_; }
const char* get_cname() { return name_.c_str(); }
long long int get_id() { return id_; }
bool is_colored() { return not color_.empty(); }
virtual ~TIData() {}
- std::string getName() { return name_; }
+ const std::string& getName() const { return name_; }
double getAmount() { return amount_; }
virtual std::string print() = 0;
virtual std::string display_size() = 0;