forked from BoostGSoC19/astronomy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fits external interface(reading) (BoostGSoC19#153)
- Loading branch information
1 parent
8caea42
commit 7c6487e
Showing
34 changed files
with
6,144 additions
and
1,902 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/*============================================================================= | ||
Copyright 2018 Pranam Lashkari <[email protected]> | ||
Copyright 2020 Gopi Krishna Menon <[email protected]> | ||
Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
@@ -8,11 +9,8 @@ file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) | |
#ifndef BOOST_ASTRONOMY_IO_BITPIX_HPP | ||
#define BOOST_ASTRONOMY_IO_BITPIX_HPP | ||
|
||
/** | ||
* @file bitpix.hpp | ||
* @author Pranam Lashkari | ||
* @details Contains the enum declaration for representing bitpix values in header | ||
*/ | ||
#include<boost/cstdint.hpp> | ||
#include<boost/cstdfloat.hpp> | ||
|
||
namespace boost { namespace astronomy { namespace io { | ||
|
||
|
@@ -29,6 +27,68 @@ enum class bitpix | |
_B64 //! 64-bit IEEE double precision floating point | ||
}; | ||
|
||
/** | ||
* @brief Returns the element's size on the basis of its bitpix type | ||
* @param[in] bitpix_value The bitpix value associated with the element | ||
*/ | ||
int get_element_size_from_bitpix(bitpix bitpix_value) { | ||
switch (bitpix_value) | ||
{ | ||
case boost::astronomy::io::bitpix::B8: | ||
return 1; | ||
break; | ||
case boost::astronomy::io::bitpix::B16: | ||
return 2; | ||
break; | ||
case boost::astronomy::io::bitpix::B32: | ||
return 4; | ||
break; | ||
case boost::astronomy::io::bitpix::_B32: | ||
return 4; | ||
break; | ||
case boost::astronomy::io::bitpix::_B64: | ||
return 8; | ||
break; | ||
default: | ||
return 0; | ||
} | ||
} | ||
|
||
/** | ||
* @brief Converts bitpix enum value to its underlying type | ||
* @tparam type bitpix enum value | ||
*/ | ||
|
||
template<bitpix type> | ||
struct bitpix_type; | ||
|
||
template<> | ||
struct bitpix_type<bitpix::B8> { | ||
typedef typename boost::int8_t underlying_type; | ||
}; | ||
|
||
template<> | ||
struct bitpix_type<bitpix::B16> { | ||
typedef typename boost::int16_t underlying_type; | ||
}; | ||
template<> | ||
struct bitpix_type<bitpix::B32> { | ||
typedef typename boost::int32_t underlying_type; | ||
}; | ||
template<> | ||
struct bitpix_type<bitpix::_B32> { | ||
typedef typename boost::float32_t underlying_type; | ||
}; | ||
template<> | ||
struct bitpix_type<bitpix::_B64> { | ||
typedef typename boost::float64_t underlying_type; | ||
}; | ||
|
||
|
||
|
||
|
||
|
||
|
||
}}} //namespace boost::astronomy::io | ||
|
||
#endif // !BOOST_ASTRONOMY_IO_BITPIX_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.