openModeller  Version 1.4.0
GbifOccurrences Class Reference

#include <GbifOccurrences.hh>

Inheritance diagram for GbifOccurrences:
Collaboration diagram for GbifOccurrences:

List of all members.

Public Member Functions

 GbifOccurrences (const char *url, const char *coordSystem)
 ~GbifOccurrences ()
bool load ()
OccurrencesPtr getPresences (const char *groupId)
OccurrencesPtr getAbsences (const char *groupId)

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

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().

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 
) [static, private]

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 
) [static, private]

Definition at line 57 of file GbifOccurrences.cpp.

Referenced by _retrieveRecords(), and load().

void GbifOccurrences::_endSearchElement ( void *  data,
const char *  el 
) [static, private]
void GbifOccurrences::_lgDataHandler ( void *  data,
const char *  value,
int  len 
) [static, private]

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 
) [static, private]

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:

void GbifOccurrences::_startSearchElement ( void *  data,
const char *  el,
const char **  attr 
) [static, private]

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 
) [static, private]
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) [inline, 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 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

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().

Definition at line 113 of file GbifOccurrences.hh.

Referenced by _parseServiceInfo(), and getPresences().


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