openModeller
Version 1.5.0
Main Page
Modules
Classes
Files
File List
File Members
TapirOccurrences.hh
Go to the documentation of this file.
1
27
#ifndef _TAPIR_OCCURRENCESHH_
28
#define _TAPIR_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
CapabilitiesInfo
{
42
43
CapabilitiesInfo
():
_is_tapir
(false),
_has_guid
(false),
_has_name
(false),
_has_long
(false),
_has_lat
(false),
_accepts_any_model
(false),
_accepts_om_model
(false),
_accepts_om_template
(false),
_max_records
(
""
) { }
44
45
XML_Parser
_parser
;
46
bool
_is_tapir
;
// indicates if it's a TAPIR response
47
bool
_has_guid
;
// indicates if provider mapped the DarwinCore global unique identifier concept
48
bool
_has_name
;
// indicates if provider mapped the DarwinCore scientific name concept
49
bool
_has_long
;
// indicates if provider mapped the DarwinCore longitude concept
50
bool
_has_lat
;
// indicates if provider mapped the DarwinCore latitude concept
51
bool
_accepts_any_model
;
// indicates if provider accepts any output model
52
bool
_accepts_om_model
;
// indicates if provider accepts the openModeller output model
53
bool
_accepts_om_template
;
// indicates if provider accepts the openModeller query template
54
std::string
_max_records
;
// maximum number of records that can be returned by the provider
55
};
56
57
// Data structure to be used by the expat handlers during searches
58
struct
TapirRecordData
{
59
60
OccurrencesPtr
_occurrences
;
61
int
_next
;
// index of next record to be retrieved
62
};
63
69
class
dllexp
TapirOccurrences
:
public
OccurrencesReader
70
{
71
public
:
72
76
static
OccurrencesReader
* CreateOccurrencesReaderCallback(
const
char
* source,
const
char
* coordSystem );
77
83
TapirOccurrences
(
const
char
* url,
const
char
* coordSystem );
84
87
~
TapirOccurrences
();
88
92
bool
load
();
93
99
OccurrencesPtr
getPresences
(
const
char
*groupId );
100
106
OccurrencesPtr
getAbsences
(
const
char
*groupId ) {
return
new
OccurrencesImpl
( 0 ); }
107
108
private
:
109
110
// Indicates if occurrences were already loaded.
111
bool
_loaded
;
112
113
// Default record limit to be retrieved from the provider
114
int
_default_limit
;
115
116
// Maximum number of records that can be returned by the provider
117
int
_provider_limit
;
118
119
// callback function that will be called by CURL when retrieving header content
120
static
size_t
_curl_header_writer(
void
* ptr,
size_t
size,
size_t
nmemb,
void
* stream );
121
122
// callback function that will be called by CURL when retrieving body content
123
static
size_t
_curl_body_writer(
void
* ptr,
size_t
size,
size_t
nmemb,
void
* stream );
124
125
// Parse capabilities response
126
bool
_parseCapabilities(
const
std::string * xml,
CapabilitiesInfo
* info );
127
128
// Start element handler for capabilities parser
129
static
void
_startCapabilitiesElement(
void
*data,
const
char
*el,
const
char
**attr );
130
131
// Character data handler for maxElementRepetitions element
132
static
void
_maxRecordsDataHandler(
void
*data,
const
char
*value,
int
len );
133
134
// End element handler for capabilities parser
135
static
void
_endCapabilitiesElement(
void
*data,
const
char
*el );
136
137
// Retrieve records
138
bool
_retrieveRecords(
TapirRecordData
*data,
int
limit );
139
140
// Start element handler for search parser
141
static
void
_startSearchElement(
void
*data,
const
char
*el,
const
char
**attr );
142
143
};
144
145
#endif
146
TapirOccurrences::_loaded
bool _loaded
Definition:
TapirOccurrences.hh:111
om_defs.hh
TapirOccurrences::_provider_limit
int _provider_limit
Definition:
TapirOccurrences.hh:117
CapabilitiesInfo::_accepts_om_template
bool _accepts_om_template
Definition:
TapirOccurrences.hh:53
OccurrencesReader
Definition:
OccurrencesReader.hh:47
TapirOccurrences
Definition:
TapirOccurrences.hh:69
CapabilitiesInfo::_has_name
bool _has_name
Definition:
TapirOccurrences.hh:48
ReferenceCountedPointer< OccurrencesImpl >
CapabilitiesInfo::_accepts_any_model
bool _accepts_any_model
Definition:
TapirOccurrences.hh:51
TapirRecordData::_occurrences
OccurrencesPtr _occurrences
Definition:
TapirOccurrences.hh:60
CapabilitiesInfo::_has_guid
bool _has_guid
Definition:
TapirOccurrences.hh:47
CapabilitiesInfo::_accepts_om_model
bool _accepts_om_model
Definition:
TapirOccurrences.hh:52
CapabilitiesInfo::_max_records
std::string _max_records
Definition:
TapirOccurrences.hh:54
TapirOccurrences::_default_limit
int _default_limit
Definition:
TapirOccurrences.hh:114
OccurrencesImpl
Definition:
Occurrences.hh:78
OccurrencesReader::getPresences
virtual OccurrencesPtr getPresences(const char *groupId)
Definition:
OccurrencesReader.cpp:43
TapirRecordData
Definition:
TapirOccurrences.hh:58
OccurrencesReader::load
virtual bool load()=0
CapabilitiesInfo::_has_lat
bool _has_lat
Definition:
TapirOccurrences.hh:50
CapabilitiesInfo::CapabilitiesInfo
CapabilitiesInfo()
Definition:
TapirOccurrences.hh:43
CapabilitiesInfo
Definition:
TapirOccurrences.hh:41
Occurrences.hh
CapabilitiesInfo::_parser
XML_Parser _parser
Definition:
TapirOccurrences.hh:45
TapirOccurrences::getAbsences
OccurrencesPtr getAbsences(const char *groupId)
Definition:
TapirOccurrences.hh:106
OccurrencesReader.hh
CapabilitiesInfo::_is_tapir
bool _is_tapir
Definition:
TapirOccurrences.hh:46
TapirRecordData::_next
int _next
Definition:
TapirOccurrences.hh:61
CapabilitiesInfo::_has_long
bool _has_long
Definition:
TapirOccurrences.hh:49
src
openmodeller
occ_io
TapirOccurrences.hh
Generated on Thu Jan 8 2015 17:05:10 for openModeller by
1.8.6