openModeller  Version 1.5.0
OccurrencesReader Class Referenceabstract

#include <OccurrencesReader.hh>

Inheritance diagram for OccurrencesReader:
Inheritance graph
Collaboration diagram for OccurrencesReader:
Collaboration graph

Public Member Functions

virtual ~OccurrencesReader ()
 
virtual bool load ()=0
 
virtual OccurrencesPtr getPresences (const char *groupId)
 
virtual OccurrencesPtr getAbsences (const char *groupId)
 
void printOccurrences (const std::string &msg="")
 

Protected Types

typedef std::vector
< OccurrencesPtr
LstOccurrences
 

Protected Member Functions

int _addOccurrence (const char *id, const char *groupId, Coord lg, Coord lt, Scalar error, Scalar abundance, int num_attributes, Scalar *attributes)
 
 OccurrencesReader ()
 

Protected Attributes

LstOccurrences _presences
 
LstOccurrences _absences
 
char * _source
 
char * _coord_system
 

Private Member Functions

int _addPresence (const char *id, const char *groupId, Coord lg, Coord lt, Scalar error, Scalar abundance, int num_attributes, Scalar *attributes)
 
int _addAbsence (const char *id, const char *groupId, Coord lg, Coord lt, Scalar error, int num_attributes, Scalar *attributes)
 

Detailed Description

Definition of OccurrencesReader class.

Author
Alexandre Copertino Jardim alexc.nosp@m.j@dp.nosp@m.i.inp.nosp@m.e.br
Date
2006-03-21
Id:
OccurrencesReader.hh 5927 2014-03-17 21:18:39Z rdg

LICENSE INFORMATION

Copyright © 2006 INPE Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental

http://www.cria.org.br

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:

http://www.gnu.org/copyleft/gpl.html A common interface to occurrence readers. Implementations need to define a constructor with two const char * parameters: one receiving the source string and the other receiving the default coordinate system in WKT. This way, each instance can only be used for single source. The "load" method must also be defined and implemented in a way that, if called more than once, data will not be duplicated. Implementations must also define a static CreateOccurrencesReaderCallback method receiving the same constructor parameters and returning a valid instance.

Definition at line 47 of file OccurrencesReader.hh.

Member Typedef Documentation

typedef std::vector<OccurrencesPtr> OccurrencesReader::LstOccurrences
protected

Definition at line 81 of file OccurrencesReader.hh.

Constructor & Destructor Documentation

virtual OccurrencesReader::~OccurrencesReader ( )
inlinevirtual

Destructor.

Definition at line 53 of file OccurrencesReader.hh.

OccurrencesReader::OccurrencesReader ( )
inlineprotected

Definition at line 111 of file OccurrencesReader.hh.

Member Function Documentation

int OccurrencesReader::_addAbsence ( const char *  id,
const char *  groupId,
Coord  lg,
Coord  lt,
Scalar  error,
int  num_attributes,
Scalar attributes 
)
private

Add a new absence. Each absence belongs to a group (usually a species name).

Parameters
idOccurrence unique identifier.
groupIdGroup identifier (usually a species name).
lgLongitude.
ltLatitude.
errorAssociated error.
num_attributesNumber of extra attributes.
attributesExtra attributes.
Returns
0 if absence was added to an existing group, 1 if group was created.

Definition at line 192 of file OccurrencesReader.cpp.

References _absences, _coord_system, and OccurrencesImpl::createOccurrence().

Referenced by _addOccurrence().

Here is the call graph for this function:

int OccurrencesReader::_addOccurrence ( const char *  id,
const char *  groupId,
Coord  lg,
Coord  lt,
Scalar  error,
Scalar  abundance,
int  num_attributes,
Scalar attributes 
)
protected

Add a new occurrence. Each occurrence belongs to a group (usually a species name).

Parameters
idOccurrence unique identifier.
groupIdGroup identifier (usually a species name).
lgLongitude.
ltLatitude.
errorAssociated error.
abundanceNumber of "individuals".
num_attributesNumber of extra attributes.
attributesExtra attributes.
Returns
0 if occurrence was added to an existing group, 1 if group was created.

Definition at line 137 of file OccurrencesReader.cpp.

References _addAbsence(), and _addPresence().

Referenced by DelimitedTextOccurrences::load(), and TeOccurrences::load().

Here is the call graph for this function:

int OccurrencesReader::_addPresence ( const char *  id,
const char *  groupId,
Coord  lg,
Coord  lt,
Scalar  error,
Scalar  abundance,
int  num_attributes,
Scalar attributes 
)
private

Add a new presence. Each presence belongs to a group (usually a species name).

Parameters
idOccurrence unique identifier.
groupIdGroup identifier (usually a species name).
lgLongitude.
ltLatitude.
errorAssociated error.
abundanceNumber of "individuals".
num_attributesNumber of extra attributes.
attributesExtra attributes.
Returns
0 if presence was added to an existing group, 1 if group was created.

Definition at line 156 of file OccurrencesReader.cpp.

References _coord_system, _presences, and OccurrencesImpl::createOccurrence().

Referenced by _addOccurrence().

Here is the call graph for this function:

OccurrencesPtr OccurrencesReader::getAbsences ( const char *  groupId)
virtual

Return the absences (abundance == 0) from a specific group.

Parameters
groupIdIdentifier for a group of occurrences (usually a species name).
Returns
Pointer to occurrences of the specified group. If the group was not found or not specified, an empty OccurrencesPtr is returned.

Reimplemented in TapirOccurrences, and GbifOccurrences.

Definition at line 75 of file OccurrencesReader.cpp.

References _absences.

Referenced by RequestFile::_setOccurrences(), main(), and readOccurrences().

OccurrencesPtr OccurrencesReader::getPresences ( const char *  groupId)
virtual

Return the presences (abundance > 0) from a specific group.

Parameters
groupIdIdentifier for a group of occurrences (usually a species name).
Returns
Pointer to occurrences of the specified group. If the group was not found or not specified, an empty OccurrencesPtr is returned.

Reimplemented in TapirOccurrences, and GbifOccurrences.

Definition at line 43 of file OccurrencesReader.cpp.

References _presences.

Referenced by RequestFile::_setOccurrences(), main(), and readOccurrences().

virtual bool OccurrencesReader::load ( )
pure virtual

Try to load the driver given the source provided in the constructor.

Returns
bool True if driver could be loaded and occurrences can be read, false otherwise

Implemented in TapirOccurrences, GbifOccurrences, TeOccurrences, DelimitedTextOccurrences, and SerializedXmlOccurrences.

Referenced by OccurrencesFactory::create().

void OccurrencesReader::printOccurrences ( const std::string &  msg = "")

Print the occurrences to cout.

Parameters
msgOptional string to be printed before the occurrences.

Definition at line 107 of file OccurrencesReader.cpp.

References _absences, and _presences.

Member Data Documentation

LstOccurrences OccurrencesReader::_absences
protected

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