Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::Nexus::NXAttributes Class Reference

Nexus attributes. More...

#include <NexusClasses.h>

Public Member Functions

std::size_t n () const
 number of attributes
 
std::vector< std::string > names () const
 Returns the list of attribute names.
 
std::string operator() (const std::string &name) const
 returns the value of attribute with name name
 
void set (const std::string &name, const std::string &value)
 set the attribute's value from string
 
template<typename T >
void set (const std::string &name, T value)
 set the attribute's value from type
 
std::vector< std::string > values () const
 Returns the list of attribute values.
 

Private Attributes

std::map< std::string, std::string > m_values
 the list of attributes
 

Detailed Description

Nexus attributes.

The type of each attribute is NX_CHAR

Definition at line 68 of file NexusClasses.h.

Member Function Documentation

◆ n()

std::size_t Mantid::Nexus::NXAttributes::n ( ) const
inline

number of attributes

Definition at line 70 of file NexusClasses.h.

◆ names()

std::vector< std::string > Mantid::Nexus::NXAttributes::names ( ) const

Returns the list of attribute names.

Definition at line 26 of file NexusClasses.cpp.

References m_values, and value.

◆ operator()()

std::string Mantid::Nexus::NXAttributes::operator() ( const std::string &  name) const

returns the value of attribute with name name

Returns the value of an attribute.

Parameters
name:: The name of the attribute
Returns
The value of the attribute if it exists or an empty string otherwise

Definition at line 46 of file NexusClasses.cpp.

References m_values, and name.

◆ set() [1/2]

void Mantid::Nexus::NXAttributes::set ( const std::string &  name,
const std::string &  value 
)

set the attribute's value from string

Sets the value of the attribute.

Parameters
name:: The name of the attribute
value:: The new value of the attribute

Definition at line 57 of file NexusClasses.cpp.

References m_values, name, and value.

Referenced by Mantid::Nexus::NXDataSet::getAttributes().

◆ set() [2/2]

template<typename T >
void Mantid::Nexus::NXAttributes::set ( const std::string &  name,
value 
)

set the attribute's value from type

Sets the value of the attribute from typed value.

Parameters
name:: The name of the attribute
value:: The new value of the attribute

Definition at line 63 of file NexusClasses.cpp.

References m_values, name, std::to_string(), and value.

◆ values()

std::vector< std::string > Mantid::Nexus::NXAttributes::values ( ) const

Returns the list of attribute values.

Definition at line 34 of file NexusClasses.cpp.

References m_values, and value.

Member Data Documentation

◆ m_values

std::map<std::string, std::string> Mantid::Nexus::NXAttributes::m_values
private

the list of attributes

Definition at line 77 of file NexusClasses.h.

Referenced by names(), operator()(), set(), set(), and values().


The documentation for this class was generated from the following files: