openModeller
Version 1.4.0
|
#include <GbifOccurrences.hh>
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 OccurrencesReader * | CreateOccurrencesReaderCallback (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 |
Read occurrences data from the GBIF REST service.
Definition at line 65 of file GbifOccurrences.hh.
GbifOccurrences::GbifOccurrences | ( | const char * | url, |
const char * | coordSystem | ||
) |
Constructor.
url | Service URL. |
coordSystem | Default 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.
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] |
Definition at line 574 of file GbifOccurrences.cpp.
References GbifRecordData::_last_guid, GbifRecordData::_last_lg, GbifRecordData::_last_lt, and GbifRecordData::_occurrences.
Referenced by _retrieveRecords().
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().
bool GbifOccurrences::_retrieveRecords | ( | GbifRecordData * | data, |
int | limit | ||
) | [private] |
Definition at line 382 of file GbifOccurrences.cpp.
References _curl_body_writer(), _curl_header_writer(), _endSearchElement(), GbifRecordData::_next, GbifRecordData::_occurrences, GbifRecordData::_parser, OccurrencesReader::_source, _startSearchElement(), Log::error(), Log::info(), and Log::instance().
Referenced by getPresences().
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().
void GbifOccurrences::_startServiceInfoElement | ( | void * | data, |
const char * | el, | ||
const char ** | attr | ||
) | [static, private] |
Definition at line 277 of file GbifOccurrences.cpp.
References ServiceInfo::_is_gbif, ServiceInfo::_max_records, and ServiceInfo::_parser.
Referenced by _parseServiceInfo().
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().
OccurrencesPtr GbifOccurrences::getAbsences | ( | const char * | groupId | ) | [inline, virtual] |
Return the absences (abundance == 0) from a specific group.
groupId | Identifier for a group of occurrences (usually a species name). |
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.
groupId | Identifier for a group of occurrences (usually a species name). |
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().
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().
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().