
#ifndef __WFX_UTIL_ENDIANCONVERT_H__
#define __WFX_UTIL_ENDIANCONVERT_H__

#include <WFX/WFXIncludes.h>

namespace WFX {

    namespace util {

        /** 
         * abstract endian converter - does nothing
         * should be used when no endianness conversion is needed
         */
        class EndianConvert {
            public:
                virtual inline Int swap(Int i) {
                    return i;
                }
                virtual inline UInt swap(UInt i) {
                    return i;
                }
                virtual inline Long swap(Long i) {
                    return i;
                }
                virtual inline ULong swap(ULong i) {
                    return i;
                }
                virtual inline Short swap(Short i) {
                    return i;
                }
                virtual inline UShort swap(UShort i) {
                    return i;
                }
                virtual inline Real swap(Real r) {
                    return r;
                }
            protected:
            private:
        };

        /** actually converts endianess of parameters */
        class SwapEndian : public EndianConvert {
            public:
                virtual Int swap(Int i);
                virtual UInt swap(UInt i);
                virtual Long swap(Long i);
                virtual ULong swap(ULong i);
                virtual Short swap(Short i);
                virtual UShort swap(UShort i);
                virtual Real swap(Real r);
            protected:
            private:
        };

    }

}

#endif //include guard


