source: geovis/trunk/IData.h @ 6128

Last change on this file since 6128 was 5852, checked in by ldelgass, 9 years ago

Add initial iData client support

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2015  HUBzero Foundation, LLC
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7#ifndef GEOVIS_IDATA_H
8#define GEOVIS_IDATA_H
9
10#include <vector>
11#include <string>
12
13namespace IData {
14
15enum Command {
16    COMMAND_LIST,
17    COMMAND_GET,
18    COMMAND_CONTENTS,
19    COMMAND_SETGLOBALMETA,
20    COMMAND_DELETE,
21    COMMAND_UPLOAD,
22    COMMAND_FINISHUPLOAD,
23    COMMAND_CHECKSUM
24};
25
26/// For "shared" property of Collection
27enum Shared {
28    NOT_SHARED,
29    READ_ONLY,
30    READ_WRITE
31};
32
33/// For "dir-or-file" property of DirectoryItem
34enum DirectoryItemType {
35    TYPE_DIRECTORY = 1,
36    TYPE_FILE = 2
37};
38
39class Collection {
40public:
41    std::string name;
42    std::string shared; // "no", "read-only","read-write"
43    unsigned int id;
44};
45
46class DirectoryItem {
47public:
48    DirectoryItem() :
49        size(0)
50    {}
51    std::string name;
52    bool isDir;
53    std::string type;
54    size_t size;
55    std::string ctime;
56    std::string doi;
57};
58
59class Buffer {
60public:
61    Buffer() :
62      data(0), size(0)
63    {}
64    ~Buffer() { free(data); }
65    void *data;
66    size_t size;
67};
68
69extern void iDataInit(const char *username, const char *hub = NULL);
70extern void iDataCleanup();
71extern void getCollectionList(std::vector<Collection>& list);
72extern void getContents(int collectionID, const char *path, std::vector<DirectoryItem>& contents);
73extern void getFile(int collectionID, const char *doi, Buffer *buff);
74extern void deleteFile(int collectionID, const char *path, const char *filename);
75extern void setFileMetadata(int collectionID, const char *doi, const char *name, const char *value);
76
77}
78
79#endif
Note: See TracBrowser for help on using the repository browser.