Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
#include <iostream.h>
#include <classlib\arrays.h>
#include <cstring.h>
#include <string.h>
#include <stdlib.h>
// gdsii.h
// Defines types of data and structures in GDS-format
typedef unsigned char byte; // use this type for 8-bit bytes
typedef short int s_int2; // use this type for signed 2-byte int
typedef long int s_int4; // use this type for signed 4-byte int
//
class Record;
typedef const char* (Record::*PointToFunc) ();
// GDS-format record
class Record {
byte* Current;
static char* RecNames[]; // Contains records name
static PointToFunc ProcNames[]; // Contains functions name
//
const char* Header();
const char* BgnLib();
const char* LibName();
const char* Units();
const char* EndLib();
const char* BgnStr();
const char* StrName();
const char* EndStr();
const char* Boundary();
const char* Path();
const char* SRef();
const char* ARef();
const char* Text();
const char* Layer();
const char* DatType();
const char* Width();
const char* XY();
const char* EndEl();
const char* SName();
const char* ColRow();
const char* TextNode();
const char* Node();
const char* TextType();
const char* Presentation();
const char* Spacing();
const char* String();
const char* Strans();
const char* Mag();
const char* Angle();
const char* UInteger();
const char* UString();
const char* RefLibs();
const char* Fonts();
const char* PathType();
const char* Generations();
const char* AttrTable();
const char* STypeTable();
const char* StrType();
const char* ElFlags();
const char* ElKey();
const char* LinkType();
const char* LinkKeys();
const char* NodeType();
const char* PropAttr();
const char* PropValue();
const char* Box();
const char* BoxType();
const char* Plex();
const char* BgnExtn();
const char* EndExtn();
const char* TapeNum();
const char* TapeCode();
const char* StrClass();
const char* Reserved();
const char* Format();
const char* Mask();
const char* EndMasks();
const char* LibDirSize();
const char* SRfName();
const char* LibSecur();
//
public:
// Header
s_int2 Length; // total length of record including header
byte RecType; // information of record type
byte DataType; // information of data in record
// Data
byte* Data; // data contain in record
//
char* RecordName();
friend istream& operator>>(istream& is, Record& rec);
friend ostream& operator<<(ostream& is, Record& rec);
};
//
struct RecordsList {
Record* Rec;
RecordsList* NextRec;
};
// GDS-file class
class GDSFile {
//
string FileName; // GDS file name
RecordsList* List; // Header pointer to list of records;
RecordsList* Current; // Pointer to current record
//
public:
int TotalRecs; // Total number of records in GDS-file
GDSFile()
: FileName(""), TotalRecs(0),List(0) {}
GDSFile(const char far* file)
: FileName(file), TotalRecs(0),List(0) {}
~GDSFile();
void SetName(const char far* fName);
void Open(); // Open GDS-file
void Reset() { Current = List; } // Set current to home of list
Record& Take(); // return current record;
void NextRecord(); // move current pointer to next record
bool IsTale(); // return true if current record is last
char* RecordName(); // return current record name
};
// ------------------------------------------
// inline - functions
// ------------------------------------------
inline void GDSFile::SetName(const char far* fName)
{
FileName = fName;
}
//
inline Record& GDSFile::Take()
{
return *(Current->Rec);
}
//
inline bool GDSFile::IsTale()
{
return !(Current->NextRec);
}
//
inline void GDSFile::NextRecord()
{
if (!IsTale())
Current = Current->NextRec;
}
//
inline char* GDSFile::RecordName()
{
return Current->Rec->RecordName();
}
//
inline char* Record::RecordName()
{
return RecNames[RecType];
}
// end
Соседние файлы в папке GDSII