23 for (
int i = 0, N = names.size(); i < N; ++i ) {
24 std::string name = names[i];
26 std::ostringstream oss;
32 throw std::logic_error(
"GenRunInfo::set_weight_names: "
33 "Duplicate weight name '" + name +
45 if ( !i->second )
return {};
48 i->second->to_string(ret);
58 using att_val_t = std::map<std::string, std::shared_ptr<Attribute>>::value_type;
62 vt.second->to_string(att);
78 std::vector<std::string> results;
80 results.emplace_back(vt1.first);
96 for (
unsigned int i = 0; i < data.
tool_name.size(); ++i) {
102 this->
tools().emplace_back(ti);
111 std::lock_guard<std::recursive_mutex> lhs_lk(
m_lock_attributes, std::adopt_lock);
112 std::lock_guard<std::recursive_mutex> rhs_lk(r.
m_lock_attributes, std::adopt_lock);
123 std::lock_guard<std::recursive_mutex> lhs_lk(
m_lock_attributes, std::adopt_lock);
124 std::lock_guard<std::recursive_mutex> rhs_lk(r.
m_lock_attributes, std::adopt_lock);
Definition of struct GenRunInfoData.
Definition of class GenRunInfo.
std::recursive_mutex m_lock_attributes
Mutex lock for the m_attibutes map.
GenRunInfo & operator=(const GenRunInfo &r)
Assignmet.
std::map< std::string, int > m_weight_indices
A map of weight names mapping to indices.
std::map< std::string, std::shared_ptr< Attribute > > m_attributes
Map of attributes.
std::vector< std::string > attribute_names() const
Get list of attribute names.
void add_attribute(const std::string &name, const std::shared_ptr< Attribute > &att)
add an attribute This will overwrite existing attribute if an attribute with the same name is present
bool has_weight(const std::string &name) const
Check if a weight name is present.
std::vector< std::string > m_weight_names
A vector of weight names.
void read_data(const GenRunInfoData &data)
Fill GenRunInfo based on GenRunInfoData.
GenRunInfo()
Default constructor.
const std::vector< std::string > & weight_names() const
Get the vector of weight names.
void write_data(GenRunInfoData &data) const
Fill GenRunInfoData object.
const std::vector< ToolInfo > & tools() const
The vector of tools used to produce this run.
void set_weight_names(const std::vector< std::string > &names)
Set the names of the weights in this run.
std::string attribute_as_string(const std::string &name) const
Get attribute of any type as string.
Stores serializable run information.
std::vector< std::string > tool_name
Tool names.
std::vector< std::string > tool_version
Tool versions.
std::vector< std::string > attribute_string
Attribute serialized as string.
std::vector< std::string > attribute_name
Attribute name.
std::vector< std::string > tool_description
Tool descriptions.
std::vector< std::string > weight_names
Weight names.