147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org/*
247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *
447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  Use of this source code is governed by a BSD-style license
547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  that can be found in the LICENSE file in the root of the source
647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  tree. An additional intellectual property rights grant can be found
747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  in the file PATENTS.  All contributing project authors may
847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org */
1047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
1147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#ifndef WEBRTC_BASE_CONSTRUCTORMAGIC_H_
1247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define WEBRTC_BASE_CONSTRUCTORMAGIC_H_
1347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
14d505b21170e209f07dea4ff52bcbecdcf03b7ed4henrike@webrtc.org// Undefine macros first, just in case. Some third-party includes have their own
15d505b21170e209f07dea4ff52bcbecdcf03b7ed4henrike@webrtc.org// version.
16d505b21170e209f07dea4ff52bcbecdcf03b7ed4henrike@webrtc.org
17d505b21170e209f07dea4ff52bcbecdcf03b7ed4henrike@webrtc.org#undef DISALLOW_ASSIGN
1847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define DISALLOW_ASSIGN(TypeName) \
1947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  void operator=(const TypeName&)
2047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
2147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// A macro to disallow the evil copy constructor and operator= functions
2247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// This should be used in the private: declarations for a class.
2347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#undef DISALLOW_COPY_AND_ASSIGN
2447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define DISALLOW_COPY_AND_ASSIGN(TypeName)    \
2547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  TypeName(const TypeName&);                    \
2647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  DISALLOW_ASSIGN(TypeName)
2747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
2847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// Alternative, less-accurate legacy name.
29d505b21170e209f07dea4ff52bcbecdcf03b7ed4henrike@webrtc.org#undef DISALLOW_EVIL_CONSTRUCTORS
3047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
3147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  DISALLOW_COPY_AND_ASSIGN(TypeName)
3247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
3347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// A macro to disallow all the implicit constructors, namely the
3447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// default constructor, copy constructor and operator= functions.
3547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org//
3647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// This should be used in the private: declarations for a class
3747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// that wants to prevent anyone from instantiating it. This is
3847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// especially useful for classes containing only static methods.
39d505b21170e209f07dea4ff52bcbecdcf03b7ed4henrike@webrtc.org#undef DISALLOW_IMPLICIT_CONSTRUCTORS
4047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
4147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  TypeName();                                    \
4247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  DISALLOW_EVIL_CONSTRUCTORS(TypeName)
4347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
4447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
4547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#endif  // WEBRTC_BASE_CONSTRUCTORMAGIC_H_
46