Skip to content

Commit

Permalink
Fix friend function scope in starbook namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
not7cd committed Dec 17, 2018
1 parent 7cc2ff8 commit 4112c34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 5 additions & 5 deletions indi-starbook/starbook_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ starbook::DMS::DMS(std::string dms) : ln_dms{0, 0, 0, 0} {
}
}

std::ostream &starbook::operator<<(std::ostream &os, const starbook::DMS &dms) {
std::ostream &operator<<(std::ostream &os, const starbook::DMS &dms) {
if (dms.neg != 0) os << "-";
os << std::fixed << std::setprecision(0) << std::setfill('0')
<< std::setw(3) << dms.degrees
Expand All @@ -57,7 +57,7 @@ starbook::HMS::HMS(std::string hms) : ln_hms{0, 0, 0} {
}
}

std::ostream &starbook::operator<<(std::ostream &os, const starbook::HMS &hms) {
std::ostream &operator<<(std::ostream &os, const starbook::HMS &hms) {
os << std::fixed << std::setprecision(0) << std::setfill('0')
<< std::setw(2) << hms.hours
<< std::setw(0) << "+"
Expand All @@ -72,11 +72,11 @@ starbook::Equ::Equ(double ra, double dec) : lnh_equ_posn{{0, 0, 0},
ln_equ_to_hequ(&target_d, this);
}

std::ostream &starbook::operator<<(std::ostream &os, const starbook::Equ &equ) {
std::ostream &operator<<(std::ostream &os, const starbook::Equ &equ) {
os << "RA=";
os << static_cast<const HMS &> (equ.ra);
os << static_cast<const starbook::HMS &> (equ.ra);

os << "&DEC=";
os << static_cast<const DMS &> (equ.dec);
os << static_cast<const starbook::DMS &> (equ.dec);
return os;
}
12 changes: 9 additions & 3 deletions indi-starbook/starbook_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,28 @@ namespace starbook {
struct DMS : ln_dms {
explicit DMS(std::string dms);

friend std::ostream &operator<<(std::ostream &os, const DMS &hms);

};

struct HMS : ln_hms {
explicit HMS(std::string hms);

friend std::ostream &operator<<(std::ostream &os, const HMS &hms);

};

struct Equ : lnh_equ_posn {
Equ(double ra, double dec);

friend std::ostream &operator<<(std::ostream &os, const Equ &equ);
};
}

std::ostream &operator<<(std::ostream &os, const starbook::DMS &hms);

std::ostream &operator<<(std::ostream &os, const starbook::HMS &hms);

std::ostream &operator<<(std::ostream &os, const starbook::Equ &equ);


enum StarbookState {
SB_INIT, /* Initial state after boot */
SB_GUIDE, /* ??? */
Expand Down

0 comments on commit 4112c34

Please sign in to comment.