Eaagles::Dafif::Database Class Reference

Inherits Eaagles::Basic::LcObject.

Inherited by Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

Inheritance diagram for Eaagles::Dafif::Database:

Inheritance graph
[legend]
Collaboration diagram for Eaagles::Dafif::Database:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Database ()
bool requestDbInUse ()
bool clearDbInUse ()
bool isDbLoader () const
virtual int numberOfRecords ()
virtual int numberFound ()
virtual void getArea (double *const lat, double *const lon)
virtual void getArea (double *const lat, double *const lon, double *const mrng)
virtual void setArea (const double lat, const double lon, const double mrng=0)
virtual void setQueryLimit (const int mrec=0)
virtual int getQueryLimit ()
virtual const char * record (const int n, const int size=0)
virtual const char * getRecord (const int n, const int size=0)
virtual int getRecordLength ()=0
virtual int getMaxRecords ()=0
virtual bool load (const char *code=0)=0
virtual int queryByRange ()=0
virtual int queryByIdent (const char *id)=0
virtual int queryByIcao (const char *code)
virtual int queryByKey (const char *key)=0
virtual void printLoaded (std::ostream &sout)
virtual void printResults (std::ostream &sout)
virtual void printIcaoList (std::ostream &sout)
const char * getPathname () const
const char * getFilename () const
bool setPathname (const char *path)
bool setFilename (const char *file)

Protected Member Functions

bool setSlotPathname (Basic::LcString *const msg)
bool setSlotFilename (Basic::LcString *const msg)
bool openDatabaseFile ()
const char * dbGetRecord (const Key *key, const int size=0)
int sQuery (Key **key, Key **base, size_t n, int(*cmp)(const void *, const void *))
int mQuery (Key **key, Key **base, size_t n, int(*cmp)(const void *, const void *))
void expandResults (Key **key, Key **keyPtr, int(*cmp)(const void *, const void *), Key **base, size_t n)
void createIcaoList ()
int rangeSort ()
int rangeSort2 ()
double range2 (const double lat, const double lon) const

Static Protected Member Functions

static int rlqs (const void *p1, const void *p2)
static int ol_cmp (const void *p1, const void *p2)
static void stripSpaces (char buff[], const int n)
static void fillSpaces (char buff[], const int n)

Protected Attributes

Basic::LcFileReaderdb
long ncache
Key ** rl
long nrl
Key ** ol
long nol
Key ** ql
int nql
int qlimit
double refLat
double refLon
double coslat
double mrng
bool dbInUse
bool dbLoaded

Classes

struct  Key
 Memory key used for quick Dafif record lookup. More...

Constructor & Destructor Documentation

Eaagles::Dafif::Database::Database (  ) 


Member Function Documentation

bool Eaagles::Dafif::Database::requestDbInUse (  )  [inline]

Requests the exclusive use of the database. Returns true if use is granted, or false if the database is already in-use.

bool Eaagles::Dafif::Database::clearDbInUse (  )  [inline]

Clears the database in-use flag. Returns the previous state of the in-use flag.

bool Eaagles::Dafif::Database::isDbLoader (  )  const [inline]

int Eaagles::Dafif::Database::numberOfRecords (  )  [virtual]

Returns the number of records loaded from the file.

int Eaagles::Dafif::Database::numberFound (  )  [virtual]

Returns the number of records found by the last query.

void Eaagles::Dafif::Database::getArea ( double *const   lat,
double *const   lon 
) [virtual]

Return the search area (ref point).

void Eaagles::Dafif::Database::getArea ( double *const   lat,
double *const   lon,
double *const   mrng 
) [virtual]

void Eaagles::Dafif::Database::setArea ( const double  lat,
const double  lon,
const double  mrng = 0 
) [virtual]

Sets the search area (ref point) for queries to lat and lon. If mrng is provided, then query results are limited to mrng.

void Eaagles::Dafif::Database::setQueryLimit ( const int  mrec = 0  )  [virtual]

If mrec is provided, then the limit on records found by a query is set to mrec. If mrec is not provided, then there is no limit on the number of records found by a query.

int Eaagles::Dafif::Database::getQueryLimit (  )  [virtual]

Returns the limit on records found by a query. Zero is returned if no limit exists on the number of records found by a query.

const char * Eaagles::Dafif::Database::record ( const int  n,
const int  size = 0 
) [virtual]

Returns a pointer to n'th record loaded. This points to an internal buffer and is only valid until the next file access. Range: 0 .. numberOfRecords()-1

const char * Eaagles::Dafif::Database::getRecord ( const int  n,
const int  size = 0 
) [virtual]

Get a pointer to the n'th record found by last query. This points to an internal buffer that is only valid until the next file access. Range: 0 .. numberFound()-1

virtual int Eaagles::Dafif::Database::getRecordLength (  )  [pure virtual]

Implemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

virtual int Eaagles::Dafif::Database::getMaxRecords (  )  [pure virtual]

Implemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

virtual bool Eaagles::Dafif::Database::load ( const char *  code = 0  )  [pure virtual]

Implemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

virtual int Eaagles::Dafif::Database::queryByRange (  )  [pure virtual]

Find all records within the search area set by setArea().

Implemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

virtual int Eaagles::Dafif::Database::queryByIdent ( const char *  id  )  [pure virtual]

Find all records within the search area with identifier 'id'.

Implemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

int Eaagles::Dafif::Database::queryByIcao ( const char *  code  )  [virtual]

Find all records within the search area with ICAO code.

virtual int Eaagles::Dafif::Database::queryByKey ( const char *  key  )  [pure virtual]

Find the record with 'key'.

Implemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

void Eaagles::Dafif::Database::printLoaded ( std::ostream &  sout  )  [virtual]

Prints the records loaded.

Reimplemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

void Eaagles::Dafif::Database::printResults ( std::ostream &  sout  )  [virtual]

Prints the records found by the last query.

Reimplemented in Eaagles::Dafif::AirportLoader, Eaagles::Dafif::NavaidLoader, and Eaagles::Dafif::WaypointLoader.

void Eaagles::Dafif::Database::printIcaoList ( std::ostream &  sout  )  [virtual]

Prints the records in the ICAO sorted list.

const char * Eaagles::Dafif::Database::getPathname (  )  const

const char * Eaagles::Dafif::Database::getFilename (  )  const

bool Eaagles::Dafif::Database::setPathname ( const char *  path  ) 

bool Eaagles::Dafif::Database::setFilename ( const char *  file  ) 

bool Eaagles::Dafif::Database::setSlotPathname ( Basic::LcString *const   msg  )  [protected]

bool Eaagles::Dafif::Database::setSlotFilename ( Basic::LcString *const   msg  )  [protected]

bool Eaagles::Dafif::Database::openDatabaseFile (  )  [protected]

const char * Eaagles::Dafif::Database::dbGetRecord ( const Key key,
const int  size = 0 
) [protected]

int Eaagles::Dafif::Database::sQuery ( Key **  key,
Key **  base,
size_t  n,
int(*)(const void *, const void *)  cmp 
) [protected]

int Eaagles::Dafif::Database::mQuery ( Key **  key,
Key **  base,
size_t  n,
int(*)(const void *, const void *)  cmp 
) [protected]

void Eaagles::Dafif::Database::expandResults ( Key **  key,
Key **  keyPtr,
int(*)(const void *, const void *)  cmp,
Key **  base,
size_t  n 
) [protected]

void Eaagles::Dafif::Database::createIcaoList (  )  [protected]

int Eaagles::Dafif::Database::rangeSort (  )  [protected]

Sort results by range; first compute range and then uses rangeSort2() to sort.

int Eaagles::Dafif::Database::rangeSort2 (  )  [protected]

Sort results by range; range must have already been computed.

double Eaagles::Dafif::Database::range2 ( const double  lat,
const double  lon 
) const [protected]

int Eaagles::Dafif::Database::rlqs ( const void *  p1,
const void *  p2 
) [static, protected]

int Eaagles::Dafif::Database::ol_cmp ( const void *  p1,
const void *  p2 
) [static, protected]

void Eaagles::Dafif::Database::stripSpaces ( char  buff[],
const int  n 
) [static, protected]

void Eaagles::Dafif::Database::fillSpaces ( char  buff[],
const int  n 
) [static, protected]


Member Data Documentation

Basic::LcFileReader* Eaagles::Dafif::Database::db [protected]

The database (loaders).

long Eaagles::Dafif::Database::ncache [protected]

Number of keys alloced.

Key** Eaagles::Dafif::Database::rl [protected]

List of DAFIF records in the database.

long Eaagles::Dafif::Database::nrl [protected]

Number of Records in rl.

Key** Eaagles::Dafif::Database::ol [protected]

List of DAFIF records in ICAO code order.

long Eaagles::Dafif::Database::nol [protected]

Number of Records in ol.

Key** Eaagles::Dafif::Database::ql [protected]

query list -- results of query (usually sorted by range)

int Eaagles::Dafif::Database::nql [protected]

Number of record found.

int Eaagles::Dafif::Database::qlimit [protected]

Query limit (zero if no limit).

double Eaagles::Dafif::Database::refLat [protected]

Ref point latitude.

double Eaagles::Dafif::Database::refLon [protected]

Ref point longitude.

double Eaagles::Dafif::Database::coslat [protected]

cos(ref point latitude)

double Eaagles::Dafif::Database::mrng [protected]

max range (nm)

bool Eaagles::Dafif::Database::dbInUse [protected]

Database In-Use flag.

bool Eaagles::Dafif::Database::dbLoaded [protected]

Database has been loader.


Generated on Tue Dec 19 16:26:51 2006 for Eaagles by  doxygen 1.5.0