File: Coordinate.hpp

package info (click to toggle)
pbseqlib 5.3.1%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,136 kB
  • sloc: cpp: 77,246; python: 570; makefile: 312; sh: 111; ansic: 9
file content (49 lines) | stat: -rw-r--r-- 1,194 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _BLASR_COORDINATE_HPP_
#define _BLASR_COORDINATE_HPP_

#include <pbdata/Types.h>

class Coordinate
{
private:
    UInt x;
    UInt y;

public:
    inline UInt GetX() const;
    inline UInt GetY() const;
    inline UInt SetX(UInt _x);
    inline UInt SetY(UInt _y);
    inline int operator<(const Coordinate &rhs) const;
    int operator<=(const Coordinate &rhs) const;
    int Equals(const Coordinate &rhs) const;
    //
    // Synonym for Equals.
    //
    inline int operator==(const Coordinate &rhs) const;
    inline Coordinate &operator=(const Coordinate &rhs);
};

inline UInt Coordinate::GetX() const { return x; }
inline UInt Coordinate::GetY() const { return y; }

inline UInt Coordinate::SetX(UInt _x) { return (x = _x); }
inline UInt Coordinate::SetY(UInt _y) { return (y = _y); }

inline int Coordinate::operator<(const Coordinate &rhs) const
{
    if (x == rhs.GetX())
        return y < rhs.GetY();
    else
        return x < rhs.GetX();
}

inline int Coordinate::operator==(const Coordinate &rhs) const { return this->Equals(rhs); }

inline Coordinate &Coordinate::operator=(const Coordinate &rhs)
{
    this->x = rhs.x;
    this->y = rhs.y;
    return *this;
}
#endif