Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| projects:endian_template [2016/02/23] – [Running the unit tests] terence | projects:endian_template [2016/02/26] (current) – [Q & A] terence | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| * **Author:** [[mailto: | * **Author:** [[mailto: | ||
| * **License: | * **License: | ||
| - | * **Last Update:** 2016-02-23 | + | * **Last Update:** 2016-02-26 |
| * **Donate:** [[: | * **Donate:** [[: | ||
| Line 16: | Line 16: | ||
| After downloading, | After downloading, | ||
| - | * Latest version: [[https:// | + | * Latest version: [[https:// |
| ===== About ===== | ===== About ===== | ||
| Line 33: | Line 33: | ||
| ==== Setup ==== | ==== Setup ==== | ||
| - | * First, copy the header into your project. | + | * First, copy the header |
| * Next, include the header somewhere in your project or [[wp> | * Next, include the header somewhere in your project or [[wp> | ||
| - | * You will also need to include '' | ||
| | | ||
| <code c++> | <code c++> | ||
| - | #include < | ||
| - | #include < | ||
| #include " | #include " | ||
| </ | </ | ||
| Line 47: | Line 44: | ||
| You'll now have the following typedefs to use in your project: | You'll now have the following typedefs to use in your project: | ||
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| The naming conventions are based on those in C++ standard library header [[http:// | The naming conventions are based on those in C++ standard library header [[http:// | ||
| Line 69: | Line 66: | ||
| <code c++> | <code c++> | ||
| - | typedef tBigEndian< | + | typedef tBigEndian< |
| typedef tBigEndian< | typedef tBigEndian< | ||
| typedef tLittleEndian< | typedef tLittleEndian< | ||
| Line 78: | Line 75: | ||
| ==== Usage ==== | ==== Usage ==== | ||
| - | When using the endian types, you can literally just drop them in to replace your current types (ensuring | + | When using the endian types, you can literally just drop them in to replace your current types, as long as you also remove any endian swapping functions you're calling. |
| There are three primary reasons I see someone using the Endian Template: | There are three primary reasons I see someone using the Endian Template: | ||
| Line 102: | Line 99: | ||
| If you read this data into an '' | If you read this data into an '' | ||
| - | So take the guesswork out of the equation-- read it into an '' | + | So take the guesswork out of the equation-- read it into an '' |
| === Sending data over a network === | === Sending data over a network === | ||
| Line 108: | Line 105: | ||
| If you're familiar with [[http:// | If you're familiar with [[http:// | ||
| - | Since " | + | Since " |
| And regardless of the endian of computer' | And regardless of the endian of computer' | ||
| Line 132: | Line 129: | ||
| //If you have a question not answered here, please feel free to [[mailto: | //If you have a question not answered here, please feel free to [[mailto: | ||
| - | //No questions so far!// | + | === vs Boost? === |
| + | * **Q:** What makes this better or different than [[http:// | ||
| + | * **A:** I can't say for certain if it's better. The Endian Template is small, and only provides a minimum of what's needed to handle automatic endian conversion. | ||
| + | |||
| + | As I understand it Boost.Endian provides three different mechanisms for handling endian (one providing swapping functions), whereas my primary philosophy here is " | ||
| + | |||
| + | Just for trivia: I originally created this class in 2001 as a proof-of-concept, | ||
| + | This predates when Boost.Endian came out, which was around 2002 or 2003. | ||
| + | |||
| + | That said, I've used boost (in general) before on a day-to-day basis for a client project. I'm not a boost " | ||
| ===== History ===== | ===== History ===== | ||
| + | **February 26, 2016** | ||
| + | |||
| + | * Renamed typedefs without '' | ||
| + | * Added required includes directly into '' | ||
| + | * Changed endian testing method to use reinterpret_cast, | ||
| + | * Removed ::PassThru method as a small optimization | ||
| **February 23, 2016** | **February 23, 2016** | ||
| Line 141: | Line 153: | ||
| * First public release | * First public release | ||
| * Created project page | * Created project page | ||
| - | |||