STIR 6.4.0
ByteOrder.inl
Go to the documentation of this file.
1//
2//
15/*
16 Copyright (C) 2000 PARAPET partners
17 Copyright (C) 2000- 2009, Hammersmith Imanet Ltd
18 This file is part of STIR.
19
20 SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
21
22 See STIR/LICENSE.txt for details
23*/
24
25START_NAMESPACE_STIR
26
28 : byte_order(byte_order)
29{}
30
34{
35 return native_order;
36}
37
38inline bool
40{
41 return byte_order == native || byte_order == get_native_order();
42}
43
45bool
47{
48 // Simple comparison (byte_order == order2.byte_order)
49 // does not work because of 4 possible values of the enum.
50 return (is_native_order() && order2.is_native_order()) || (!is_native_order() && !order2.is_native_order());
51}
52
53bool
54ByteOrder::operator!=(const ByteOrder order2) const
55{
56 return !(*this == order2);
57}
58
59END_NAMESPACE_STIR
This class provides member functions to find out what byte-order your machine is and to swap numbers.
Definition ByteOrder.h:100
bool is_native_order() const
check if the object refers to the native order.
Definition ByteOrder.inl:39
Order
enum for specifying the byte-order
Definition ByteOrder.h:104
@ native
Definition ByteOrder.h:107
bool operator==(const ByteOrder order2) const
comparison operator
Definition ByteOrder.inl:46
static Order get_native_order()
returns the byte-order native to the machine the programme is running on.
Definition ByteOrder.inl:33
ByteOrder(Order byte_order=native)
constructor, defaulting to 'native' byte order
Definition ByteOrder.inl:27