Mercurial > hg > octave-nkf
comparison src/ov-streamoff.h @ 4646:eff8f977508c
[project @ 2003-11-23 18:13:19 by jwe]
author | jwe |
---|---|
date | Sun, 23 Nov 2003 18:13:19 +0000 |
parents | bd2067547b40 |
children | 62f2fb593455 |
comparison
equal
deleted
inserted
replaced
4645:bd2067547b40 | 4646:eff8f977508c |
---|---|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) | 26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
27 #pragma interface | 27 #pragma interface |
28 #endif | 28 #endif |
29 | 29 |
30 #include <iostream> | 30 #include <iostream> |
31 #include <string> | |
32 | 31 |
33 #include "mx-base.h" | 32 #include "so-array.h" |
34 #include "mx-op-defs.h" | |
35 #include "oct-alloc.h" | 33 #include "oct-alloc.h" |
36 #include "str-vec.h" | |
37 | 34 |
38 #include "error.h" | 35 #include "ov.h" |
39 #include "oct-obj.h" | |
40 #include "ov-base-mat.h" | 36 #include "ov-base-mat.h" |
41 #include "ov-typeinfo.h" | 37 #include "ov-typeinfo.h" |
42 | 38 |
43 class tree_walker; | 39 class tree_walker; |
44 | 40 |
45 // Stream offsets. | 41 // Stream offsets. |
46 | |
47 class streamoff_array : public ArrayN<std::streamoff> | |
48 { | |
49 public: | |
50 | |
51 streamoff_array (void) : ArrayN<std::streamoff> () { } | |
52 | |
53 streamoff_array (const dim_vector& dv, | |
54 const std::streamoff& val = resize_fill_value ()) | |
55 : ArrayN<std::streamoff> (dv, val) { } | |
56 | |
57 streamoff_array (const ArrayN<std::streamoff>& sa) | |
58 : ArrayN<std::streamoff> (sa) { } | |
59 | |
60 streamoff_array (const streamoff_array& sa) | |
61 : ArrayN<std::streamoff> (sa) { } | |
62 | |
63 ~streamoff_array (void) { } | |
64 | |
65 streamoff_array& operator = (const streamoff_array& a) | |
66 { | |
67 if (this != &a) | |
68 ArrayN<std::streamoff>::operator = (a); | |
69 | |
70 return *this; | |
71 } | |
72 | |
73 streamoff_array squeeze (void) const | |
74 { return ArrayN<std::streamoff>::squeeze (); } | |
75 | |
76 boolNDArray all (int dim = -1) const; | |
77 boolNDArray any (int dim = -1) const; | |
78 | |
79 // streamoff_array& operator += (const streamoff_array& a); | |
80 // streamoff_array& operator -= (const streamoff_array& a); | |
81 | |
82 static int compute_index (Array<int>& ra_idx, | |
83 const dim_vector& dimensions); | |
84 | |
85 static std::streamoff resize_fill_value (void) { return 0; } | |
86 }; | |
87 | |
88 NDCMP_OP_DECL (mx_el_eq, std::streamoff, streamoff_array); | |
89 NDCMP_OP_DECL (mx_el_ne, std::streamoff, streamoff_array); | |
90 | |
91 NDCMP_OP_DECL (mx_el_eq, streamoff_array, std::streamoff); | |
92 NDCMP_OP_DECL (mx_el_ne, streamoff_array, std::streamoff); | |
93 | |
94 NDCMP_OP_DECL (mx_el_eq, streamoff_array, streamoff_array); | |
95 NDCMP_OP_DECL (mx_el_ne, streamoff_array, streamoff_array); | |
96 | |
97 BIN_OP_DECL (streamoff_array, operator +, streamoff_array, streamoff_array); | |
98 BIN_OP_DECL (streamoff_array, operator -, streamoff_array, streamoff_array); | |
99 | |
100 BIN_OP_DECL (streamoff_array, operator +, streamoff_array, std::streamoff); | |
101 BIN_OP_DECL (streamoff_array, operator -, streamoff_array, std::streamoff); | |
102 | |
103 BIN_OP_DECL (streamoff_array, operator +, std::streamoff, streamoff_array); | |
104 BIN_OP_DECL (streamoff_array, operator -, std::streamoff, streamoff_array); | |
105 | 42 |
106 class | 43 class |
107 octave_streamoff : public octave_base_matrix<streamoff_array> | 44 octave_streamoff : public octave_base_matrix<streamoff_array> |
108 { | 45 { |
109 public: | 46 public: |
132 | 69 |
133 std::streamoff streamoff_value (void) const; | 70 std::streamoff streamoff_value (void) const; |
134 | 71 |
135 streamoff_array streamoff_array_value (void) const { return matrix; } | 72 streamoff_array streamoff_array_value (void) const { return matrix; } |
136 | 73 |
137 // void increment (void) { matrix += 1; } | 74 void increment (void) { matrix += std::streamoff (1); } |
138 | 75 |
139 // void decrement (void) { matrix -= 1; } | 76 void decrement (void) { matrix -= std::streamoff (1); } |
140 | 77 |
141 bool print_as_scalar (void) const { return true; } | 78 bool print_as_scalar (void) const { return true; } |
142 | 79 |
143 void print (std::ostream& os, bool pr_as_read_syntax = false) const; | 80 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
144 | 81 |