template class utils::Triplet — HIRO 0.7.0 documentation

# template class utils::Triplet

## Overview

Structure which holds three variables of same type. More…

    #include <Triplet.h>

    template <typename Type>
    class Triplet {
    public:
        // construction

        Triplet();
        Triplet(Type val_1, Type val_2, Type val_3);

        // methods

        virtual void Set(Type val_1, Type val_2, Type val_3);
        virtual bool Contains(const Type value) const;
        virtual Type& operator[](size_t idx);
        Type GetFirst() const;
        void SetFirst(Type value);
        Type GetSecond() const;
        void SetSecond(Type value);
        Type GetThird() const;
        void SetThird(Type value);
        virtual bool operator==(const Triplet<Type>& obj) const;
        virtual bool operator!=(const Triplet<Type>& obj) const;
        Triplet& operator+=(const Type val);
        Triplet& operator*=(const Type val);
    };

## Detailed Documentation

Structure which holds three variables of same type.

### Methods

    virtual void Set(Type val_1, Type val_2, Type val_3)

Sets values.

    virtual bool Contains(const Type value) const

Checks if at least one of the three is equal to the value.

    virtual Type& operator[](size_t idx)

Returns reference to the value by a specified index.

    Type GetFirst() const

Returns the first value.

    void SetFirst(Type value)

Sets the first value.

    Type GetSecond() const

Returns the second value.

    void SetSecond(Type value)

Sets the second value.

    Type GetThird() const

Returns the third value.

    void SetThird(Type value)

Sets the third value.

    virtual bool operator==(const Triplet<Type>& obj) const

Compares two triplets. The order of values is not important.

    virtual bool operator!=(const Triplet<Type>& obj) const

Compares two triplets. The order of values is not important.

    Triplet& operator+=(const Type val)

Increases all values by a specific amount.

    Triplet& operator*=(const Type val)

Multiples all values with a specific value.