All Classes Namespaces Files Functions Variables Pages
bindings.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2016 DNAnexus, Inc.
2 //
3 // This file is part of dx-toolkit (DNAnexus platform client libraries).
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License"); you may
6 // not use this file except in compliance with the License. You may obtain a
7 // copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 // License for the specific language governing permissions and limitations
15 // under the License.
16 
22 #ifndef DXCPP_BINDINGS_H
23 #define DXCPP_BINDINGS_H
24 
25 #include <string>
26 #include <limits>
27 #include "dxcpp.h"
28 
29 namespace dx {
31 
42  class DXDataObject {
43  protected:
44  std::string dxid_;
45  std::string proj_;
46  void waitOnState(const std::string &state="closed",
47  const int timeout=std::numeric_limits<int>::max()) const;
48 
49  virtual JSON describe_(const std::string &input_params) const = 0;
50  virtual void addTypes_(const std::string &input_params) const = 0;
51  virtual void removeTypes_(const std::string &input_params) const = 0;
52  virtual JSON getDetails_(const std::string &input_params) const = 0;
53  virtual void setDetails_(const std::string &input_params) const = 0;
54  virtual void setVisibility_(const std::string &input_params) const = 0;
55  virtual void rename_(const std::string &input_params) const = 0;
56  virtual void setProperties_(const std::string &input_params) const = 0;
57  virtual void addTags_(const std::string &input_params) const = 0;
58  virtual void removeTags_(const std::string &input_params) const = 0;
59  virtual void close_(const std::string &input_params) const = 0;
60  virtual JSON listProjects_(const std::string &input_params) const = 0;
61 
72  void clone_(const std::string &dest_proj_id,
73  const std::string &dest_folder) const;
74 
75  public:
76  DXDataObject() { }
77 
81  DXDataObject(const DXDataObject &to_copy) {
82  dxid_ = to_copy.dxid_;
83  proj_ = to_copy.proj_;
84  }
85 
91  DXDataObject(const std::string &dxid) { setIDs(dxid); }
92 
99  DXDataObject(const std::string &dxid, const std::string &proj) {
100  setIDs(dxid, proj);
101  }
102 
106  std::string getID() const { return dxid_; }
107 
112  operator std::string() { return dxid_; }
113 
117  std::string getProjectID() const { return proj_; }
118 
129  virtual void setIDs(const std::string &dxid, const std::string &proj="default");
130 
141  virtual void setIDs(const char *dxid, const char *proj=NULL);
142 
153  virtual void setIDs(const JSON &dxlink);
154 
164  JSON describe(bool incl_properties=false, bool incl_details=false) const;
165 
175  void addTypes(const JSON &types) const;
176 
186  void removeTypes(const JSON &types) const;
187 
197  JSON getDetails() const;
198 
208  void setDetails(const JSON &details) const;
209 
217  void hide() const;
218 
226  void unhide() const;
227 
237  void rename(const std::string &name) const;
238 
249  void setProperties(const JSON &properties) const;
250 
257  JSON getProperties() const;
258 
268  void addTags(const JSON &tags) const;
269 
279  void removeTags(const JSON &tags) const;
280 
284  virtual void close() const;
285 
291  JSON listProjects() const;
292 
298  void move(const std::string &dest_folder) const;
299 
304  void remove();
305  };
306 
314  JSON DXLink(const std::string &dxid, const std::string &proj="");
315 }
316 
317 #include "bindings/dxrecord.h"
318 #include "bindings/dxfile.h"
319 #include "bindings/dxjob.h"
320 #include "bindings/dxapplet.h"
321 #include "bindings/dxapp.h"
322 #include "bindings/dxproject.h"
323 #include "bindings/search.h"
324 
325 #endif
Records.
File handles.
Searching for objects in the Platform.
JSON DXLink(const std::string &dxid, const std::string &proj)
Definition: bindings.cc:181
JSON getProperties() const
Definition: bindings.cc:134
std::string getProjectID() const
Definition: bindings.h:117
void unhide() const
Definition: bindings.cc:116
void move(const std::string &dest_folder) const
Definition: bindings.cc:169
virtual void setIDs(const std::string &dxid, const std::string &proj="default")
Definition: bindings.cc:24
void addTypes(const JSON &types) const
Definition: bindings.cc:92
void setProperties(const JSON &properties) const
Definition: bindings.cc:127
Jobs.
Applets.
DXDataObject(const std::string &dxid, const std::string &proj)
Definition: bindings.h:99
The abstract base class for all data object remote handlers.
Definition: bindings.h:42
JSON getDetails() const
Definition: bindings.cc:104
void addTags(const JSON &tags) const
Definition: bindings.cc:138
void setDetails(const JSON &details) const
Definition: bindings.cc:108
Apps.
virtual void close() const
Definition: bindings.cc:152
JSON listProjects() const
Definition: bindings.cc:156
std::string getID() const
Definition: bindings.h:106
void clone_(const std::string &dest_proj_id, const std::string &dest_folder) const
Definition: bindings.cc:160
void hide() const
Definition: bindings.cc:112
void removeTags(const JSON &tags) const
Definition: bindings.cc:145
Containers and projects.
DXDataObject(const DXDataObject &to_copy)
Definition: bindings.h:81
JSON describe(bool incl_properties=false, bool incl_details=false) const
Definition: bindings.cc:82
void removeTypes(const JSON &types) const
Definition: bindings.cc:98
DXDataObject(const std::string &dxid)
Definition: bindings.h:91
void rename(const std::string &name) const
Definition: bindings.cc:120