99 * See the License for the specific language governing permissions and
1010 * limitations under the License. See accompanying LICENSE file.
1111 */
12-
1312#ifndef _BINIO_H_
1413#define _BINIO_H_
15-
14+ #include < iostream>
15+ #include < vector>
1616#include < type_traits>
17- #include " FHE.h"
17+ #include < NTL/xdouble.h>
18+ #include < NTL/vec_long.h>
1819
1920#define BINIO_32BIT 4
2021#define BINIO_48BIT 6
4546
4647/* Some utility functions for binary IO */
4748
48- int readEyeCatcher (istream& str, const char * expect);
49- void writeEyeCatcher (ostream& str, const char * eye);
49+ int readEyeCatcher (std:: istream& str, const char * expect);
50+ void writeEyeCatcher (std:: ostream& str, const char * eye);
5051
51- void write_ntl_vec_long (ostream& str, const vec_long& vl, long intSize=BINIO_64BIT);
52- void read_ntl_vec_long (istream& str, vec_long& vl);
52+ void write_ntl_vec_long (std:: ostream& str, const NTL:: vec_long& vl, long intSize=BINIO_64BIT);
53+ void read_ntl_vec_long (std:: istream& str, NTL:: vec_long& vl);
5354
54- long read_raw_int (istream& str, long intSize=BINIO_64BIT);
55- void write_raw_int (ostream& str, long num, long intSize=BINIO_64BIT);
55+ long read_raw_int (std:: istream& str, long intSize=BINIO_64BIT);
56+ void write_raw_int (std:: ostream& str, long num, long intSize=BINIO_64BIT);
5657
57- void write_raw_xdouble (ostream& str, const xdouble xd);
58- xdouble read_raw_xdouble (istream& str);
58+ void write_raw_xdouble (std:: ostream& str, const NTL:: xdouble xd);
59+ NTL:: xdouble read_raw_xdouble (std:: istream& str);
5960
60- void write_raw_ZZ (ostream& str, const ZZ& zz);
61- void read_raw_ZZ (istream& str, ZZ& zz);
61+ void write_raw_ZZ (std:: ostream& str, const NTL:: ZZ& zz);
62+ void read_raw_ZZ (std:: istream& str, NTL:: ZZ& zz);
6263
63- template <typename T> void write_raw_vector (ostream& str, const vector<T>& v)
64+ template <typename T> void write_raw_vector (std:: ostream& str, const std:: vector<T>& v)
6465{
6566 long sz = v.size ();
6667 write_raw_int (str, v.size ());
@@ -70,9 +71,9 @@ template<typename T> void write_raw_vector(ostream& str, const vector<T>& v)
7071 }
7172};
7273// vector<long> has adifferent implementation, since long.write does not work
73- template <> void write_raw_vector<long >(ostream& str, const vector<long >& v);
74+ template <> void write_raw_vector<long >(std:: ostream& str, const std:: vector<long >& v);
7475
75- template <typename T> void read_raw_vector (istream& str, vector<T>& v, T& init)
76+ template <typename T> void read_raw_vector (std:: istream& str, std:: vector<T>& v, T& init)
7677{
7778 long sz = read_raw_int (str);
7879 v.resize (sz, init); // Make space in vector
@@ -82,15 +83,16 @@ template<typename T> void read_raw_vector(istream& str, vector<T>& v, T& init)
8283 }
8384};
8485
85- template <typename T> void read_raw_vector (istream& str, vector<T>& v)
86+ template <typename T> void read_raw_vector (std:: istream& str, std:: vector<T>& v)
8687{
8788 read_raw_vector<T>(str, v, T ());
8889}
8990// vector<long> has adifferent implementation, since long.read does not work
90- template <> void read_raw_vector<long >(istream& str, vector<long >& v);
91+ template <> void read_raw_vector<long >(std:: istream& str, std:: vector<long >& v);
9192
9293// KeySwitch::read(...) (in FHE.cpp) requires the context.
93- template <typename T> void read_raw_vector (istream& str, vector<T>& v, const FHEcontext& context)
94+ class FHEcontext ;
95+ template <typename T> void read_raw_vector (std::istream& str, std::vector<T>& v, const FHEcontext& context)
9496{
9597 long sz = read_raw_int (str);
9698 v.resize (sz); // Make space in vector
0 commit comments