1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_Pose_h 8 #define mozilla_dom_Pose_h 9 10 #include "js/RootingAPI.h" 11 #include "nsCOMPtr.h" 12 #include "nsWrapperCache.h" 13 14 namespace mozilla { 15 class ErrorResult; 16 17 namespace dom { 18 19 class Pose : public nsWrapperCache { 20 public: 21 explicit Pose(nsISupports* aParent); 22 23 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(Pose) 24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(Pose) 25 26 nsISupports* GetParentObject() const; 27 28 virtual void GetPosition(JSContext* aJSContext, 29 JS::MutableHandle<JSObject*> aRetval, 30 ErrorResult& aRv) = 0; 31 virtual void GetLinearVelocity(JSContext* aJSContext, 32 JS::MutableHandle<JSObject*> aRetval, 33 ErrorResult& aRv) = 0; 34 virtual void GetLinearAcceleration(JSContext* aJSContext, 35 JS::MutableHandle<JSObject*> aRetval, 36 ErrorResult& aRv) = 0; 37 virtual void GetOrientation(JSContext* aJSContext, 38 JS::MutableHandle<JSObject*> aRetval, 39 ErrorResult& aRv) = 0; 40 virtual void GetAngularVelocity(JSContext* aJSContext, 41 JS::MutableHandle<JSObject*> aRetval, 42 ErrorResult& aRv) = 0; 43 virtual void GetAngularAcceleration(JSContext* aJSContext, 44 JS::MutableHandle<JSObject*> aRetval, 45 ErrorResult& aRv) = 0; 46 static void SetFloat32Array(JSContext* aJSContext, nsWrapperCache* creator, 47 JS::MutableHandle<JSObject*> aRetVal, 48 JS::Heap<JSObject*>& aObj, float* aVal, 49 uint32_t aValLength, ErrorResult& aRv); 50 51 protected: 52 virtual ~Pose(); 53 54 nsCOMPtr<nsISupports> mParent; 55 56 JS::Heap<JSObject*> mPosition; 57 JS::Heap<JSObject*> mLinearVelocity; 58 JS::Heap<JSObject*> mLinearAcceleration; 59 JS::Heap<JSObject*> mOrientation; 60 JS::Heap<JSObject*> mAngularVelocity; 61 JS::Heap<JSObject*> mAngularAcceleration; 62 }; 63 64 } // namespace dom 65 } // namespace mozilla 66 67 #endif // mozilla_dom_Pose_h 68