1 | |
---|
2 | /**************************************************************************\ |
---|
3 | |
---|
4 | MODULE: GF2XVec |
---|
5 | |
---|
6 | SUMMARY: |
---|
7 | |
---|
8 | The class GF2XVec implements vectors of fixed-length GF2X's. You can |
---|
9 | allocate a vector of GF2X's of a specified length, where the maximum |
---|
10 | size of each GF2X is also specified. These parameters can be specified |
---|
11 | either with a constructor, or with SetSize. It is an error to |
---|
12 | try to re-size a vector of non-xero , or store a GF2X that doesn't fit. |
---|
13 | The space can be released with "kill", and then you are free to call SetSize |
---|
14 | again. If you want more flexible---but less efficient---vectors, use |
---|
15 | vec_GF2X. |
---|
16 | |
---|
17 | \**************************************************************************/ |
---|
18 | |
---|
19 | #include <NTL/GF2X.h> |
---|
20 | |
---|
21 | |
---|
22 | class GF2XVec { |
---|
23 | public: |
---|
24 | GF2XVec(); |
---|
25 | |
---|
26 | GF2XVec& operator=(const GF2XVec&); |
---|
27 | // first kill()'s destination (unless source and destination are |
---|
28 | // identical) |
---|
29 | |
---|
30 | GF2XVec(const GF2XVec&); |
---|
31 | ~GF2XVec(); |
---|
32 | |
---|
33 | GF2XVec(long n, long d); |
---|
34 | // sets length to n and max size of each element to d, |
---|
35 | // where the size d measures the number of words |
---|
36 | |
---|
37 | void SetSize(long n, long d); |
---|
38 | // sets length to n and max size of each element to d, |
---|
39 | // where the size d measures the number of words |
---|
40 | |
---|
41 | long length() const; |
---|
42 | // length of vector |
---|
43 | |
---|
44 | long BaseSize() const; |
---|
45 | // max size of each element |
---|
46 | |
---|
47 | void kill(); |
---|
48 | // release space |
---|
49 | |
---|
50 | |
---|
51 | GF2X* elts(); |
---|
52 | const GF2X* elts() const; |
---|
53 | // pointer to first element |
---|
54 | |
---|
55 | GF2X& operator[](long i); |
---|
56 | const GF2X& operator[](long i) const; |
---|
57 | // indexing operator; starts at 0; no range checking |
---|
58 | }; |
---|
59 | |
---|
60 | |
---|
61 | void swap(GF2XVec& x, GF2XVec& y); |
---|
62 | // swaps x and y by swapping pointers |
---|
63 | |
---|