[parchive2-cvs] library/src/slice file_slice.cc,1.23,1.24 file_slice.h,1.7,1.8 slice.cc,1.17,1.18 sl
Status: Pre-Alpha
Brought to you by:
coppit
|
From: <co...@us...> - 2003-05-07 01:39:56
|
Update of /cvsroot/parchive2/library/src/slice
In directory sc8-pr-cvs1:/tmp/cvs-serv1971/src/slice
Modified Files:
file_slice.cc file_slice.h slice.cc slice.h
Log Message:
- Added == and != operator to File_Slice and Slice
- Fixed file module test case
- Got rid of dynamically allocated objects in testing where they aren't needed
- Changed all cerr's to cout's
- Changed "PASSED" to "PASS" in reed solomon test case
Index: file_slice.cc
===================================================================
RCS file: /cvsroot/parchive2/library/src/slice/file_slice.cc,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** file_slice.cc 7 May 2003 01:12:28 -0000 1.23
--- file_slice.cc 7 May 2003 01:39:22 -0000 1.24
***************
*** 128,131 ****
--- 128,143 ----
}
+ const bool File_Slice::operator==(const File_Slice& other) const
+ {
+ return (autoflush == other.autoflush) && (gotbytes == other.gotbytes) &&
+ (dirty == other.dirty) && (file == other.file) &&
+ (offset == other.offset) && (*((Slice*)this) == *((Slice*)(&other)));
+ }
+
+ const bool File_Slice::operator!=(const File_Slice& other) const
+ {
+ return !(*this == other);
+ }
+
ostream& operator<< (ostream& in_ostream, const File_Slice& in_fs)
{
Index: file_slice.h
===================================================================
RCS file: /cvsroot/parchive2/library/src/slice/file_slice.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** file_slice.h 7 May 2003 01:12:28 -0000 1.7
--- file_slice.h 7 May 2003 01:39:22 -0000 1.8
***************
*** 27,30 ****
--- 27,33 ----
bool isDirty() const;
+ const bool operator==(const File_Slice& other) const;
+ const bool operator!=(const File_Slice& other) const;
+
friend ostream& operator<< (ostream& in_ostream, const File_Slice& in_fs);
Index: slice.cc
===================================================================
RCS file: /cvsroot/parchive2/library/src/slice/slice.cc,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** slice.cc 7 May 2003 01:12:28 -0000 1.17
--- slice.cc 7 May 2003 01:39:22 -0000 1.18
***************
*** 14,20 ****
{
size = in_slice.size;
- empty = in_slice.empty;
slice_bytes = new char[size]; // should initialize to 0 automagically
Set_Slice_Bytes(in_slice.Get_Slice_Bytes());
}//Slice()
--- 14,20 ----
{
size = in_slice.size;
slice_bytes = new char[size]; // should initialize to 0 automagically
Set_Slice_Bytes(in_slice.Get_Slice_Bytes());
+ empty = in_slice.empty;
}//Slice()
***************
*** 37,40 ****
--- 37,41 ----
{
if (size != other.size) return false;
+ if (empty != other.empty) return false;
unsigned int i = 0;
for (; i < size; i++) {
***************
*** 44,47 ****
--- 45,53 ----
return true;
+ }
+
+ const bool Slice::operator!=(const Slice& other) const
+ {
+ return !(*this == other);
}
Index: slice.h
===================================================================
RCS file: /cvsroot/parchive2/library/src/slice/slice.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** slice.h 7 May 2003 01:12:28 -0000 1.17
--- slice.h 7 May 2003 01:39:22 -0000 1.18
***************
*** 19,22 ****
--- 19,23 ----
const bool operator==(const Slice&) const;
+ const bool operator!=(const Slice&) const;
void read(istream &in);
|