| [277] | 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
|  | 2 | // Fonctions d'ecriture de tableaux numeriques | 
|---|
|  | 3 | #ifndef PIOCMPLX_H_SEEN | 
|---|
|  | 4 | #define PIOCMPLX_H_SEEN | 
|---|
|  | 5 |  | 
|---|
|  | 6 | /* | 
|---|
|  | 7 | // Pour gerer les Persist I/O de tableaux numerique templates | 
|---|
|  | 8 | template <class T> | 
|---|
|  | 9 | void PIOSReadArray(PInPersist & is, T* arr, size_t n); | 
|---|
|  | 10 | template <class T> | 
|---|
|  | 11 | void PIOSWriteArray(POutPersist & os, T const * arr, size_t n); | 
|---|
|  | 12 | */ | 
|---|
|  | 13 |  | 
|---|
|  | 14 | // Pour pouvoir ecrire des tableau de complex, en attendant | 
|---|
|  | 15 | // PIn/POutPersist::Get/Put(complex<>) | 
|---|
|  | 16 |  | 
|---|
|  | 17 | inline | 
|---|
|  | 18 | void PIOSReadArray(PInPersist & is, uint_1 * arr, size_t n) | 
|---|
|  | 19 | { | 
|---|
|  | 20 | is.GetBytes(arr, n); | 
|---|
|  | 21 | } | 
|---|
|  | 22 |  | 
|---|
|  | 23 | inline | 
|---|
|  | 24 | void PIOSReadArray(PInPersist & is, uint_2 * arr, size_t n) | 
|---|
|  | 25 | { | 
|---|
|  | 26 | is.Get(arr, n); | 
|---|
|  | 27 | } | 
|---|
|  | 28 |  | 
|---|
|  | 29 | inline | 
|---|
|  | 30 | void PIOSReadArray(PInPersist & is, int_2 * arr, size_t n) | 
|---|
|  | 31 | { | 
|---|
|  | 32 | is.Get(arr, n); | 
|---|
|  | 33 | } | 
|---|
|  | 34 |  | 
|---|
|  | 35 | inline | 
|---|
|  | 36 | void PIOSReadArray(PInPersist & is, uint_4 * arr, size_t n) | 
|---|
|  | 37 | { | 
|---|
|  | 38 | is.Get(arr, n); | 
|---|
|  | 39 | } | 
|---|
|  | 40 |  | 
|---|
|  | 41 | inline | 
|---|
|  | 42 | void PIOSReadArray(PInPersist & is, int_4 * arr, size_t n) | 
|---|
|  | 43 | { | 
|---|
|  | 44 | is.Get(arr, n); | 
|---|
|  | 45 | } | 
|---|
|  | 46 |  | 
|---|
|  | 47 | inline | 
|---|
|  | 48 | void PIOSReadArray(PInPersist & is, uint_8 * arr, size_t n) | 
|---|
|  | 49 | { | 
|---|
|  | 50 | is.Get(arr, n); | 
|---|
|  | 51 | } | 
|---|
|  | 52 |  | 
|---|
|  | 53 | inline | 
|---|
|  | 54 | void PIOSReadArray(PInPersist & is, int_8 * arr, size_t n) | 
|---|
|  | 55 | { | 
|---|
|  | 56 | is.Get(arr, n); | 
|---|
|  | 57 | } | 
|---|
|  | 58 |  | 
|---|
|  | 59 | inline | 
|---|
|  | 60 | void PIOSReadArray(PInPersist & is, r_4 * arr, size_t n) | 
|---|
|  | 61 | { | 
|---|
|  | 62 | is.Get(arr, n); | 
|---|
|  | 63 | } | 
|---|
|  | 64 |  | 
|---|
|  | 65 | inline | 
|---|
|  | 66 | void PIOSReadArray(PInPersist & is, r_8 * arr, size_t n) | 
|---|
|  | 67 | { | 
|---|
|  | 68 | is.Get(arr, n); | 
|---|
|  | 69 | } | 
|---|
|  | 70 |  | 
|---|
|  | 71 | inline | 
|---|
|  | 72 | void PIOSReadArray(PInPersist & is, complex<float> * arr, size_t n) | 
|---|
|  | 73 | { | 
|---|
|  | 74 | r_4 * pr = (r_4 *)arr; | 
|---|
|  | 75 | is.Get(pr, n*2); | 
|---|
|  | 76 | } | 
|---|
|  | 77 |  | 
|---|
|  | 78 | inline | 
|---|
|  | 79 | void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n) | 
|---|
|  | 80 | { | 
|---|
|  | 81 | r_8 * pr = (r_8 *)arr; | 
|---|
|  | 82 | is.Get(pr, n*2); | 
|---|
|  | 83 | } | 
|---|
|  | 84 |  | 
|---|
|  | 85 | // Fonctions d ecriture de tableaux de nombre | 
|---|
|  | 86 | inline | 
|---|
|  | 87 | void PIOSWriteArray(POutPersist & os, uint_1 const * arr, size_t n) | 
|---|
|  | 88 | { | 
|---|
|  | 89 | os.PutBytes(arr, n); | 
|---|
|  | 90 | } | 
|---|
|  | 91 |  | 
|---|
|  | 92 | inline | 
|---|
|  | 93 | void PIOSWriteArray(POutPersist & os, uint_2 const * arr, size_t n) | 
|---|
|  | 94 | { | 
|---|
|  | 95 | os.Put(arr, n); | 
|---|
|  | 96 | } | 
|---|
|  | 97 |  | 
|---|
|  | 98 | inline | 
|---|
|  | 99 | void PIOSWriteArray(POutPersist & os, int_2 const * arr, size_t n) | 
|---|
|  | 100 | { | 
|---|
|  | 101 | os.Put(arr, n); | 
|---|
|  | 102 | } | 
|---|
|  | 103 |  | 
|---|
|  | 104 | inline | 
|---|
|  | 105 | void PIOSWriteArray(POutPersist & os, uint_4 const * arr, size_t n) | 
|---|
|  | 106 | { | 
|---|
|  | 107 | os.Put(arr, n); | 
|---|
|  | 108 | } | 
|---|
|  | 109 |  | 
|---|
|  | 110 | inline | 
|---|
|  | 111 | void PIOSWriteArray(POutPersist & os, int_4 const * arr, size_t n) | 
|---|
|  | 112 | { | 
|---|
|  | 113 | os.Put(arr, n); | 
|---|
|  | 114 | } | 
|---|
|  | 115 |  | 
|---|
|  | 116 | inline | 
|---|
|  | 117 | void PIOSWriteArray(POutPersist & os, uint_8 const * arr, size_t n) | 
|---|
|  | 118 | { | 
|---|
|  | 119 | os.Put(arr, n); | 
|---|
|  | 120 | } | 
|---|
|  | 121 |  | 
|---|
|  | 122 | inline | 
|---|
|  | 123 | void PIOSWriteArray(POutPersist & os, int_8 const * arr, size_t n) | 
|---|
|  | 124 | { | 
|---|
|  | 125 | os.Put(arr, n); | 
|---|
|  | 126 | } | 
|---|
|  | 127 |  | 
|---|
|  | 128 | inline | 
|---|
|  | 129 | void PIOSWriteArray(POutPersist & os, r_4 const * arr, size_t n) | 
|---|
|  | 130 | { | 
|---|
|  | 131 | os.Put(arr, n); | 
|---|
|  | 132 | } | 
|---|
|  | 133 |  | 
|---|
|  | 134 | inline | 
|---|
|  | 135 | void PIOSWriteArray(POutPersist & os, r_8 const * arr, size_t n) | 
|---|
|  | 136 | { | 
|---|
|  | 137 | os.Put(arr, n); | 
|---|
|  | 138 | } | 
|---|
|  | 139 |  | 
|---|
|  | 140 | inline | 
|---|
|  | 141 | void PIOSWriteArray(POutPersist & os, complex<float> const * arr, size_t n) | 
|---|
|  | 142 | { | 
|---|
|  | 143 | r_4 const * pr = (r_4 const *)arr; | 
|---|
|  | 144 | os.Put(pr, n*2); | 
|---|
|  | 145 | } | 
|---|
|  | 146 |  | 
|---|
|  | 147 | inline | 
|---|
|  | 148 | void PIOSWriteArray(POutPersist & os, complex<double> const * arr, size_t n) | 
|---|
|  | 149 | { | 
|---|
|  | 150 | r_8 const * pr = (r_8 const *)arr; | 
|---|
|  | 151 | os.Put(pr, n*2); | 
|---|
|  | 152 | } | 
|---|
|  | 153 |  | 
|---|
|  | 154 | #endif | 
|---|