143 lines
3.5 KiB
C++
143 lines
3.5 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: PStream; Pseudo Package specification
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Source file: PStream.h
|
|
|
|
|
|
|
|
#ifndef PStream_h
|
|
|
|
#define PStream_h 1
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
#include "str.h"
|
|
|
|
#include <fstream.h>
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// PsMap
|
|
|
|
#include "PsMap.h"
|
|
|
|
// Persistent
|
|
|
|
#include "Prsstent.h"
|
|
|
|
// fstream
|
|
|
|
//#include "fstream.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
#define RESTORE_SIZE 100
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
//## Class: PStream
|
|
|
|
//## Category: Persist
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Persistence: Transient
|
|
|
|
//## Cardinality/Multiplicity: n
|
|
|
|
|
|
|
|
//## Uses: <unnamed>; Persistent { -> }
|
|
|
|
|
|
|
|
class PStream : public fstream //## Inherits: <unnamed>
|
|
|
|
{
|
|
|
|
//## begin PStream.initialDeclarations preserve=yes
|
|
|
|
//## end PStream.initialDeclarations
|
|
|
|
|
|
|
|
public:
|
|
|
|
//## Constructors (generated)
|
|
|
|
PStream();
|
|
|
|
|
|
|
|
//## Destructor (generated)
|
|
|
|
~PStream();
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (specified)
|
|
|
|
//## Operation: load%940866982
|
|
|
|
void load (char* filename);
|
|
|
|
|
|
|
|
//## Operation: save%940866983
|
|
|
|
void save (char* filename);
|
|
|
|
|
|
|
|
//## Operation: close%940866984
|
|
|
|
void close ();
|
|
|
|
|
|
|
|
//## Operation: isSaving%940866985
|
|
|
|
bool isSaving ();
|
|
|
|
|
|
|
|
//## Operation: archive%940866986
|
|
|
|
void archive (Persistent*& x);
|
|
|
|
|
|
|
|
//## Operation: find%940866987
|
|
|
|
Persistent* find (int x) const;
|
|
|
|
|
|
|
|
//## Operation: add%940866988
|
|
|
|
void add (int pos, Persistent* data);
|
|
|
|
|
|
|
|
//## Operation: find%940866989
|
|
|
|
int find (const Persistent* p) const;
|
|
|
|
|
|
|
|
//## Operation: add%940866990
|
|
|
|
int add (const Persistent* data);
|
|
|
|
|
|
|
|
// Additional Public Declarations
|
|
|
|
//## begin PStream.public preserve=yes
|
|
|
|
//## end PStream.public
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Additional Protected Declarations
|
|
|
|
//## begin PStream.protected preserve=yes
|
|
|
|
//## end PStream.protected
|
|
|
|
|
|
|
|
private:
|
|
|
|
//## Get and Set Operations for Has Relationships (generated)
|
|
|
|
|
|
|
|
//## Documentation PStream::psMap.has
|
|
|
|
|
|
|
|
//## Get and Set Operations for Class Attributes (generated)
|
|
|
|
|
|
|
|
//## Attribute: fs
|
|
|
|
|
|
|
|
//## Attribute: saving
|
|
|
|
|
|
|
|
// Additional Private Declarations
|
|
|
|
//## begin PStream.private preserve=yes
|
|
|
|
//## end PStream.private
|
|
|
|
|
|
|
|
private: //## implementation
|
|
|
|
// Data Members for Has Relationships
|
|
|
|
|
|
|
|
//## begin PStream::psMap.has preserve=no private: PsMap {1 -> 1VO}
|
|
|
|
PsMap psMap;
|
|
|
|
//## end PStream::psMap.has
|
|
|
|
|
|
|
|
// Data Members for Class Attributes
|
|
|
|
|
|
|
|
//## begin PStream::fs.attr preserve=no private: fstream {U}
|
|
|
|
//## end PStream::fs.attr
|
|
|
|
|
|
|
|
//## begin PStream::saving.attr preserve=no private: bool {U} false
|
|
|
|
bool saving;
|
|
|
|
//## end PStream::saving.attr
|
|
|
|
|
|
|
|
// Additional Implementation Declarations
|
|
|
|
//## begin PStream.implementation preserve=yes
|
|
|
|
Persistent* restore[RESTORE_SIZE];
|
|
|
|
//## end PStream.implementation
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//## begin PStream.postscript preserve=yes
|
|
|
|
//## end PStream.postscript
|
|
|
|
|
|
|
|
// Class PStream
|
|
|
|
|
|
|
|
//## Get and Set Operations for Has Relationships (inline)
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|