\hypertarget{a00407_source}{}\doxysection{AAX\+\_\+\+Endian\+Swap.\+h}
\label{a00407_source}\index{AAX\_EndianSwap.h@{AAX\_EndianSwap.h}}
\mbox{\hyperlink{a00407}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ Copyright\ 2013-\/2015,\ 2023\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ CONFIDENTIAL:\ this\ document\ contains\ confidential\ information\ of\ Avid.\ Do}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ not\ disclose\ to\ any\ third\ party.\ Use\ of\ the\ information\ contained\ in\ this}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ document\ is\ subject\ to\ an\ Avid\ SDK\ license.}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00019\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#ifndef\ ENDIANSWAP\_H}}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ ENDIANSWAP\_H}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{comment}{//\ Standard\ headers}}
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#include\ <algorithm>}}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(T*\ theDataP);}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00034\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ T\ \mbox{\hyperlink{a00407_a5caa5e68dec3f028697b64ad04f0cb5c}{AAX\_EndianSwap}}(T\ theData);}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00038\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_a2aa4dc892c77aa0ed29e84a5f29c9538}{AAX\_BigEndianNativeSwapInPlace}}(T*\ theDataP);}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00041\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ T\ \mbox{\hyperlink{a00407_a7387790d73eed6c54af682c7afd9e463}{AAX\_BigEndianNativeSwap}}(T\ theData);}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00044\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_af4164bdfb3807edcd582e0289a6ed59a}{AAX\_LittleEndianNativeSwapInPlace}}(T*\ theDataP);}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00047\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ T\ \mbox{\hyperlink{a00407_a49f57c502ff278b26260b1744da99633}{AAX\_LittleEndianNativeSwap}}(T\ theData);}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00052\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI);}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00056\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_ae9e72785a26249cd3e3c05baf8c9ce70}{AAX\_BigEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI);}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00059\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_a4d8bcdfb048c8124f1f2886537e65678}{AAX\_LittleEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI);}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \textcolor{comment}{//}}
\DoxyCodeLine{00063\ \textcolor{comment}{//\ Implementations}}
\DoxyCodeLine{00064\ \textcolor{comment}{//}}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>}
\DoxyCodeLine{00067\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00068\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00069\ \mbox{\hyperlink{a00407_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(T*\ theDataP)}
\DoxyCodeLine{00070\ \{}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keywordtype}{char}\ *begin,\ *end;}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \ \ \ \ begin\ =\ \textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(theDataP);}
\DoxyCodeLine{00074\ \ \ \ \ end\ =\ begin\ +\ \textcolor{keyword}{sizeof}(\ T\ );}
\DoxyCodeLine{00075\ \ \ \ \ std::reverse(\ begin,\ end\ );}
\DoxyCodeLine{00076\ \}}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>}
\DoxyCodeLine{00080\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00081\ T\ \mbox{\hyperlink{a00407_a5caa5e68dec3f028697b64ad04f0cb5c}{AAX\_EndianSwap}}(T\ theData)}
\DoxyCodeLine{00082\ \{}
\DoxyCodeLine{00083\ \ \ \ \ \mbox{\hyperlink{a00407_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(\&theData);}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordflow}{return}\ theData;}
\DoxyCodeLine{00085\ \}}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>}
\DoxyCodeLine{00089\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00090\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_a2aa4dc892c77aa0ed29e84a5f29c9538}{AAX\_BigEndianNativeSwapInPlace}}(T*\ theDataP)}
\DoxyCodeLine{00091\ \{}
\DoxyCodeLine{00092\ \textcolor{preprocessor}{\#if\ (!defined\ \_\_BIG\_ENDIAN\_\_)\ ||\ (0\ ==\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00093\ \ \ \ \ \mbox{\hyperlink{a00407_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(theDataP);}
\DoxyCodeLine{00094\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00095\ \}}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ }
\DoxyCodeLine{00099\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00100\ T\ \mbox{\hyperlink{a00407_a7387790d73eed6c54af682c7afd9e463}{AAX\_BigEndianNativeSwap}}(T\ theData)}
\DoxyCodeLine{00101\ \{}
\DoxyCodeLine{00102\ \ \ \ \ \mbox{\hyperlink{a00407_a2aa4dc892c77aa0ed29e84a5f29c9538}{AAX\_BigEndianNativeSwapInPlace}}(\&theData);}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordflow}{return}\ theData;}
\DoxyCodeLine{00104\ \}}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ }
\DoxyCodeLine{00108\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00109\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_af4164bdfb3807edcd582e0289a6ed59a}{AAX\_LittleEndianNativeSwapInPlace}}(T*\ theDataP)}
\DoxyCodeLine{00110\ \{}
\DoxyCodeLine{00111\ \textcolor{preprocessor}{\#if\ (defined\ \_\_BIG\_ENDIAN\_\_)\ \&\&\ (0\ !=\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00112\ \ \ \ \ \mbox{\hyperlink{a00407_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(theDataP);}
\DoxyCodeLine{00113\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00114\ \}}
\DoxyCodeLine{00115\ }
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00117\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ }
\DoxyCodeLine{00118\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00119\ T\ \mbox{\hyperlink{a00407_a49f57c502ff278b26260b1744da99633}{AAX\_LittleEndianNativeSwap}}(T\ theData)}
\DoxyCodeLine{00120\ \{}
\DoxyCodeLine{00121\ \ \ \ \ \mbox{\hyperlink{a00407_af4164bdfb3807edcd582e0289a6ed59a}{AAX\_LittleEndianNativeSwapInPlace}}(\&theData);}
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordflow}{return}\ theData;}
\DoxyCodeLine{00123\ \}}
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00126\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ }
\DoxyCodeLine{00127\ \textcolor{keyword}{inline}}
\DoxyCodeLine{00128\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI)}
\DoxyCodeLine{00129\ \{}
\DoxyCodeLine{00130\ \ \ \ \ \textcolor{keywordflow}{for}(Iter\ i\ =\ beginI;\ i\ !=\ endI;\ ++i)}
\DoxyCodeLine{00131\ \ \ \ \ \{}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ WARNING\ :\ Will\ this\ give\ a\ compile\ error\ if\ a\ use\ mistakenly\ uses\ it\ on\ a\ const\ sequence?}}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a00407_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(\&(*i));}
\DoxyCodeLine{00134\ \ \ \ \ \};}
\DoxyCodeLine{00135\ \}}
\DoxyCodeLine{00136\ }
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00138\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ }
\DoxyCodeLine{00139\ \textcolor{keyword}{inline}}
\DoxyCodeLine{00140\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_ae9e72785a26249cd3e3c05baf8c9ce70}{AAX\_BigEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI)}
\DoxyCodeLine{00141\ \{}
\DoxyCodeLine{00142\ \textcolor{preprocessor}{\#if\ (!defined\ \_\_BIG\_ENDIAN\_\_)\ ||\ (0\ ==\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00143\ \ \ \ \ \mbox{\hyperlink{a00407_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(beginI,\ endI);}
\DoxyCodeLine{00144\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00145\ \}}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ }
\DoxyCodeLine{00149\ \textcolor{keyword}{inline}}
\DoxyCodeLine{00150\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00407_a4d8bcdfb048c8124f1f2886537e65678}{AAX\_LittleEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI)}
\DoxyCodeLine{00151\ \{}
\DoxyCodeLine{00152\ \textcolor{preprocessor}{\#if\ (defined\ \_\_BIG\_ENDIAN\_\_)\ \&\&\ (0\ !=\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00153\ \ \ \ \ \mbox{\hyperlink{a00407_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(beginI,\ endI);}
\DoxyCodeLine{00154\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00155\ \}}
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
