Loading...
Searching...
No Matches
supernovas::Source Class Referenceabstract
Astronomical object of interest

An abstract superclass for an astronomical source or target of observation. More...

`#include <supernovas.h>`

Inheritance diagram for supernovas::Source:

## Public Member Functions

virtual | ~Source ()
const struct novas_object * | _novas_object () const
| Returns a pointer to the NOVAS C novas_object data structure that stores data internally.
Angle | angle_to (const Source &source, const Frame &frame) const
| Returns the apparent angular separation of this source from another source, for the given observer location and time of observation.
Apparent | apparent_in (const Frame &frame) const
| Returns the apparent position of a source (if possible), or else an invalid position.
virtual const Source * | copy () const =0
| Returns a pointer to a newly allocated copy of this instance.
bool | equals (const Source &other) const
| Checks if this astronomical source is the same as another within typical tolerances.
EquatorialTrack | equatorial_track (const Frame &frame, const Interval &range) const
| Returns the short-term equatorial trajectory of this source on the observer's sky, which can be used for extrapolating its apparent position in the near-term to avoid the repeated full-fledged position calculation, which may be expensive.
EquatorialTrack | equatorial_track (const Frame &frame, double range_seconds=Unit::hour) const
| Returns the short-term equatorial trajectory of this source on the observer's sky, which can be used for extrapolating its apparent position in the near-term to avoid the repeated full-fledged position calculation, which may be expensive.
Geometric | geometric_in (const Frame &frame, enum novas_reference_system system=NOVAS_TOD) const
| Returns the geometric position of a source (if possible) relative to the observer, or else an invalid position if the source could not be positioned in the observing frame.
HorizontalTrack | horizontal_track (const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
| Returns a 1-minute horizontal trajectory of this source on the observer's sky, which can be used for extrapolating its apparent position for within a 1-minute interval to avoid the repeated full-fledged position calculation at higher rates, which may be expensive.
Angle | moon_angle (const Frame &frame) const
| Returns the apparent angular separation of this source from the Moon, for the given observer location and time of observation.
std::string | name () const
| Returns the name given to this source at instantiation.
bool | operator!= (const Source &other) const
| Checks if this astronomical source differs another given typical tolerances.
bool | operator== (const Source &other) const
| Checks if this astronomical source is the same as another within typical tolerances.
Time | rises_above (const Angle &el, const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
| Returns the time when the source rises above the specified elevation next for an observer located on or near Earth's surface, or else an undefined (invalid) time if the observer is not near Earth's surface.
Time | sets_below (const Angle &el, const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
| Returns the time when the source sets below the specified elevation next for an observer located on or near Earth's surface, or else an undefined (invalid) time if the observer is not near Earth's surface.
Angle | sun_angle (const Frame &frame) const
| Returns the pparent angular separation of this source from the Sun, for the given observer location and time of observation.
virtual std::string | to_string () const =0
Time | transits_in (const Frame &frame) const
| Returns the time when the source transits for an observer located on or near Earth's surface, or else an undefined (invalid) time if the observer is not near Earth's surface.
enum novas_object_type | type () const
| Returns the type of this source.
Public Member Functions inherited from supernovas::Validating
bool | is_valid () const
| Returns the previously set 'valid' state of the implementing instance.
| operator bool () const
| Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid().

## Static Public Member Functions

static void | set_case_sensitive (bool value)
| Enables or disabled case-sensitive treatment of source names.

## Protected Member Functions

| Source ()
| stored data on source
Protected Member Functions inherited from supernovas::Validating
| Validating ()
| dummy constructor;

## Protected Attributes

struct novas_object | _object = {}
Protected Attributes inherited from supernovas::Validating
bool | _valid = false
| the state variable.

## Detailed Description

An abstract superclass for an astronomical source or target of observation.

Since
  1.6

See also
  CatalogSource, Planet, EphemerisSource, OrbitalSource

## Constructor & Destructor Documentation

## Source()

supernovas::Source::Source | ( |  | ) |

inline protected

stored data on source

Referenced by supernovas::CatalogSource::CatalogSource(), angle_to(), supernovas::CatalogSource::copy(), copy(), equals(), operator!=(), and operator==().

## ~Source()

virtual supernovas::Source::~Source | ( |  | ) |

inline virtual

## Member Function Documentation

## _novas_object()

const struct novas_object * supernovas::Source::_novas_object | ( |  | ) | const

Returns a pointer to the NOVAS C novas_object data structure that stores data internally.

Returns
  a pointer to the underlying NOVAS C novas_object data structure.

Since
  1.6

References _object.

Referenced by supernovas::SolarSystemSource::barycentric_at(), equatorial_track(), and horizontal_track().

## copy()

virtual const Source * supernovas::Source::copy | ( |  | ) | const

pure virtual

Returns a pointer to a newly allocated copy of this instance.

Since
  1.6

Returns
  pointer to a newly allocated copy.

Implemented in supernovas::CatalogSource, supernovas::EphemerisSource, supernovas::OrbitalSource, and supernovas::Planet.

References Source(), supernovas::Unit::hour, NOVAS_TOD, and supernovas::Weather::standard().

## equals()

bool supernovas::Source::equals | ( | const Source & | other | ) | const

Checks if this astronomical source is the same as another within typical tolerances.

Two sources are considered equals only if their types, names (case sensitive), and defining parameters all match within tolerances.

Note, that a source instance may not equal itself if it contains NAN or infinite components.

Parameters

  other | the other source

Returns
  true if this source and the other source describe essentially the same astronomical object/position within tolerances, otherwise false.

Since
  1.7

See also
  operator==(), operator!=()

References Source(), _object, and novas_equals_object().

Referenced by operator!=(), and operator==().

## name()

std::string supernovas::Source::name | ( |  | ) | const

Returns the name given to this source at instantiation.

It may be lower-case unless the set_case_sensitive(true) was called before instantiating the source.

Returns
  the given source name.

Since
  1.6

See also
  set_case_sensitive()

References _object.

Referenced by supernovas::EphemerisSource::EphemerisSource(), supernovas::OrbitalSource::OrbitalSource(), supernovas::Planet::Planet(), supernovas::Planet::for_naif_id(), supernovas::Planet::for_name(), supernovas::EphemerisSource::to_string(), supernovas::OrbitalSource::to_string(), supernovas::OrbitalSystem::to_string(), and supernovas::Planet::to_string().

## operator!=()

bool supernovas::Source::operator!= | ( | const Source & | other | ) | const

Checks if this astronomical source differs another given typical tolerances.

Same as !equals().

Parameters

  other | the other source

Returns
  true if this source and the other source describe two distinct astronomical objects/positions given the tolerances, otherwise false.

Since
  1.7

See also
  equals(), operator==()

References Source(), and equals().

## operator==()

bool supernovas::Source::operator== | ( | const Source & | other | ) | const

Checks if this astronomical source is the same as another within typical tolerances.

Two sources are considered equals only if their types, names (case sensitive), and defining parameters all match within tolerances. Same as equals().

Parameters

  other | the other source

Returns
  true if this source and the other source describe essentially the same astronomical object/position within tolerances, otherwise false.

Since
  1.7

See also
  equals(), operator!=()

References Source(), and equals().

## set_case_sensitive()

void supernovas::Source::set_case_sensitive | ( | bool | value | ) |

static

Enables or disabled case-sensitive treatment of source names.

It only affect sources that are instantiated after the change has been made.

Parameters

  value | true to enable case sensitive processing of name for newly defined sources or else false to convert all future source names to lower-case for case-insensitive processing.

Since
  1.6

References novas_case_sensitive().

## to_string()

virtual std::string supernovas::Source::to_string | ( |  | ) | const

pure virtual

Implemented in supernovas::CatalogSource, supernovas::EphemerisSource, supernovas::OrbitalSource, and supernovas::Planet.

## type()

enum novas_object_type supernovas::Source::type | ( |  | ) | const

Returns the type of this source.

Returns
  the source type constant

Since
  1.6

References _object.

## Member Data Documentation

## _object

struct novas_object supernovas::Source::_object = {}

protected

Referenced by supernovas::CatalogSource::CatalogSource(), supernovas::EphemerisSource::EphemerisSource(), supernovas::OrbitalSource::OrbitalSource(), supernovas::Planet::Planet(), _novas_object(), supernovas::OrbitalSource::_novas_orbital(), angle_to(), apparent_in(), equals(), geometric_in(), supernovas::SolarSystemSource::helio_distance(), supernovas::SolarSystemSource::helio_rate(), supernovas::Planet::mass(), supernovas::Planet::mean_radius(), moon_angle(), name(), supernovas::Planet::novas_id(), supernovas::EphemerisSource::number(), supernovas::OrbitalSource::orbital(), rises_above(), sets_below(), supernovas::SolarSystemSource::solar_illumination(), supernovas::SolarSystemSource::solar_power(), sun_angle(), transits_in(), and type().