[Debian-astro-commits] [gyoto] 31/221: Add typecast from Astrobj::Properties to Quantity_t

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

thibaut pushed a commit to branch master
in repository gyoto.

commit ab278de34b78e5f80db2b0fa4a6567a9fe122e15
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Sat Oct 11 12:39:25 2014 +0200

    Add typecast from Astrobj::Properties to Quantity_t
---
 include/GyotoAstrobj.h |  2 ++
 include/GyotoDefs.h    |  2 ++
 lib/Astrobj.C          | 20 ++++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/include/GyotoAstrobj.h b/include/GyotoAstrobj.h
index a57f6f5..ef258ce 100644
--- a/include/GyotoAstrobj.h
+++ b/include/GyotoAstrobj.h
@@ -770,6 +770,8 @@ class Gyoto::Astrobj::Properties : protected Gyoto::SmartPointee {
    */
   Properties operator+=(ptrdiff_t offset);
 
+  operator Gyoto::Quantity_t () const;
+
 # ifdef HAVE_UDUNITS
   void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
   ///< Set Properties::intentity_converter_
diff --git a/include/GyotoDefs.h b/include/GyotoDefs.h
index 2bd43e4..8271162 100644
--- a/include/GyotoDefs.h
+++ b/include/GyotoDefs.h
@@ -74,6 +74,8 @@ namespace Gyoto {
 
   /* Generic */
 
+#define GYOTO_QUANTITY_NONE           0
+
   /// Intensity: I<SUB>ν</SUB> at Scenery::freq_obs_.
 #define GYOTO_QUANTITY_INTENSITY      1
   /// EmissionTime: Emission date.
diff --git a/lib/Astrobj.C b/lib/Astrobj.C
index 009d27f..ae382d6 100644
--- a/lib/Astrobj.C
+++ b/lib/Astrobj.C
@@ -571,3 +571,23 @@ Astrobj::Properties Astrobj::Properties::operator++() {
   (*this) += 1;
   return *this;
 }
+
+Astrobj::Properties::operator Quantity_t () const {
+  Quantity_t res=GYOTO_QUANTITY_NONE;
+
+  if (intensity)    res |= GYOTO_QUANTITY_INTENSITY;
+  if (time)         res |= GYOTO_QUANTITY_EMISSIONTIME;
+  if (distance)     res |= GYOTO_QUANTITY_MIN_DISTANCE;
+  if (first_dmin)   res |= GYOTO_QUANTITY_FIRST_DMIN;
+  if (redshift)     res |= GYOTO_QUANTITY_REDSHIFT;
+  if (spectrum)     res |= GYOTO_QUANTITY_SPECTRUM;
+  if (binspectrum)  res |= GYOTO_QUANTITY_BINSPECTRUM;
+  if (impactcoords) res |= GYOTO_QUANTITY_IMPACTCOORDS;
+  if (user1)        res |= GYOTO_QUANTITY_USER1;
+  if (user2)        res |= GYOTO_QUANTITY_USER2;
+  if (user3)        res |= GYOTO_QUANTITY_USER3;
+  if (user4)        res |= GYOTO_QUANTITY_USER4;
+  if (user5)        res |= GYOTO_QUANTITY_USER5;
+
+  return res;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git



More information about the Debian-astro-commits mailing list