KiCad PCB EDA Suite
RTFileStream Class Reference

#include <rtree.h>

Public Member Functions

 RTFileStream ()
 
 ~RTFileStream ()
 
bool OpenRead (const char *a_fileName)
 
bool OpenWrite (const char *a_fileName)
 
void Close ()
 
template<typename TYPE >
size_t Write (const TYPE &a_value)
 
template<typename TYPE >
size_t WriteArray (const TYPE *a_array, int a_count)
 
template<typename TYPE >
size_t Read (TYPE &a_value)
 
template<typename TYPE >
size_t ReadArray (TYPE *a_array, int a_count)
 

Private Attributes

FILE * m_file
 

Detailed Description

Definition at line 524 of file rtree.h.

Constructor & Destructor Documentation

RTFileStream::RTFileStream ( )
inline

Definition at line 530 of file rtree.h.

531  {
532  m_file = NULL;
533  }
FILE * m_file
Definition: rtree.h:526
RTFileStream::~RTFileStream ( )
inline

Definition at line 535 of file rtree.h.

536  {
537  Close();
538  }
void Close()
Definition: rtree.h:564

Member Function Documentation

void RTFileStream::Close ( )
inline

Definition at line 564 of file rtree.h.

Referenced by ReadArray().

565  {
566  if( m_file )
567  {
568  fclose( m_file );
569  m_file = NULL;
570  }
571  }
FILE * m_file
Definition: rtree.h:526
bool RTFileStream::OpenRead ( const char *  a_fileName)
inline

Definition at line 540 of file rtree.h.

Referenced by ReadArray().

541  {
542  m_file = fopen( a_fileName, "rb" );
543 
544  if( !m_file )
545  {
546  return false;
547  }
548 
549  return true;
550  }
FILE * m_file
Definition: rtree.h:526
bool RTFileStream::OpenWrite ( const char *  a_fileName)
inline

Definition at line 552 of file rtree.h.

Referenced by ReadArray().

553  {
554  m_file = fopen( a_fileName, "wb" );
555 
556  if( !m_file )
557  {
558  return false;
559  }
560 
561  return true;
562  }
FILE * m_file
Definition: rtree.h:526
template<typename TYPE >
size_t RTFileStream::Read ( TYPE &  a_value)
inline

Definition at line 588 of file rtree.h.

References ASSERT.

Referenced by ReadArray().

589  {
590  ASSERT( m_file );
591  return fread( (void*) &a_value, sizeof(a_value), 1, m_file );
592  }
FILE * m_file
Definition: rtree.h:526
#define ASSERT
Definition: rtree.h:36
template<typename TYPE >
size_t RTFileStream::ReadArray ( TYPE *  a_array,
int  a_count 
)
inline

Definition at line 595 of file rtree.h.

References RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::AddBranch(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::AllocListNode(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::AllocNode(), ASSERT, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::CalcRectVolume(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::ChoosePartition(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Classify(), Close(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::CombineRect(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::CountRec(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::DisconnectBranch(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::FreeListNode(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::FreeNode(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::GetBranches(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::InitNode(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::InitParVars(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::InitRect(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::InsertNNListSorted(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::InsertRect(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::InsertRectRec(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Node::IsLeaf(), Load(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Load(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::LoadNodes(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::LoadRec(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Node::m_level, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::m_root, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::m_unitSphereVolume, max, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::MAXNODES, min, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::MinDist(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::MINNODES, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::NearestNeighbor(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::NodeCover(), OpenRead(), OpenWrite(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Overlap(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::PickBranch(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::PickSeeds(), Read(), ReadArray(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::RectSphericalVolume(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::RectVolume(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::ReInsert(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::RemoveAll(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::RemoveAllRec(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::RemoveRect(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::RemoveRectRec(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Reset(), RTREE_TEMPLATE, Save, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Save(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::SaveRec(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Search(), RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::SplitNode(), Write(), and WriteArray().

Referenced by ReadArray().

596  {
597  ASSERT( m_file );
598  return fread( (void*) a_array, sizeof(TYPE) * a_count, 1, m_file );
599  }
FILE * m_file
Definition: rtree.h:526
#define ASSERT
Definition: rtree.h:36
template<typename TYPE >
size_t RTFileStream::Write ( const TYPE &  a_value)
inline

Definition at line 574 of file rtree.h.

References ASSERT.

Referenced by ReadArray().

575  {
576  ASSERT( m_file );
577  return fwrite( (void*) &a_value, sizeof(a_value), 1, m_file );
578  }
FILE * m_file
Definition: rtree.h:526
#define ASSERT
Definition: rtree.h:36
template<typename TYPE >
size_t RTFileStream::WriteArray ( const TYPE *  a_array,
int  a_count 
)
inline

Definition at line 581 of file rtree.h.

References ASSERT.

Referenced by ReadArray().

582  {
583  ASSERT( m_file );
584  return fwrite( (void*) a_array, sizeof(TYPE) * a_count, 1, m_file );
585  }
FILE * m_file
Definition: rtree.h:526
#define ASSERT
Definition: rtree.h:36

Member Data Documentation

FILE* RTFileStream::m_file
private

Definition at line 526 of file rtree.h.


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