first commit

This commit is contained in:
2026-03-05 13:16:26 +01:00
commit 1b2bf174e8
164 changed files with 35594 additions and 0 deletions

184
Lab6/pstream.cpp Normal file
View File

@@ -0,0 +1,184 @@
//## begin module.cm preserve=no
// %X% %Q% %Z% %W%
//## end module.cm
//## begin module.cp preserve=no
//## end module.cp
//## Module: PStream; Pseudo Package body
//## Subsystem: Figures
//## Source file: PStream.cpp
//## begin module.additionalIncludes preserve=no
//## end module.additionalIncludes
//## begin module.includes preserve=yes
//## end module.includes
// PStream
#include "PStream.h"
//## begin module.additionalDeclarations preserve=yes
#include "prsstent.h"
//## end module.additionalDeclarations
// Class PStream
PStream::PStream()
//## begin PStream::PStream%.hasinit preserve=no
: saving(false)
//## end PStream::PStream%.hasinit
//## begin PStream::PStream%.initialization preserve=yes
//## end PStream::PStream%.initialization
{
//## begin PStream::PStream%.body preserve=yes
for(int i=0 ; i<RESTORE_SIZE ; i++)
restore[i] = NULL;
//## end PStream::PStream%.body
}
PStream::~PStream()
{
//## begin PStream::~PStream%.body preserve=yes
//## end PStream::~PStream%.body
}
//## Other Operations (implementation)
void PStream::load (char* filename)
{
//## begin PStream::load%940866982.body preserve=yes
open(filename, ios::in);
saving=false;
//## end PStream::load%940866982.body
}
void PStream::save (char* filename)
{
//## begin PStream::save%940866983.body preserve=yes
open(filename, ios::out|ios::trunc);
saving=true;
//## end PStream::save%940866983.body
}
void PStream::close ()
{
//## begin PStream::close%940866984.body preserve=yes
if(isSaving()) {
(*this) << 0;
fstream::close();
}
saving=false;
//## end PStream::close%940866984.body
}
bool PStream::isSaving ()
{
//## begin PStream::isSaving%940866985.body preserve=yes
return saving;
//## end PStream::isSaving%940866985.body
}
void PStream::archive (Persistent*& x)
{
//## begin PStream::archive%940866986.body preserve=yes
// Let's save some data...