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 529 of file rtree.h.

Constructor & Destructor Documentation

RTFileStream::RTFileStream ( )
inline

Definition at line 535 of file rtree.h.

536  {
537  m_file = NULL;
538  }
FILE * m_file
Definition: rtree.h:531
RTFileStream::~RTFileStream ( )
inline

Definition at line 540 of file rtree.h.

541  {
542  Close();
543  }
void Close()
Definition: rtree.h:569

Member Function Documentation

void RTFileStream::Close ( )
inline

Definition at line 569 of file rtree.h.

Referenced by ReadArray().

570  {
571  if( m_file )
572  {
573  fclose( m_file );
574  m_file = NULL;
575  }
576  }
FILE * m_file
Definition: rtree.h:531
bool RTFileStream::OpenRead ( const char *  a_fileName)
inline

Definition at line 545 of file rtree.h.

Referenced by ReadArray().

546  {
547  m_file = fopen( a_fileName, "rb" );
548 
549  if( !m_file )
550  {
551  return false;
552  }
553 
554  return true;
555  }
FILE * m_file
Definition: rtree.h:531
bool RTFileStream::OpenWrite ( const char *  a_fileName)
inline

Definition at line 557 of file rtree.h.

Referenced by ReadArray().

558  {
559  m_file = fopen( a_fileName, "wb" );
560 
561  if( !m_file )
562  {
563  return false;
564  }
565 
566  return true;
567  }
FILE * m_file
Definition: rtree.h:531
template<typename TYPE >
size_t RTFileStream::Read ( TYPE &  a_value)
inline

Definition at line 593 of file rtree.h.

References ASSERT.

Referenced by ReadArray().

594  {
595  ASSERT( m_file );
596  return fread( (void*) &a_value, sizeof(a_value), 1, m_file );
597  }
FILE * m_file
Definition: rtree.h:531
#define ASSERT
Definition: rtree.h:33
template<typename TYPE >
size_t RTFileStream::ReadArray ( TYPE *  a_array,
int  a_count 
)
inline

Definition at line 600 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, RTree< DATATYPE, ELEMTYPE, NUMDIMS, ELEMTYPEREAL, TMAXNODES, TMINNODES >::MAXNODES, 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(), rMax, rMin, 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().

601  {
602  ASSERT( m_file );
603  return fread( (void*) a_array, sizeof(TYPE) * a_count, 1, m_file );
604  }
FILE * m_file
Definition: rtree.h:531
#define ASSERT
Definition: rtree.h:33
template<typename TYPE >
size_t RTFileStream::Write ( const TYPE &  a_value)
inline

Definition at line 579 of file rtree.h.

References ASSERT.

Referenced by ReadArray().

580  {
581  ASSERT( m_file );
582  return fwrite( (void*) &a_value, sizeof(a_value), 1, m_file );
583  }
FILE * m_file
Definition: rtree.h:531
#define ASSERT
Definition: rtree.h:33
template<typename TYPE >
size_t RTFileStream::WriteArray ( const TYPE *  a_array,
int  a_count 
)
inline

Definition at line 586 of file rtree.h.

References ASSERT.

Referenced by ReadArray().

587  {
588  ASSERT( m_file );
589  return fwrite( (void*) a_array, sizeof(TYPE) * a_count, 1, m_file );
590  }
FILE * m_file
Definition: rtree.h:531
#define ASSERT
Definition: rtree.h:33

Member Data Documentation

FILE* RTFileStream::m_file
private

Definition at line 531 of file rtree.h.


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