a2dIOHandlerGDSIn Class Reference
[File IOGDSII format File IO]

Input driver for GDSII files. More...

#include <gdsio.h>

Inheritance diagram for a2dIOHandlerGDSIn:

Inheritance graph
[legend]
Collaboration diagram for a2dIOHandlerGDSIn:

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool LinkReferences ()
 link references to their destination
virtual bool CanLoad (a2dDocumentInputStream &stream, const wxObject *obj=NULL, wxClassInfo *docClassInfo=NULL)
 Should return true if the handler can read from the stream.
virtual bool Load (a2dDocumentInputStream &stream, wxObject *doc)
 override to read the stream and store (part of) the contents in to a specific a2dDocument or othere object.
virtual void InitializeLoad ()
 Inits the handler for reading.
virtual void ResetLoad ()
 Reset the handler after loading.
void SetFontType (a2dFontType fontType)

Protected Member Functions

void SetDataTypeProperty (a2dCanvasObject *toobject, wxUint16 type)
unsigned int ReadUnsignedInt ()
int ReadInt ()
long ReadLong ()
float ReadFloat ()
double ReadDouble ()
void gds2double (unsigned char fb[])
 convert a gdsii real to a machine real
void ReadGdsII ()
bool ReadBgnlib ()
bool ReadProperty ()
bool ReadBoundary (a2dCanvasObject *parent)
bool ReadPath (a2dCanvasObject *parent)
bool ReadText (a2dCanvasObject *parent)
bool ReadStructureReference (a2dCanvasObject *parent)
bool ReadArrayReference (a2dCanvasObject *parent)
bool ReadNode (a2dCanvasObject *parent)
bool ReadBox (a2dCanvasObject *parent)
bool ReadElflags (a2dCanvasObject *object)
bool ReadGdsHeader ()
bool ReadLayer (a2dCanvasObject *object)
bool ReadLayer (int &layer)
bool ReadLibraryName ()
bool ReadLibrarySettings ()
bool Read (a2dPoint2D &_Point)
bool ReadStrans (Strans &_Strans)
bool ReadStructure (a2dCanvasObject *parent)
bool ReadElement (a2dCanvasObject *parent)
bool ReadTextBody ()
bool Read (a2dVertexList *segments)
bool Read (a2dPolygonL *polygon)
bool ReadHeader (int type)
void SkipData ()
 skip the date of the last read record
void ReadString (wxString &a_string)
 read string data for Text element, structure names etc.

Protected Attributes

bool m_back
 last read record is stored
TWO_G_BYTE_UNSIGNED_INTEGER m_recordsize
 size of the last read record
G_BYTE m_recordtype
 recordtype of last read record
G_BYTE m_datatype
 the type of the data in the last read record
int m_mapping [wxMAXLAYER]
 mapping of GDSII layers to internal layers
a2dCanvasDocumentm_doc
 the document to store/load the data found into
double m_userunits_out
int m_objectFlags
a2dFontType m_fontType
wxString m_strucname
 structure that is being read at the moment


Detailed Description

Input driver for GDSII files.

Every record in the GDSII file is read/mapped into the right internal structure The GDSII file is parsed according to the BNF of the GDSII format. Info on the different record types that are read can be found in the GDSII format manual All basic data types are read using a specialized function that now how those types are stored in GDSII. For layers settings this handler checks for a file with the same name as the document that is loaded, but with extension ".cvg", if it does exist it will be used to read layers (in CVG format).

Definition at line 334 of file gdsio.h.


Member Function Documentation

bool a2dIOHandlerGDSIn::LinkReferences (  )  [virtual]

link references to their destination

Override this to define input format specific needs for linking references in a certain format. In the default situation the parser uses m_objecthashmap to store object to which references can be made, while m_lastObjectId is used to store unresolved references. Here those to are resolved.

In the CVG format one can store multiple refrences to one and the same object. The object that is referenced is only written once, for the other references only the object with refid or specific id attributes are written to the CVG file. When loading a file in CVG, such references are resolved and removed from the document. So in the end the old reference is restored. When loading an object, it is created, but its contents will be empty, after resolving, this one will be replaced by the real referenced object. The reason behind all this, is that the actual object might need to be read yet, when a reference is encountered in the CVG file, and therefore the link can not be directly created. In other formats references are used in a simular manner, and to resolve them the same mechanism is used.

Some input/ouput formats are organized in a list of grouped objects, the hierarchy is created after the whole file is read into memory. All non referenced objects are direct childs of the rootobject. In the GDSII format these are called top structures.

Returns:
true if all references were resolved.

Reimplemented from a2dIOHandler.

Definition at line 924 of file gdsio.cpp.

bool a2dIOHandlerGDSIn::CanLoad ( a2dDocumentInputStream stream,
const wxObject *  obj = NULL,
wxClassInfo *  docClassInfo = NULL 
) [virtual]

Should return true if the handler can read from the stream.

A typical implementation is to read the first part of the file, to see if the contents is right for this handler. Then it resets the file pointer to the beginning again.

In general a handler is written with a certain type of document in mind, since that is where the information will be stored. The document view framework, uses document templates to get to input handlers. The last 2 parameters can be checked if set. Use SetDocumentClassInfo() to set the right classinfo, in case of a derived document object, which still can be read with the this handler. Like:

        a2dIOHandlerKeyIn* keyhin = new a2dIOHandlerKeyIn();
        keyhin->SetDocumentClassInfo( &MyDocument::ms_classInfo );

Parameters:
stream the open stream which its header can be tested
obj to check and load the data into, needs to be casted to the right one internal.
docClassInfo to check if the inout handler is indeed able to read document of m_docClassInfo.

Implements a2dIOHandlerStrIn.

Definition at line 897 of file gdsio.cpp.

bool a2dIOHandlerGDSIn::Load ( a2dDocumentInputStream stream,
wxObject *  obj 
) [virtual]

override to read the stream and store (part of) the contents in to a specific a2dDocument or othere object.

Understand that a a2dDocument itself is useless for storing data, so it needs to be casted internal.

Parameters:
stream the open stream to load from
obj to load the data into, needs to be casted to the right one internal.

Implements a2dIOHandlerStrIn.

Definition at line 944 of file gdsio.cpp.

void a2dIOHandlerGDSIn::gds2double ( unsigned char  fb[]  )  [protected]

convert a gdsii real to a machine real

convert a gds double to a machine double input arguments : unsigned char fb[] 8byte array with gds double output arguments : unsigned char fb[] 8byte array with machine double

Definition at line 286 of file gdsio.cpp.

bool a2dIOHandlerGDSIn::ReadHeader ( int  type  )  [protected]

read the specified record type from the GDSII file if the last record is not this type, it is stored for the next read

Definition at line 1114 of file gdsio.cpp.


The documentation for this class was generated from the following files:
a2dIOHandlerGDSIn Class Reference -- Tue Aug 31 18:28:53 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation