Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 37 additions & 39 deletions sio/include/SIO_record.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// ----------------------------------------------------------------------------
// CVS $Id: SIO_record.h,v 1.2 2004-12-23 13:24:07 gaede Exp $
// ----------------------------------------------------------------------------
// => Controller for an SIO record.
// => Controller for an SIO record.
// ----------------------------------------------------------------------------
//
// General Description:
//
// Each SIO_record controls one record type.
// Each SIO_record controls one record type.
//
// ----------------------------------------------------------------------------

Expand All @@ -21,52 +21,50 @@
class SIO_stream;
class SIO_block;

typedef std::map< std::string, SIO_block* > connectMap_c;
typedef std::map< std::string, SIO_block* >::iterator connectMap_i;
typedef std::map<std::string, SIO_block*> connectMap_c;
typedef std::map<std::string, SIO_block*>::iterator connectMap_i;

#define SIO_OPT_COMPRESS 0x00000001
#define SIO_OPT_COMPRESS 0x00000001

// ----------------------------------------------------------------------------
// Class SIO_record.
// ----------------------------------------------------------------------------
class SIO_record
{
public:
unsigned int connect( const char* );
unsigned int connect( SIO_block* );
unsigned int disconnect( const char* );
unsigned int disconnect( SIO_block* );
class SIO_record {
public:
unsigned int connect(const char*);
unsigned int connect(SIO_block*);
unsigned int disconnect(const char*);
unsigned int disconnect(SIO_block*);

//fg20041222 -- added for multiple write streams
unsigned int disconnectAll() ;
// fg20041222 -- added for multiple write streams
unsigned int disconnectAll();

SIO_block* getConnect(const char*);
bool getCompress();
std::string* getName();
bool getUnpack();
SIO_verbosity getVerbosity();
bool setCompress(bool);
bool setUnpack(bool);
SIO_verbosity setVerbosity(SIO_verbosity);

SIO_block* getConnect( const char* );
bool getCompress();
std::string* getName();
bool getUnpack();
SIO_verbosity getVerbosity();
bool setCompress( bool );
bool setUnpack( bool );
SIO_verbosity setVerbosity( SIO_verbosity );
private:
SIO_record(const char*, SIO_verbosity);
~SIO_record() = default;

private:
SIO_record( const char*, SIO_verbosity );
~SIO_record();
unsigned int connect(std::string*, SIO_block*);
unsigned int disconnect(std::string*, SIO_block*);
unsigned int getOptions();
unsigned int read(SIO_stream*, unsigned int);
unsigned int write(SIO_stream*);

unsigned int connect( std::string*, SIO_block* );
unsigned int disconnect( std::string*, SIO_block* );
unsigned int getOptions();
unsigned int read( SIO_stream*, unsigned int );
unsigned int write( SIO_stream* );
connectMap_c connectMap{}; // Map of connected blocks
std::string name; // Record name
unsigned int options{0}; // Options (flag word)
bool unpack{false}; // Unpack incoming records?
SIO_verbosity verbosity{}; // Reporting level

connectMap_c connectMap; // Map of connected blocks
std::string name; // Record name
unsigned int options; // Options (flag word)
bool unpack; // Unpack incoming records?
SIO_verbosity verbosity; // Reporting level

friend class SIO_recordManager; // Access to constructor/destructor
friend class SIO_stream; // Access to read/write/getOptions
};
friend class SIO_recordManager; // Access to constructor/destructor
friend class SIO_stream; // Access to read/write/getOptions
};
#endif
50 changes: 29 additions & 21 deletions sio/include/SIO_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <map>
#include <string>

#include "zlib.h"

#include <stdio.h>

#include "SIO_definitions.h"
Expand Down Expand Up @@ -101,36 +103,42 @@ class SIO_stream
private:
SIO_stream( const char *, unsigned int, SIO_verbosity );
~SIO_stream();

/// Disable the copy constructor
SIO_stream(const SIO_stream&) = delete;

/// Disable the assingment operator
SIO_stream& operator=(const SIO_stream&) = delete;

unsigned int write( SIO_record*, const char* );

unsigned char* bufloc; // Buffer pointer (beginning)
unsigned char* buffer; // Buffer pointer (current)
unsigned char* bufmax; // Buffer pointer (end)
unsigned char* recmax; // Record pointer (end)
unsigned char* blkmax; // Block pointer (end)
unsigned char* bufloc{nullptr}; // Buffer pointer (beginning)
unsigned char* buffer{nullptr}; // Buffer pointer (current)
unsigned char* bufmax{nullptr}; // Buffer pointer (end)
unsigned char* recmax{nullptr}; // Record pointer (end)
unsigned char* blkmax{nullptr}; // Block pointer (end)

unsigned char* cmploc; // Compression buffer pointer (beg)
unsigned char* cmpmax; // Compression buffer pointer (end)
struct z_stream_s* z_strm; // Compression buffer control
unsigned char* cmploc{nullptr}; // Compression buffer pointer (beg)
unsigned char* cmpmax{nullptr}; // Compression buffer pointer (end)
struct z_stream_s* z_strm{nullptr}; // Compression buffer control

std::string name; // Stream's name
std::string filename; // Stream's associated file
FILE* handle; // File handle
std::string name{""}; // Stream's name
std::string filename{""}; // Stream's associated file
FILE* handle{nullptr}; // File handle

std::string rec_name; // Record name being read
std::string blk_name; // Block name being read
std::string rec_name{""}; // Record name being read
std::string blk_name{""}; // Block name being read

pointedAtMap_c* pointedAt; // Map of 'pointed at'
pointerToMap_c* pointerTo; // Multimap of 'pointer to'
pointedAtMap_c* pointedAt{nullptr}; // Map of 'pointed at'
pointerToMap_c* pointerTo{nullptr}; // Multimap of 'pointer to'

SIO_stream_mode mode; // Stream mode
unsigned int reserve; // Reserved size of buffer
SIO_stream_state state; // Stream state
SIO_verbosity verbosity; // Reporting level
SIO_stream_mode mode{SIO_MODE_UNDEFINED}; // Stream mode
unsigned int reserve{0}; // Reserved size of buffer
SIO_stream_state state{SIO_STATE_CLOSED}; // Stream state
SIO_verbosity verbosity{}; // Reporting level

SIO_64BITINT recPos ; // start Position of last record read
int compLevel ; // compression level
SIO_64BITINT recPos{0} ; // start Position of last record read
int compLevel{Z_DEFAULT_COMPRESSION} ; // compression level

friend class SIO_streamManager; // Access to constructor/destructor
friend class SIO_record; // Access to buffer
Expand Down
Loading