openModeller
Version 1.5.0
Main Page
Modules
Classes
Files
File List
File Members
GbifOccurrences.hh
Go to the documentation of this file.
1
27
#ifndef _GBIF_OCCURRENCESHH_
28
#define _GBIF_OCCURRENCESHH_
29
30
#include <
openmodeller/occ_io/OccurrencesReader.hh
>
31
32
#include <
openmodeller/om_defs.hh
>
33
#include <
openmodeller/Occurrences.hh
>
34
35
#include <string>
36
using
std::string;
37
38
#include <expat.h>
39
40
// Data structure to store relevant information about a TAPIR capabilities response
41
struct
ServiceInfo
{
42
43
ServiceInfo
():
_is_gbif
(false),
_max_records
(
""
) { }
44
45
XML_Parser
_parser
;
46
bool
_is_gbif
;
// indicates if it's a GBIF WS REST response
47
std::string
_max_records
;
// maximum number of records that can be returned by the provider
48
};
49
50
// Data structure to be used by the expat handlers during searches
51
struct
GbifRecordData
{
52
53
XML_Parser
_parser
;
54
OccurrencesPtr
_occurrences
;
55
std::string
_last_guid
;
// last guid
56
Coord
_last_lg
;
// last longitude
57
Coord
_last_lt
;
// last latitude
58
int
_next
;
// index of next record to be retrieved
59
};
60
65
class
dllexp
GbifOccurrences
:
public
OccurrencesReader
66
{
67
public
:
68
72
static
OccurrencesReader
* CreateOccurrencesReaderCallback(
const
char
* source,
const
char
* coordSystem );
73
79
GbifOccurrences
(
const
char
* url,
const
char
* coordSystem );
80
83
~
GbifOccurrences
();
84
88
bool
load
();
89
95
OccurrencesPtr
getPresences
(
const
char
*groupId );
96
102
OccurrencesPtr
getAbsences
(
const
char
*groupId ) {
return
new
OccurrencesImpl
( 0 ); }
103
104
private
:
105
106
// Indicates if occurrences were already loaded.
107
bool
_loaded
;
108
109
// Default record limit to be retrieved from the provider
110
int
_default_limit
;
111
112
// Maximum number of records that can be returned by the provider
113
int
_provider_limit
;
114
115
// callback function that will be called by CURL when retrieving header content
116
static
size_t
_curl_header_writer(
void
* ptr,
size_t
size,
size_t
nmemb,
void
* stream );
117
118
// callback function that will be called by CURL when retrieving body content
119
static
size_t
_curl_body_writer(
void
* ptr,
size_t
size,
size_t
nmemb,
void
* stream );
120
121
// Parse service info response
122
bool
_parseServiceInfo(
const
std::string * xml,
ServiceInfo
* info );
123
124
// Start element handler for service info parser
125
static
void
_startServiceInfoElement(
void
*data,
const
char
*el,
const
char
**attr );
126
127
// Retrieve records
128
bool
_retrieveRecords(
GbifRecordData
*data,
int
limit );
129
130
// Start element handler for search parser
131
static
void
_startSearchElement(
void
*data,
const
char
*el,
const
char
**attr );
132
133
// End element handler for search parser
134
static
void
_endSearchElement(
void
*data,
const
char
*el );
135
136
// Latitude character data handler for TaxonOccurrence element
137
static
void
_ltDataHandler(
void
*data,
const
char
*value,
int
len );
138
139
// Longitude character data handler for TaxonOccurrence element
140
static
void
_lgDataHandler(
void
*data,
const
char
*value,
int
len );
141
142
};
143
144
#endif
145
GbifOccurrences::_provider_limit
int _provider_limit
Definition:
GbifOccurrences.hh:113
om_defs.hh
GbifOccurrences
Definition:
GbifOccurrences.hh:65
OccurrencesReader
Definition:
OccurrencesReader.hh:47
GbifOccurrences::_loaded
bool _loaded
Definition:
GbifOccurrences.hh:107
GbifRecordData::_last_lt
Coord _last_lt
Definition:
GbifOccurrences.hh:57
ReferenceCountedPointer< OccurrencesImpl >
ServiceInfo::_max_records
std::string _max_records
Definition:
GbifOccurrences.hh:47
GbifRecordData::_last_guid
std::string _last_guid
Definition:
GbifOccurrences.hh:55
ServiceInfo
Definition:
GbifOccurrences.hh:41
OccurrencesImpl
Definition:
Occurrences.hh:78
OccurrencesReader::getPresences
virtual OccurrencesPtr getPresences(const char *groupId)
Definition:
OccurrencesReader.cpp:43
GbifOccurrences::_default_limit
int _default_limit
Definition:
GbifOccurrences.hh:110
OccurrencesReader::load
virtual bool load()=0
Occurrences.hh
OccurrencesReader.hh
GbifOccurrences::getAbsences
OccurrencesPtr getAbsences(const char *groupId)
Definition:
GbifOccurrences.hh:102
GbifRecordData::_next
int _next
Definition:
GbifOccurrences.hh:58
ServiceInfo::_is_gbif
bool _is_gbif
Definition:
GbifOccurrences.hh:46
Coord
double Coord
Type of map coordinates.
Definition:
om_defs.hh:38
GbifRecordData
Definition:
GbifOccurrences.hh:51
ServiceInfo::_parser
XML_Parser _parser
Definition:
GbifOccurrences.hh:45
GbifRecordData::_parser
XML_Parser _parser
Definition:
GbifOccurrences.hh:53
GbifRecordData::_occurrences
OccurrencesPtr _occurrences
Definition:
GbifOccurrences.hh:54
ServiceInfo::ServiceInfo
ServiceInfo()
Definition:
GbifOccurrences.hh:43
GbifRecordData::_last_lg
Coord _last_lg
Definition:
GbifOccurrences.hh:56
src
openmodeller
occ_io
GbifOccurrences.hh
Generated on Thu Jan 8 2015 17:05:09 for openModeller by
1.8.6