dxapplet.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 
38 
39 #ifndef DXCPP_BINDINGS_DXAPPLET_H
40 #define DXCPP_BINDINGS_DXAPPLET_H
41 
42 #include "../bindings.h"
43 
44 namespace dx {
45  class DXApplet: public DXDataObject {
46  private:
47  dx::JSON describe_(const std::string &s)const{return appletDescribe(dxid_,s);}
48  void addTypes_(const std::string &UNUSED(s))const{throw DXNotImplementedError("Wrapper for /applet-xxxx/addTypes does not exist");}
49  void removeTypes_(const std::string &UNUSED(s))const{throw DXNotImplementedError("Wrapper for /applet-xxxx/removeTypes does not exist");}
50  dx::JSON getDetails_(const std::string &s)const{return appletGetDetails(dxid_,s);}
51  void setDetails_(const std::string &UNUSED(s))const{throw DXNotImplementedError("Wrapper for /applet-xxxx/setDetails does not exist");}
52  void setVisibility_(const std::string &UNUSED(s))const{throw DXNotImplementedError("Wrapper for /applet-xxxx/setVisibility does not exist");}
53  void rename_(const std::string &s)const{appletRename(dxid_,s);}
54  void setProperties_(const std::string &s)const{appletSetProperties(dxid_,s);}
55  void addTags_(const std::string &s)const{appletAddTags(dxid_,s);}
56  void removeTags_(const std::string &s)const{appletRemoveTags(dxid_,s);}
57  void close_(const std::string &UNUSED(s))const{throw DXNotImplementedError("Wrapper for /applet-xxxx/close does not exist");}
58  dx::JSON listProjects_(const std::string &s)const{return appletListProjects(dxid_,s);}
59 
60  public:
61  // Note: We do not provide applet creation function .. since we want users
62  // to use applet_builder for that task.
63 
64  // Applet-specific functions
65  DXApplet() { }
66 
73  DXApplet(const char *dxid, const char *proj=NULL) {
74  setIDs(std::string(dxid), (proj == NULL) ? config::CURRENT_PROJECT() : std::string(proj));
75  }
76 
83  DXApplet(const std::string &dxid,
84  const std::string &proj=config::CURRENT_PROJECT()) { setIDs(dxid, proj); }
85 
93  DXApplet(const dx::JSON &dxlink) { setIDs(dxlink); }
94 
105  void create(dx::JSON inp);
106 
124  DXJob run(const dx::JSON &applet_input,
125  const std::string &output_folder="/",
126  const std::vector<std::string> &depends_on=std::vector<std::string>(),
127  const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL),
128  const std::string &project_context=config::CURRENT_PROJECT()
129  ) const;
130 
139  DXApplet clone(const std::string &dest_proj_id,
140  const std::string &dest_folder="/") const;
141 
149  dx::JSON get() const { return appletGet(dxid_); }
150 
151  };
152 }
153 #endif
DXApplet(const dx::JSON &dxlink)
Definition: dxapplet.h:93
DXJob run(const dx::JSON &applet_input, const std::string &output_folder="/", const std::vector< std::string > &depends_on=std::vector< std::string >(), const dx::JSON &instance_type=dx::JSON(dx::JSON_NULL), const std::string &project_context=config::CURRENT_PROJECT()) const
Definition: dxapplet.cc:29
DXApplet(const char *dxid, const char *proj=NULL)
Definition: dxapplet.h:73
virtual void setIDs(const std::string &dxid, const std::string &proj="default")
Definition: bindings.cc:24
Definition: exceptions.h:125
Definition: dxapplet.h:45
An executable object that can be published for others to discover.
Definition: api.cc:7
DXApplet clone(const std::string &dest_proj_id, const std::string &dest_folder="/") const
Definition: dxapplet.cc:45
The abstract base class for all data object remote handlers.
Definition: bindings.h:42
DXApplet(const std::string &dxid, const std::string &proj=config::CURRENT_PROJECT())
Definition: dxapplet.h:83
void create(dx::JSON inp)
Definition: dxapplet.cc:23
The instantiation of an applet or app.
Definition: dxjob.h:41