CARMA C++
Velocity.h
Go to the documentation of this file.
1 // $Id: Velocity.h,v 1.15 2014/04/02 23:11:12 iws Exp $
2 
13 #ifndef CARMA_SERVICES_VELOCITY_H
14 #define CARMA_SERVICES_VELOCITY_H
15 
17 #include "carma/services/stringConstants.h"
18 #include "carma/services/Angle.h"
19 #include "carma/services/Types.h"
20 #include <iostream>
21 #include <string>
22 
23 namespace carma {
24  namespace services {
25 
42  class Velocity : public ConformableQuantity {
43  public:
44 
52  Velocity(double value,
53  const std::string& units,
54  velocityFrameType velFrame = FRAME_LSR,
55  velocityDefType velDef = VEL_RADIO
56  );
57 
59  virtual ~Velocity();
60 
66  return velFrame_;
67  }
68 
74  return velDef_;
75  }
76 
80  void cotra_radio_lsr(Angle ra, Angle dec);
81 
98  static velocityDefType
99  translateDefinition(const std::string& def) ;
100 
115  static velocityFrameType
116  translateFrame(const std::string& frame) ;
117 
122  double kms() const
123  {
124  return convert( KMS );
125  }
126 
131  double mph() const
132  {
133  return convert( MPH );
134  }
135 
142  const Velocity operator+(const Velocity& velocity) const;
143 
150  const Velocity operator-(const Velocity& velocity) const;
151 
156  Velocity& operator+=(const Velocity &frequency);
157 
162  Velocity& operator-=(const Velocity &frequency);
163 
164  private:
166  velocityFrameType velFrame_;
167 
169  velocityDefType velDef_;
170 
171  };
172 
176 std::ostream& operator<<(std::ostream& os,
177  const carma::services::Velocity& velocity);
178  }
179 }
180 
181 
182 #endif //CARMA_SERVICES_VELOCITY_H
The ConformableQuantity class can represent any quantity that can be expressed in many units...
static velocityFrameType translateFrame(const std::string &frame)
Translate a string representation of a velocity frame into a velocityFrame enumeration constant...
const Velocity operator-(const Velocity &velocity) const
Subtract two Velocities.
Representation of an angle, return values are always modulo 2PI radians.
void cotra_radio_lsr(Angle ra, Angle dec)
Converts velocity to FrameType=LSR and DefType=RADIO.
Velocity & operator+=(const Velocity &frequency)
Increment Velocity.
Radio definition: nu = nu0(1 - V/c)
Definition: Types.h:59
Various type definitions for services classes.
The Velocity class can represent an velocity in any units.
Definition: Velocity.h:42
Velocity & operator-=(const Velocity &frequency)
Decrement Velocity.
Velocity(double value, const std::string &units, velocityFrameType velFrame=FRAME_LSR, velocityDefType velDef=VEL_RADIO)
Construct an Velocity given a value and units.
velocityDefType getDefinition() const
Definition: Velocity.h:73
Kinematic local standard of rest.
Definition: Types.h:32
const Velocity operator+(const Velocity &velocity) const
Add two Velocities.
double kms() const
Convenience method to return km/s.
Definition: Velocity.h:122
virtual double convert(const std::string &convertTo) const
Converts this quantity to any conformable units.
The Angle class can represent any angle in any units.
Definition: Angle.h:38
enum carma::services::velocityDefEnum velocityDefType
The Velocity Definition.
virtual ~Velocity()
Destructor.
velocityFrameType getFrame() const
Definition: Velocity.h:65
Parent class for representations of quantities that can have conformable units, e.g.
double mph() const
Convenience method to return miles per hour.
Definition: Velocity.h:131
std::ostream & operator<<(std::ostream &os, const carma::services::Angle &angle)
Define the &lt;&lt; operator to allow, e.g.
enum carma::services::velocityFrameEnum velocityFrameType
The Velocity Frame.
Definition: Types.h:25
static velocityDefType translateDefinition(const std::string &def)
Translate a string representation of a velocity definition into a velocityDef enumeration constant...