aboutsummaryrefslogtreecommitdiff
path: root/src/system_wrappers/interface/atomic32_wrapper.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-06-16 21:50:24 -0700
committerEric Laurent <elaurent@google.com>2011-07-11 10:57:26 -0700
commit4e51691e58d8d32590b03c1951cb13de4d1c4758 (patch)
tree07f7cbe7ec1704fd0623f6e07c6a4a47302df56b /src/system_wrappers/interface/atomic32_wrapper.h
parent0d752f593019b9fb34e51c403cd330e38915f278 (diff)
downloadwebrtc-4e51691e58d8d32590b03c1951cb13de4d1c4758.tar.gz
Added webrtc audio processing library
Only the modules necessary for audio processing have been imported: src/common_audio/ src/modules/audio_processing/ src/modules/interface/ src/system_wrappers/ src/typedefs.h src/common_types.h Android.mk android-webrtc.mk Android.mk and android-webrtc.mk have been modified to build only the audio processing modules. Files for Windows compatibility have been removed from system_wrappers. fft_ARM9E directory has been removed from src/common_audio/signal_processing_library/main/source/ SVN checkout at working revision 180. Change-Id: I952373750f2c500d37f99aab4557aa84597d11b8
Diffstat (limited to 'src/system_wrappers/interface/atomic32_wrapper.h')
-rw-r--r--src/system_wrappers/interface/atomic32_wrapper.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/system_wrappers/interface/atomic32_wrapper.h b/src/system_wrappers/interface/atomic32_wrapper.h
new file mode 100644
index 0000000000..40862fb492
--- /dev/null
+++ b/src/system_wrappers/interface/atomic32_wrapper.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// Atomic system independant 32-bit integer.
+// Note: uses full memory barriers.
+// Note: assumes 32-bit (or higher) system
+#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ATOMIC32_WRAPPER_H_
+#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ATOMIC32_WRAPPER_H_
+
+#include "common_types.h"
+
+namespace webrtc {
+class Atomic32Impl;
+class Atomic32Wrapper
+{
+public:
+ Atomic32Wrapper(WebRtc_Word32 initialValue = 0);
+ ~Atomic32Wrapper();
+
+ // Prefix operator!
+ WebRtc_Word32 operator++();
+ WebRtc_Word32 operator--();
+
+ Atomic32Wrapper& operator=(const Atomic32Wrapper& rhs);
+ Atomic32Wrapper& operator=(WebRtc_Word32 rhs);
+
+ WebRtc_Word32 operator+=(WebRtc_Word32 rhs);
+ WebRtc_Word32 operator-=(WebRtc_Word32 rhs);
+
+ // Sets the value atomically to newValue if the value equals compare value.
+ // The function returns true if the exchange happened.
+ bool CompareExchange(WebRtc_Word32 newValue, WebRtc_Word32 compareValue);
+ WebRtc_Word32 Value() const;
+private:
+ // Disable the + and - operator since it's unclear what these operations
+ // should do.
+ Atomic32Wrapper operator+(const Atomic32Wrapper& rhs);
+ Atomic32Wrapper operator-(const Atomic32Wrapper& rhs);
+
+ WebRtc_Word32& operator++(int);
+ WebRtc_Word32& operator--(int);
+
+ // Cheshire cat to hide the implementation (faster than
+ // using virtual functions)
+ Atomic32Impl& _impl;
+};
+} // namespace webrtc
+#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ATOMIC32_WRAPPER_H_