dxrecord.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_DXRECORD_H
23 #define DXCPP_BINDINGS_DXRECORD_H
24 
25 #include "../bindings.h"
26 
27 namespace dx {
29 
36 
37  class DXRecord: public DXDataObject {
38  private:
39  dx::JSON describe_(const std::string &s)const{return recordDescribe(dxid_,s);}
40  void addTypes_(const std::string &s)const{recordAddTypes(dxid_,s);}
41  void removeTypes_(const std::string &s)const{recordRemoveTypes(dxid_,s);}
42  dx::JSON getDetails_(const std::string &s)const{return recordGetDetails(dxid_,s);}
43  void setDetails_(const std::string &s)const{recordSetDetails(dxid_,s);}
44  void setVisibility_(const std::string &s)const{recordSetVisibility(dxid_,s);}
45  void rename_(const std::string &s)const{recordRename(dxid_,s);}
46  void setProperties_(const std::string &s)const{recordSetProperties(dxid_,s);}
47  void addTags_(const std::string &s)const{recordAddTags(dxid_,s);}
48  void removeTags_(const std::string &s)const{recordRemoveTags(dxid_,s);}
49  void close_(const std::string &s)const{recordClose(dxid_,s);}
50  dx::JSON listProjects_(const std::string &s)const{return recordListProjects(dxid_,s);}
51 
52  public:
53  // Record-specific functions
54 
55  DXRecord() { }
56 
63  DXRecord(const char *dxid, const char *proj=NULL) {
64  setIDs(std::string(dxid), (proj == NULL) ? config::CURRENT_PROJECT() : std::string(proj));
65  }
66 
73  DXRecord(const std::string &dxid,
74  const std::string &proj=config::CURRENT_PROJECT()) { setIDs(dxid, proj); }
75 
83  DXRecord(const dx::JSON &dxlink) { setIDs(dxlink); }
84 
93  void create(const dx::JSON &data_obj_fields=dx::JSON(dx::JSON_OBJECT));
94 
106  void create(const DXRecord &init_from,
107  const dx::JSON &data_obj_fields=dx::JSON(dx::JSON_OBJECT));
108 
119  static DXRecord newDXRecord(const dx::JSON &data_obj_fields=
120  dx::JSON(dx::JSON_OBJECT));
121 
135  static DXRecord newDXRecord(const DXRecord &init_from,
136  const dx::JSON &data_obj_fields=
137  dx::JSON(dx::JSON_OBJECT));
138 
147  DXRecord clone(const std::string &dest_proj_id,
148  const std::string &dest_folder="/") const;
149  };
150 }
151 #endif
static DXRecord newDXRecord(const dx::JSON &data_obj_fields=dx::JSON(dx::JSON_OBJECT))
DXRecord clone(const std::string &dest_proj_id, const std::string &dest_folder="/") const
Definition: dxrecord.cc:57
DXRecord(const dx::JSON &dxlink)
Definition: dxrecord.h:83
virtual void setIDs(const std::string &dxid, const std::string &proj="default")
Definition: bindings.cc:24
DXRecord(const std::string &dxid, const std::string &proj=config::CURRENT_PROJECT())
Definition: dxrecord.h:73
An executable object that can be published for others to discover.
Definition: api.cc:7
DXRecord(const char *dxid, const char *proj=NULL)
Definition: dxrecord.h:63
The abstract base class for all data object remote handlers.
Definition: bindings.h:42
A minimal data object.
Definition: dxrecord.h:37
void create(const dx::JSON &data_obj_fields=dx::JSON(dx::JSON_OBJECT))