diff options
author | dan sinclair <dj2@everburning.com> | 2018-11-28 16:58:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 16:58:50 -0500 |
commit | 0eabcb34cbcddc0ecaec6585d9e0218d6e91f32f (patch) | |
tree | 6d44d5eedd798f3150bfaef5a89be9e476e1214c /include | |
parent | 08f848aae847d99cb9a81fac49401b921e5f930b (diff) | |
download | amber-0eabcb34cbcddc0ecaec6585d9e0218d6e91f32f.tar.gz |
Fill in some documentation. (#116)
Diffstat (limited to 'include')
-rw-r--r-- | include/amber/amber.h | 10 | ||||
-rw-r--r-- | include/amber/result.h | 14 |
2 files changed, 16 insertions, 8 deletions
diff --git a/include/amber/amber.h b/include/amber/amber.h index 343a564..a20fce7 100644 --- a/include/amber/amber.h +++ b/include/amber/amber.h @@ -22,21 +22,31 @@ namespace amber { enum class EngineType : uint8_t { + /// Use the Vulkan backend, if available kVulkan = 0, + /// Use the Dawn backend, if available kDawn, }; struct Options { + /// Sets the engine to be created. Default Vulkan. EngineType engine = EngineType::kVulkan; + /// Holds the device for the given engine. If the device is a |nullptr| + /// a device will be created. If a |default_device| is provided it must + /// outlive the Amber instance and clean is the callers responsibility. void* default_device = nullptr; + /// Set true to only parse the given script, does not execute the engine. bool parse_only = false; }; +/// Main interface to the Amber environment. class Amber { public: Amber(); ~Amber(); + /// Executes the given |data| script with the provided |opts|. Returns a + /// |Result| which indicates if the execution succeded. amber::Result Execute(const std::string& data, const Options& opts); }; diff --git a/include/amber/result.h b/include/amber/result.h index d74156d..6e916be 100644 --- a/include/amber/result.h +++ b/include/amber/result.h @@ -20,29 +20,27 @@ namespace amber { +/// Holds the results for an operation. class Result { public: + /// Creates a result which succeeded. Result(); + /// Creates a result which failed and will return |err|. explicit Result(const std::string& err); Result(const Result&); ~Result(); Result& operator=(const Result&); + /// Returns true if the result is a success. bool IsSuccess() const { return succeeded_; } - const std::string& Error() const { return error_; } - - void SetImageData(const std::vector<uint8_t>& data) { image_data_ = data; } - const std::vector<uint8_t>& ImageData() const { return image_data_; } - void SetBufferData(const std::vector<uint8_t>& data) { buffer_data_ = data; } - const std::vector<uint8_t>& BufferData() const { return buffer_data_; } + /// Returns the error string if |IsSuccess| is false. + const std::string& Error() const { return error_; } private: bool succeeded_; std::string error_; - std::vector<uint8_t> image_data_; - std::vector<uint8_t> buffer_data_; }; } // namespace amber |