Loading...
Searching...
No Matches
triple.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: triple.h,v 1.9 2003/08/26 08:04:12 oliver Exp $
//
#ifndef BALL_DATATYPE_TRIPLE_H
#define BALL_DATATYPE_TRIPLE_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
namespace BALL
{
template <typename T1, typename T2, typename T3>
class Triple
{
public:
BALL_CREATE(Triple)
Triple();
Triple(const Triple& triple, bool deep = true);
Triple(const T1& new_first, const T2& new_second, const T3& new_third);
virtual ~Triple();
virtual void clear();
const Triple& operator = (const Triple& triple);
void set(const T1& t1, const T2& t2, const T3& t3);
void get(T1& first, T2& second, T3& third) const;
bool operator == (const Triple& triple) const;
bool operator != (const Triple& triple) const;
bool operator < (const Triple& triple) const;
bool operator <= (const Triple& triple) const;
bool operator >= (const Triple& triple) const;
bool operator > (const Triple& triple) const;
T1 first;
T2 second;
T3 third;
};
template <typename T1, typename T2, typename T3>
Triple<T1, T2, T3>::Triple()
{
}
template <typename T1, typename T2, typename T3>
Triple<T1, T2, T3>::Triple
(const Triple<T1, T2, T3>& triple, bool /* deep */)
: first(triple.first),
second(triple.second),
third(triple.third) {
}
template <typename T1, typename T2, typename T3>
Triple<T1, T2, T3>::Triple
(const T1& new_first, const T2& new_second, const T3& new_third)
: first(new_first),
second(new_second),
third(new_third)
{
}
template <typename T1, typename T2, typename T3>
Triple<T1, T2, T3>::~Triple()
{
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
void Triple<T1, T2, T3>::set(const T1& new_first, const T2& new_second, const T3& new_third)
{
first = new_first;
second = new_second;
third = new_third;
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
const Triple<T1, T2, T3>& Triple<T1, T2, T3>::operator =
(const Triple<T1, T2, T3>& triple)
{
first = triple.first;
second = triple.second;
third = triple.third;
return *this;
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
void Triple<T1, T2, T3>::get(T1& t1, T2& t2, T3& t3)
const
{
t1 = first;
t2 = second;
t3 = third;
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
bool Triple<T1, T2, T3>::operator == (const Triple& triple)
const
{
return (first == triple.first
&& second == triple.second
&& third == triple.third);
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
bool Triple<T1, T2, T3>::operator != (const Triple& triple)
const
{
return (first != triple.first
|| second != triple.second
|| third != triple.third);
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
void Triple<T1, T2, T3>::clear()
{
first = T1();
second = T2();
third = T3();
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
bool Triple<T1, T2, T3>::operator <
(const Triple<T1, T2, T3>& triple) const
{
return ((first < triple.first)
|| ((first == triple.first) && (second < triple.second))
|| ((first == triple.first) && (second == triple.second) && (third < triple.third)));
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
bool Triple<T1, T2, T3>::operator <=
(const Triple<T1, T2, T3>& triple) const
{
return ((first < triple.first)
|| ((first == triple.first) && (second < triple.second))
|| ((first == triple.first) && (second == triple.second) && (third < triple.third))
|| ((first == triple.first) && (second == triple.second) && (third == triple.third)));
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
bool Triple<T1, T2, T3>::operator >=
(const Triple<T1, T2, T3>& triple) const
{
return ((first > triple.first)
|| ((first == triple.first) && (second > triple.second))
|| ((first == triple.first) && (second == triple.second) && (third > triple.third))
|| ((first == triple.first) && (second == triple.second) && (third == triple.third)));
}
template <typename T1, typename T2, typename T3>
BALL_INLINE
bool Triple<T1, T2, T3>::operator >
(const Triple<T1, T2, T3>& triple) const
{
return ((first > triple.first)
|| ((first == triple.first) && (second > triple.second))
|| ((first == triple.first) && (second == triple.second) && (third > triple.third)));
}
} // namespace BALL
#endif // BALL_DATATYPE_TRIPLE_H
BALL::Triple::operator>
bool operator>(const Triple &triple) const
Definition triple.h:258
BALL::Triple::second
T2 second
Definition triple.h:128
BALL::Triple::set
void set(const T1 &t1, const T2 &t2, const T3 &t3)
Definition triple.h:165
BALL::Triple::third
T3 third
Definition triple.h:132
BALL::Triple::get
void get(T1 &first, T2 &second, T3 &third) const
Definition triple.h:186
BALL::Triple::operator=
const Triple & operator=(const Triple &triple)
Definition triple.h:175
BALL::Triple::operator<
bool operator<(const Triple &triple) const
Definition triple.h:226
BALL::Triple::clear
virtual void clear()
Definition triple.h:216
BALL::Triple::operator==
bool operator==(const Triple &triple) const
Definition triple.h:196
BALL::Triple::operator>=
bool operator>=(const Triple &triple) const
Definition triple.h:247
BALL::Triple::operator!=
bool operator!=(const Triple &triple) const
Definition triple.h:206
BALL::Triple::operator<=
bool operator<=(const Triple &triple) const
Definition triple.h:236
BALL::Triple::Triple
Triple()
Definition triple.h:137
BALL::Triple::first
T1 first
Definition triple.h:124
BALL::Triple::~Triple
virtual ~Triple()
Definition triple.h:159
common.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL_INLINE
#define BALL_INLINE
Definition debug.h:15
BALL
Definition constants.h:13