das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
node.h
1/* Copyright (C) 2018 Chris Piker <chris-piker@uiowa.edu>
2 *
3 * This file is part of das2C, the Core Das2 C Library.
4 *
5 * Das2C is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 2.1 as published
7 * by the Free Software Foundation.
8 *
9 * Das2C is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * version 2.1 along with das2C; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef _das_node_h_
19#define _das_node_h_
20
21#include <das3/credentials.h>
22#include <das3/array.h>
23#include <das3/json.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29
30
125/* Defines for common path_uri's */
126#define D2URI_ROOT "tag:das2.org,2012:"
127#define D2URI_SITES D2URI_ROOT "site"
128#define D2URI_SITE_UIOWA D2URI_SITES ":/uiowa"
129
130/* Defines for common document fragments */
131#define D2FRAG_TYPE "type"
132#define D2FRAG_NAME "name"
133#define D2FRAG_LABEL "label"
134#define D2FRAG_TITLE "title"
135#define D2FRAG_DESC "description"
136#define D2FRAG_SUB_PATHS "catalog"
137#define D2FRAG_PATH_SEP "separator"
138#define D2FRAG_SOURCES "sources"
139#define D2FRAG_URLS "urls"
140
141/* Defines for common document string values */
142#define D2CV_TYPE_CATALOG "Catalog"
143#define D2CV_TYPE_COLLECTION "Collection"
144#define D2CV_TYPE_SRCSET "SourceSet"
145#define D2CV_TYPE_STREAM "HttpStreamSrc"
146#define D2CV_TYPE_TIMEAGG "FileTimeAgg"
147#define D2CV_TYPE_SPASE "SpaseRecord"
148#define D2Cv_TYPE_SPDF_MASTER "SpdfMasterCat"
149
151typedef enum das_node_type_enum {
152 d2node_inv = 0, d2node_catalog = 1, d2node_collection = 2,
153 d2node_srcset = 3, d2node_stream_src = 4, d2node_file_agg = 5,
154 d2node_spdf_cat = 6, d2node_spase_cat = 7
155} das_node_type_e;
156
162typedef struct das_node {
163 das_node_type_e nType; /* Holds the node type */
164 char sURL[512]; /* Holds source URL for this node */
165 char sPath[512]; /* Holds the Path URI for this node */
166 bool bIsRoot; /* True if a local root node (i.e. is a memory manager) */
167 void* pDom; /* A pointer to the document tokens. */
168} DasNode;
169
176DAS_API const char** das_root_urls(size_t* pLen);
177
219 const char* sPathUri, DasCredMngr* pMgr, const char* sAgent
220);
221
266DAS_API DasNode* new_RootNode_url(const char* sUrl, const char* sPathUri,
267 DasCredMngr* pMgr, const char* sAgent);
268
298 DasNode* pThis, const char* sRelPath, DasCredMngr* pMgr, const char* sAgent
299);
300
304DAS_API bool DasNode_isCatalog(const DasNode* pNode);
305
309DAS_API bool DasNode_isStreamSrc(const DasNode* pNode);
310
314DAS_API bool DasNode_isSpaseRec(const DasNode* pNode);
315
319DAS_API bool DasNode_isSpdfCat(const DasNode* pNode);
320
326DAS_API const char* DasNode_pathUri(const DasNode* pThis);
327
335DAS_API const char* DasNode_srcUrl(const DasNode* pThis);
336
345DAS_API das_node_type_e DasNode_type(const DasNode* pThis);
346
354DAS_API const char* DasNode_name(const DasNode* pThis);
355
359DAS_API const char* DasNode_title(const DasNode* pThis);
360
361
367DAS_API bool DasNode_isJson(const DasNode* pThis);
368
376DAS_API const DasJdo* DasNode_getJdo(const DasNode* pThis, const char* sFragment);
377
378
389 const DasNode* pThis, enum das_json_type_e, const char* sFragment
390);
391
396DAS_API void del_RootNode(DasNode* pNode);
397
398
399#ifdef __cplusplus
400}
401#endif
402
403#endif /* _das_catalog_h_ */
A dynamic buffer with multi-dimensional array style access.
Handle storing credentials during a Das2 session and optionally save them to a file.
das_json_type_e
The various types JSON values can be.
Definition json.h:75
Sheredom's json.h parser with global symbol name changes.
Credentials manager Handles a list of login credentials and supplies these as needed for network oper...
Definition credentials.h:103
JSON Dom Element.
Definition json.h:153
Base type for das2 catalog nodes.
Definition node.h:162
DAS_API void del_RootNode(DasNode *pNode)
Delete a root node freeing it's memory.
DAS_API const DasJdo * DasNode_getJdoType(const DasNode *pThis, enum das_json_type_e, const char *sFragment)
Get a JSON document object of a particular type at a fragment location.
DAS_API DasNode * new_RootNode_url(const char *sUrl, const char *sPathUri, DasCredMngr *pMgr, const char *sAgent)
Create a new root catalog node via direct URL.
DAS_API bool DasNode_isSpaseRec(const DasNode *pNode)
Determine if this node is a SPASE record.
DAS_API const DasJdo * DasNode_getJdo(const DasNode *pThis, const char *sFragment)
Get a JSON document object at a fragment location in a node.
DAS_API bool DasNode_isSpdfCat(const DasNode *pNode)
Determine if this node is an SPDF catalog.
DAS_API const char * DasNode_title(const DasNode *pThis)
Get the node short description, if provided.
DAS_API DasNode * DasNode_subNode(DasNode *pThis, const char *sRelPath, DasCredMngr *pMgr, const char *sAgent)
Get a das2 catalog node contained item.
DAS_API DasNode * new_RootNode(const char *sPathUri, DasCredMngr *pMgr, const char *sAgent)
Create a new root catalog node via a path URI.
DAS_API const char * DasNode_pathUri(const DasNode *pThis)
Get the path URI for this catalog node.
DAS_API const char * DasNode_srcUrl(const DasNode *pThis)
Get the location from which this catalog node was read.
DAS_API bool DasNode_isStreamSrc(const DasNode *pNode)
Determine if this node defines a das2 stream source.
DAS_API das_node_type_e DasNode_type(const DasNode *pThis)
Get the type of node This is a more specific question than the 'is' functions below,...
DAS_API bool DasNode_isCatalog(const DasNode *pNode)
Returns true this node can contain sub nodes.
DAS_API const char * DasNode_name(const DasNode *pThis)
Get the node title.