openModeller  Version 1.5.0
GbifOccurrences Class Reference

#include <GbifOccurrences.hh>

Inheritance diagram for GbifOccurrences:
Inheritance graph
Collaboration diagram for GbifOccurrences:
Collaboration graph

Public Member Functions

 GbifOccurrences (const char *url, const char *coordSystem)
 
 ~GbifOccurrences ()
 
bool load ()
 
OccurrencesPtr getPresences (const char *groupId)
 
OccurrencesPtr getAbsences (const char *groupId)
 
- Public Member Functions inherited from OccurrencesReader
virtual ~OccurrencesReader ()
 
void printOccurrences (const std::string &msg="")
 

Static Public Member Functions

static OccurrencesReaderCreateOccurrencesReaderCallback (const char *source, const char *coordSystem)
 

Private Member Functions

bool _parseServiceInfo (const std::string *xml, ServiceInfo *info)
 
bool _retrieveRecords (GbifRecordData *data, int limit)
 

Static Private Member Functions

static size_t _curl_header_writer (void *ptr, size_t size, size_t nmemb, void *stream)
 
static size_t _curl_body_writer (void *ptr, size_t size, size_t nmemb, void *stream)
 
static void _startServiceInfoElement (void *data, const char *el, const char **attr)
 
static void _startSearchElement (void *data, const char *el, const char **attr)
 
static void _endSearchElement (void *data, const char *el)
 
static void _ltDataHandler (void *data, const char *value, int len)
 
static void _lgDataHandler (void *data, const char *value, int len)
 

Private Attributes

bool _loaded
 
int _default_limit
 
int _provider_limit
 

Additional Inherited Members

- Protected Types inherited from OccurrencesReader
typedef std::vector
< OccurrencesPtr
LstOccurrences
 
- Protected Member Functions inherited from OccurrencesReader
int _addOccurrence (const char *id, const char *groupId, Coord lg, Coord lt, Scalar error, Scalar abundance, int num_attributes, Scalar *attributes)
 
 OccurrencesReader ()
 
- Protected Attributes inherited from OccurrencesReader
LstOccurrences _presences
 
LstOccurrences _absences
 
char * _source
 
char * _coord_system
 

Detailed Description

Read occurrences data from the GBIF REST service.

Definition at line 65 of file GbifOccurrences.hh.

Constructor & Destructor Documentation

GbifOccurrences::GbifOccurrences ( const char *  url,
const char *  coordSystem 
)

Constructor.

Parameters
urlService URL.
coordSystemDefault coordinate system in WKT.

Definition at line 92 of file GbifOccurrences.cpp.

References OccurrencesReader::_coord_system, _default_limit, _loaded, and OccurrencesReader::_source.

Referenced by CreateOccurrencesReaderCallback().

GbifOccurrences::~GbifOccurrences ( )

Destructor.

Definition at line 111 of file GbifOccurrences.cpp.

Member Function Documentation

size_t GbifOccurrences::_curl_body_writer ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  stream 
)
staticprivate

Definition at line 75 of file GbifOccurrences.cpp.

Referenced by _retrieveRecords(), and load().

size_t GbifOccurrences::_curl_header_writer ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  stream 
)
staticprivate

Definition at line 57 of file GbifOccurrences.cpp.

Referenced by _retrieveRecords(), and load().

void GbifOccurrences::_endSearchElement ( void *  data,
const char *  el 
)
staticprivate
void GbifOccurrences::_lgDataHandler ( void *  data,
const char *  value,
int  len 
)
staticprivate

Definition at line 605 of file GbifOccurrences.cpp.

References GbifRecordData::_last_lg, and GbifRecordData::_parser.

Referenced by _startSearchElement().

void GbifOccurrences::_ltDataHandler ( void *  data,
const char *  value,
int  len 
)
staticprivate

Definition at line 589 of file GbifOccurrences.cpp.

References GbifRecordData::_last_lt, and GbifRecordData::_parser.

Referenced by _startSearchElement().

bool GbifOccurrences::_parseServiceInfo ( const std::string *  xml,
ServiceInfo info 
)
private

Definition at line 234 of file GbifOccurrences.cpp.

References ServiceInfo::_max_records, ServiceInfo::_parser, _provider_limit, _startServiceInfoElement(), Log::error(), and Log::instance().

Referenced by load().

Here is the call graph for this function:

bool GbifOccurrences::_retrieveRecords ( GbifRecordData data,
int  limit 
)
private
void GbifOccurrences::_startSearchElement ( void *  data,
const char *  el,
const char **  attr 
)
staticprivate

Definition at line 530 of file GbifOccurrences.cpp.

References GbifRecordData::_last_guid, _lgDataHandler(), _ltDataHandler(), GbifRecordData::_next, and GbifRecordData::_parser.

Referenced by _retrieveRecords().

Here is the call graph for this function:

void GbifOccurrences::_startServiceInfoElement ( void *  data,
const char *  el,
const char **  attr 
)
staticprivate
OccurrencesReader * GbifOccurrences::CreateOccurrencesReaderCallback ( const char *  source,
const char *  coordSystem 
)
static

Return a new instance of GbifOccurrences.

Definition at line 49 of file GbifOccurrences.cpp.

References GbifOccurrences().

Referenced by OccurrencesFactory::instance().

Here is the call graph for this function:

OccurrencesPtr GbifOccurrences::getAbsences ( const char *  groupId)
inlinevirtual

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 from OccurrencesReader.

Definition at line 102 of file GbifOccurrences.hh.

OccurrencesPtr GbifOccurrences::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 from OccurrencesReader.

Definition at line 322 of file GbifOccurrences.cpp.

References OccurrencesReader::_coord_system, _default_limit, GbifRecordData::_next, GbifRecordData::_occurrences, OccurrencesReader::_presences, _provider_limit, _retrieveRecords(), Log::info(), and Log::instance().

Here is the call graph for this function:

bool GbifOccurrences::load ( )
virtual

Read occurrences from the GBIF REST service.

Implements OccurrencesReader.

Definition at line 120 of file GbifOccurrences.cpp.

References _curl_body_writer(), _curl_header_writer(), ServiceInfo::_is_gbif, _loaded, _parseServiceInfo(), OccurrencesReader::_source, Log::error(), Log::info(), and Log::instance().

Here is the call graph for this function:

Member Data Documentation

int GbifOccurrences::_default_limit
private

Definition at line 110 of file GbifOccurrences.hh.

Referenced by GbifOccurrences(), and getPresences().

bool GbifOccurrences::_loaded
private

Definition at line 107 of file GbifOccurrences.hh.

Referenced by GbifOccurrences(), and load().

int GbifOccurrences::_provider_limit
private

Definition at line 113 of file GbifOccurrences.hh.

Referenced by _parseServiceInfo(), and getPresences().


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