XdmfAttributeType.hpp 2.36 KB
Newer Older
1 2 3
#ifndef XDMFATTRIBUTETYPE_HPP_
#define XDMFATTRIBUTETYPE_HPP_

4
// Includes
5
#include <string>
6
#include "XdmfItemProperty.hpp"
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/**
 * @brief Property describing what types of values an XdmfAttribute contains.
 *
 * XdmfAttributeType is a property used by XdmfAttribute to specify what types of values the XdmfAttribute
 * contains.  A specific XdmfAttributeType can be created by calling one of the static methods
 * in the class, i.e. XdmfAttributeType::Scalar().
 *
 * Xdmf supports the following attribute types:
 * 	NoAttributeType
 * 	Scalar
 * 	Vector
 * 	Tensor
 * 	Matrix
 * 	Tensor6
 * 	GlobalId
 */
24
class XdmfAttributeType : public XdmfItemProperty {
25 26 27

public:

28 29
	friend class XdmfAttribute;

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
	// Supported Xdmf Attribute Types
	static XdmfAttributeType NoAttributeType();
	static XdmfAttributeType Scalar();
	static XdmfAttributeType Vector();
	static XdmfAttributeType Tensor();
	static XdmfAttributeType Matrix();
	static XdmfAttributeType Tensor6();
	static XdmfAttributeType GlobalId();

	/**
	 * Get the name of this attribute type
	 *
	 * @return a string containing the name.
	 */
	std::string getName() const;

46 47
	void getProperties(std::map<std::string, std::string> & collectedProperties) const;

48 49 50
	/*
	 * Compare two XdmfAttributeTypes for equality.
	 *
51 52
	 * @param attributeType an XdmfAttributeType to compare equality to.
	 * @return true if the XdmfAttributeTypes are equal.
53
	 */
54
	bool operator==(const XdmfAttributeType & attributeType) const;
55 56 57 58

	/**
	 * Compare two XdmfAttributeTypes for inequality.
	 *
59 60
	 * @param attributeType an XdmfAttributeType to compare inequality to.
	 * @return true if the XdmfAttributeTypes are not equal.
61
	 */
62
	bool operator!=(const XdmfAttributeType & attributeType) const;
63

64 65
	XdmfAttributeType(const XdmfAttributeType & attributeType);
	XdmfAttributeType& operator=(const XdmfAttributeType & attributeType);
66 67 68 69 70

protected:

	/**
	 * Protected constructor for XdmfAttributeType.  The constructor is protected because all attribute types supported
71 72 73 74
	 * by Xdmf should be accessed through more specific static methods that construct XdmfAttributeTypes - i.e.
	 * XdmfAttributeType::Scalar().
	 *
	 * @param name the name of the XdmfAttributeType to construct.
75
	 */
76
	XdmfAttributeType(const std::string & name);
77 78 79

private:

80 81
	static XdmfAttributeType New(const std::map<std::string, std::string> & itemProperties);

82 83 84 85
	std::string mName;
};

#endif /* XDMFATTRIBUTETYPE_HPP_ */