CLabel.h
//-----------------------------------------------------------------------------
// $Header: /tmp_mnt/asis/offline/ceres/cool/project/RCS/CLabel.h,v 2.1 1996/10/04 08:42:56 voigt Exp $
//
// COOL Program Library
// Copyright (C) CERES collaboration, 1996
//
// Declaration of class CLabel.
//
//-----------------------------------------------------------------------------
#ifndef CLABEL_H
#define CLABEL_H
#include <iostream.h>
#include "cool.h"
class Cifstream;
class Cofstream;
const unsigned long MagicWord = 0xaaaaaaaa;
class CLabel {
public:
CLabel();
CLabel(const CLabel&);
CLabel& operator= (const CLabel&);
~CLabel();
int operator== (const CLabel&) const;
public:
void read (Cifstream&); // read label from input stream
void write(Cofstream&); // write label to output stream
void dump(ostream& = cout, int = -1); // write hex dump to output stream
void list(ostream& = cout); // print one line description
void swap(); // swap short words within raw data and toggle state
// if label contains ascii data, revert on little-endian architectures
void revertAsciiData();
public:
inline int getId() const {return id;}
inline int getLength() const {return length;}
inline const CString& getName() const {return name;}
inline const CWord* getData() const {return data;}
inline CBoolean isSwapped() const {return swapped;}
inline int getSize() const {return size;}
private:
int id; // label identifier
CString name; // ascii name
int length; // label length as noted in label header
int size; // actual size of data (long words)
CWord *data; // raw data
private:
CBoolean swapped; // true if DATA of label is swapped (16/16 bit swap)
CBoolean asciiReverted; // true if DATA of label has been reverted to big-endian
};
#endif /* CLABEL_H */