Coin Logo http://www.coin3d.org/
http://www.kongsberg.com/kogt/

Public Member Functions | Friends | List of all members
dimeInput Class Reference

The dimeInput class offers transparent file I/O for DXF and DXB. More...

#include <dime/Input.h>

Public Member Functions

 dimeInput ()
 
 ~dimeInput ()
 
bool setFileHandle (FILE *fp)
 
bool setFile (const char *const filename)
 
bool setFilePointer (const int fd)
 
bool eof () const
 
void setCallback (int(*cb)(float, void *), void *cbdata)
 
float relativePosition ()
 
void putBackGroupCode (const int32 code)
 
bool readGroupCode (int32 &code)
 
bool readInt8 (int8 &val)
 
bool readInt16 (int16 &val)
 
bool readInt32 (int32 &val)
 
bool readFloat (float &val)
 
bool readDouble (dxfdouble &val)
 
const char * readString ()
 
const char * readStringNoSkip ()
 
class dimeModel * getModel ()
 
class dimeMemHandler * getMemHandler ()
 
int getFilePosition () const
 
bool isBinary () const
 
int getVersion () const
 
bool isAborted () const
 

Friends

class dimeModel
 

Detailed Description

The dimeInput class offers transparent file I/O for DXF and DXB.

Constructor & Destructor Documentation

◆ dimeInput()

dimeInput::dimeInput ( )

Constructor.

◆ ~dimeInput()

dimeInput::~dimeInput ( )

Destructor.

Member Function Documentation

◆ eof()

bool dimeInput::eof ( ) const

Returns true if end of file is encountered.

◆ getFilePosition()

int dimeInput::getFilePosition ( ) const

For ASCII files, it returns the current line number. For binary files the file position is returned.

Referenced by dimeModel::read().

◆ getMemHandler()

dimeMemHandler * dimeInput::getMemHandler ( )

◆ getModel()

dimeModel * dimeInput::getModel ( )

Returns the model for this file.

Referenced by dimeLayerTable::read(), dimeInsert::read(), dimeBlock::read(), and dimeEntity::read().

◆ getVersion()

int dimeInput::getVersion ( ) const

Returns the version of this file (10, 12, 13 or 14).

◆ isAborted()

bool dimeInput::isAborted ( ) const

This method returns wether file input was aborted or not.

◆ isBinary()

bool dimeInput::isBinary ( ) const

Returns true if this is a binary (DXB) file.

◆ putBackGroupCode()

void dimeInput::putBackGroupCode ( const int32  code)

This function is needed when a loader snoops for future group codes. It is possible to put back a single group code so that the next time dimeInput::readGroupCode() is called, the putback value will be returned.

Referenced by dimeRecordHolder::read().

◆ readDouble()

bool dimeInput::readDouble ( dxfdouble &  val)

Reads a dxfdouble precision floating point number from the file.

Referenced by dimeDoubleRecord::read(), readFloat(), and dimeRecord::readRecordData().

◆ readFloat()

bool dimeInput::readFloat ( float &  val)

Reads a single precision floating point number from the file.

References readDouble().

Referenced by dimeFloatRecord::read(), and dimeRecord::readRecordData().

◆ readGroupCode()

bool dimeInput::readGroupCode ( int32 &  code)

Reads a group code from the file. In binary files, group codes are represented as a single byte, with the exception of extended data which has 255 as the first byte, and then the actual group code following as a 16-bit integer.

References readInt16(), readInt32(), readString(), and relativePosition().

Referenced by dimeBlocksSection::read(), dimeTablesSection::read(), dimeTable::read(), dimeModel::read(), dimeRecordHolder::read(), dimePolyline::read(), dimeEntity::readEntities(), and dimeRecord::readRecord().

◆ readInt16()

bool dimeInput::readInt16 ( int16 &  val)

Reads a 16 bit integer from the file.

Referenced by dimeTable::read(), dimeInt16Record::read(), readGroupCode(), and dimeRecord::readRecordData().

◆ readInt32()

bool dimeInput::readInt32 ( int32 &  val)

Reads a 32 bit integer from the file.

Referenced by dimeInt32Record::read(), readGroupCode(), and dimeRecord::readRecordData().

◆ readInt8()

bool dimeInput::readInt8 ( int8 &  val)

Reads an 8 bit integer from the file.

Referenced by dimeInt8Record::read(), and dimeRecord::readRecordData().

◆ readString()

const char * dimeInput::readString ( )

Returns a null-terminated string read from the file. The string is valid only until the next read operation, so you'd better copy it somewhere if you need it.

References dimeModel::registerHandle().

Referenced by dimeBlocksSection::read(), dimeTablesSection::read(), dimeTable::read(), dimeStringRecord::read(), dimeModel::read(), dimePolyline::read(), dimeEntity::readEntities(), readGroupCode(), and dimeRecord::readRecordData().

◆ readStringNoSkip()

const char * dimeInput::readStringNoSkip ( )

Special version of readString() that does not skip leading blanks. This is used for reading TEXT primary values, group_code = 1.

References dimeModel::registerHandle().

Referenced by dimeRecord::readRecordData().

◆ relativePosition()

float dimeInput::relativePosition ( )

Returns the relative file position. 0.0 means beginning of file, 1.0 is at end of file.

Referenced by readGroupCode().

◆ setCallback()

void dimeInput::setCallback ( int(*)(float, void *)  cb,
void *  cbdata 
)

This method sets a progress callback that will be called with a float in the range between 0 and 1, and void * cbdata as arguments.

◆ setFile()

bool dimeInput::setFile ( const char *const  filename)

Opens the file 'filename' for reading. True is returned if the file is opened correctly. File will be closed in destructor.

References setFilePointer().

◆ setFileHandle()

bool dimeInput::setFileHandle ( FILE *  fp)

Sets the input data to the stream fp. \fp must be a valid file/stream, and will not be closed in the destuctor. No progress information will be avilable during loading if this method is used.

◆ setFilePointer()

bool dimeInput::setFilePointer ( const int  newfd)

Sets the file pointer for this instance. newfd is a file opened with the unistd open() function.

Referenced by setFile().


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

Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Tue Mar 24 2020 14:02:59 for Dime by Doxygen 1.8.17.