Simbody  3.4 (development)
AtomicInteger.h
Go to the documentation of this file.
00001 #ifndef SimTK_SimTKCOMMON_ATOMIC_INTEGER_H_
00002 #define SimTK_SimTKCOMMON_ATOMIC_INTEGER_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                       Simbody(tm): SimTKcommon                             *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK biosimulation toolkit originating from           *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
00011  *                                                                            *
00012  * Portions copyright (c) 2008-12 Stanford University and the Authors.        *
00013  * Authors: Peter Eastman                                                     *
00014  * Contributors:                                                              *
00015  *                                                                            *
00016  * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
00017  * not use this file except in compliance with the License. You may obtain a  *
00018  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
00019  *                                                                            *
00020  * Unless required by applicable law or agreed to in writing, software        *
00021  * distributed under the License is distributed on an "AS IS" BASIS,          *
00022  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
00023  * See the License for the specific language governing permissions and        *
00024  * limitations under the License.                                             *
00025  * -------------------------------------------------------------------------- */
00026 
00027 #include "SimTKcommon/internal/common.h"
00028 
00029 namespace SimTK {
00030 
00044 class SimTK_SimTKCOMMON_EXPORT AtomicInteger {
00045 public:
00046     AtomicInteger();
00047     AtomicInteger(int value);
00048     ~AtomicInteger();
00049     AtomicInteger& operator=(int value);
00050     operator int() const;
00051     int operator++();
00052     int operator++(int);
00053     int operator--();
00054     int operator--(int);
00055     AtomicInteger& operator+=(int value);
00056     AtomicInteger& operator-=(int value);
00057     AtomicInteger& operator*=(int value);
00058     AtomicInteger& operator/=(int value);
00059     AtomicInteger& operator%=(int value);
00060     AtomicInteger& operator&=(int value);
00061     AtomicInteger& operator|=(int value);
00062     AtomicInteger& operator^=(int value);
00063     AtomicInteger& operator<<=(int value);
00064     AtomicInteger& operator>>=(int value);
00065     bool operator==(int value) const;
00066     bool operator!=(int value) const;
00067 private:
00068     void* atomic;
00069 };
00070 
00071 std::ostream& operator<<(std::ostream& stream, const AtomicInteger& value);
00072 
00073 } // namespace SimTK
00074 
00075 #endif // SimTK_SimTKCOMMON_ATOMIC_INTEGER_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines