Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GdsParser::GdsWriter Class Reference

#include <GdsWriter.h>

Public Member Functions

 GdsWriter (const char *filename)
 constructor More...
 
 ~GdsWriter ()
 destructor
 
char * gds_adjust_string (const char *input, int *output_length)
 
high level interfaces
void write_boundary (int layer, int datatype, std::vector< int > const &vx, std::vector< int > const &vy, bool has_last=true)
 write a boundary object More...
 
void write_box (int layer, int datatype, int xl, int yl, int xh, int yh)
 write a box object More...
 
void create_lib (const char *libname, double dbu_uu, double dbu_m)
 create GDSII library More...
 
low level interfaces
void gds_make_next_item (struct gds_itemtype **ci)
 
void gds_bindump (BYTE x)
 
void gds_write_float (double x)
 
void gds_swap4bytes (BYTE *four)
 swap bytes More...
 
void gds_swap2bytes (BYTE *two)
 swap bytes More...
 
void gds_write_header ()
 write HEADER
 
void gds_write_bgnlib ()
 write BGNLIB
 
void gds_write_bgnstr ()
 write BGNSTR
 
void gds_write_endlib ()
 write ENDLIB
 
void gds_write_endstr ()
 write ENDSTR
 
void gds_write_libname (const char *name)
 write LIBNAME More...
 
void gds_write_strname (const char *name)
 write STRNAME More...
 
void gds_write_string (const char *s)
 write STRING More...
 
void gds_write_sname (const char *s)
 write SNAME More...
 
void gds_write_boundary ()
 write BOUNDARY
 
void gds_write_box ()
 write BOX
 
void gds_write_boxtype (short int dt)
 write BOXTYPE More...
 
void gds_write_path ()
 write PATH
 
void gds_write_sref ()
 write SREF
 
void gds_write_aref ()
 write AREF
 
void gds_write_text ()
 write TEXT
 
void gds_write_endel ()
 write ENDEL
 
void gds_write_layer (short int layer)
 write LAYER More...
 
void gds_write_width (int width)
 write WIDTH More...
 
void gds_write_datatype (short int dt)
 write DATATYPE More...
 
void gds_write_texttype (short int dt)
 write TEXTTYPE More...
 
void gds_write_generations (short int gens)
 write GENERATIONS More...
 
void gds_write_pathtype (short int pt)
 write PATHTYPE More...
 
void gds_write_presentation (int font, int vp, int hp)
 write PRESENTATION More...
 
void gds_write_strans (BOOL reflect, BOOL abs_angle, BOOL abs_mag)
 write STRANS More...
 
void gds_write_xy (const int *x, const int *y, int n, bool has_last=true)
 write XY More...
 
void gds_write_colrow (int ncols, int nrows)
 write COLROW More...
 
void gds_write_units (double dbu_uu, double dbu_m)
 write UNITS More...
 
void gds_write_mag (double mag)
 write MAG More...
 
void gds_write_angle (double angle)
 write ANGLE More...
 
void gds_create_lib (const char *libname, double dbu_um)
 create library with name and unit More...
 
void gds_create_text (const char *str, int x, int y, int layer, int size)
 wrapper to create text More...
 

Protected Member Functions

int gds_write (const char *b, std::size_t n)
 
void gds_flush ()
 flush all contents in the buffer
 

Protected Attributes

GdsStream * m_os
 output stream
 
BYTE gdsswap
 moved from global variables
 
short gdsword
 move from global variables
 
std::size_t m_capacity
 output buffer capacity
 
std::size_t m_size
 output buffer size
 
char * m_buffer
 output buffer
 

Detailed Description

write GDSII

Definition at line 90 of file GdsWriter.h.

Constructor & Destructor Documentation

GdsParser::GdsWriter::GdsWriter ( const char *  filename)

constructor

Parameters
filenameoutput file name

Member Function Documentation

void GdsParser::GdsWriter::create_lib ( const char *  libname,
double  dbu_uu,
double  dbu_m 
)

create GDSII library

Parameters
libnamename of the library
dbu_uuis user unit, 1nm per bit
dbu_mis database unit in meter, usually 1e-9 this wrapper is different from gds_create_lib in terms of units
char* GdsParser::GdsWriter::gds_adjust_string ( const char *  input,
int *  output_length 
)

handle string with odd length; generate new string output and return its length

Parameters
inputa string
output_lengthresult length
Returns
a new string
void GdsParser::GdsWriter::gds_create_lib ( const char *  libname,
double  dbu_um 
)

create library with name and unit

Parameters
libnamename of library
dbu_umdatabase unit in microns, usually 1e-6
void GdsParser::GdsWriter::gds_create_text ( const char *  str,
int  x,
int  y,
int  layer,
int  size 
)

wrapper to create text

Parameters
strtext
xx position
yy position
layerlayer
sizetext size
void GdsParser::GdsWriter::gds_swap2bytes ( BYTE two)

swap bytes

Parameters
two2-byte of data
void GdsParser::GdsWriter::gds_swap4bytes ( BYTE four)

swap bytes

Parameters
four4-byte of data
int GdsParser::GdsWriter::gds_write ( const char *  b,
std::size_t  n 
)
protected

a buffered putting scheme to speedup writing

Returns
negative value if error by Yibo Lin
void GdsParser::GdsWriter::gds_write_angle ( double  angle)

write ANGLE

Parameters
angleangle in degree
void GdsParser::GdsWriter::gds_write_boxtype ( short int  dt)

write BOXTYPE

Parameters
dtdata type
void GdsParser::GdsWriter::gds_write_colrow ( int  ncols,
int  nrows 
)

write COLROW

Parameters
ncolsnumber of columns
nrowsnumber of rows
void GdsParser::GdsWriter::gds_write_datatype ( short int  dt)

write DATATYPE

Parameters
dtdata type
void GdsParser::GdsWriter::gds_write_generations ( short int  gens)

write GENERATIONS

Parameters
gensgenerations
void GdsParser::GdsWriter::gds_write_layer ( short int  layer)

write LAYER

Parameters
layerlayer
void GdsParser::GdsWriter::gds_write_libname ( const char *  name)

write LIBNAME

Parameters
namename of library
void GdsParser::GdsWriter::gds_write_mag ( double  mag)

write MAG

Parameters
magmagnification
void GdsParser::GdsWriter::gds_write_pathtype ( short int  pt)

write PATHTYPE

Parameters
ptpath type
void GdsParser::GdsWriter::gds_write_presentation ( int  font,
int  vp,
int  hp 
)

write PRESENTATION

Parameters
fontfont number 0, 1, 2, 3
vpvertical presentation 0 = top 1 = middle 2 = bottom
hphorizontal presentation 0 = left 1 = center 2 = right
void GdsParser::GdsWriter::gds_write_sname ( const char *  s)

write SNAME

Parameters
sstring
void GdsParser::GdsWriter::gds_write_strans ( BOOL  reflect,
BOOL  abs_angle,
BOOL  abs_mag 
)

write STRANS

Parameters
reflectreflect about X axis before rotation (normally false)
abs_angleangles are absolute (normally false)
abs_magmagnification (scale) is absolute (normally false)
void GdsParser::GdsWriter::gds_write_string ( const char *  s)

write STRING

Parameters
sstring
void GdsParser::GdsWriter::gds_write_strname ( const char *  name)

write STRNAME

Parameters
namename
void GdsParser::GdsWriter::gds_write_texttype ( short int  dt)

write TEXTTYPE

Parameters
dttext type
void GdsParser::GdsWriter::gds_write_units ( double  dbu_uu,
double  dbu_m 
)

write UNITS

Parameters
dbu_uudatabase unit in user units, usually 0.001
dbu_mdatabase unit in meters, usually 1e-9
void GdsParser::GdsWriter::gds_write_width ( int  width)

write WIDTH

Parameters
widthwidth
void GdsParser::GdsWriter::gds_write_xy ( const int *  x,
const int *  y,
int  n,
bool  has_last = true 
)

write XY

Parameters
xarray of x coordinates
yarray of y coordinates
nlength of array
has_lastif true, it means the last point is the same as the first point; otherwise, we need to add one point to the end. Default value is true.
void GdsParser::GdsWriter::write_boundary ( int  layer,
int  datatype,
std::vector< int > const &  vx,
std::vector< int > const &  vy,
bool  has_last = true 
)

write a boundary object

Parameters
layerlayer
datatypedata type
vxarray of x coordinates
vyarray of y coordinates
has_lastif true, it means the last point is the same as the first point; otherwise, we need to add one point to the end. Default value is true
void GdsParser::GdsWriter::write_box ( int  layer,
int  datatype,
int  xl,
int  yl,
int  xh,
int  yh 
)

write a box object

Parameters
layerlayer
datatypedata type
xl,yl,xh,yhcoordinates of the box

The documentation for this class was generated from the following file: