atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
noncopyable.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 LinkedIn Corp. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of the license at
5  * http://www.apache.org/licenses/LICENSE-2.0
6  *
7  * Unless required by applicable law or agreed to in writing, software distributed under the
8  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9  * either express or implied.
10  *
11  */
12 
13 /**
14  * @file noncopyable.h
15  * @author Brian Geffon
16  * @author Manjesh Nilange
17  * @brief A base class used to prevent dervied classes from being copyable, this effectively
18  * eliminates the copy constructor and assignment operator.
19  */
20 
21 #pragma once
22 #ifndef ATSCPPAPI_NONCOPYABLE_H_
23 #define ATSCPPAPI_NONCOPYABLE_H_
24 
25 namespace atscppapi {
26 
27 /**
28  * @brief noncopyable is a base class that will prevent derived classes from being copied.
29  *
30  * @private Prevent Doxygen from showing this class in the inheritance diagrams.
31  *
32  * To use noncopyable you only need to inherit from this class and you're derived class
33  * will become uncopyable
34  *
35  * \code
36  * class myClass : uncopyable {
37  * public:
38  * int test_;
39  * }
40  *
41  * // The following will fail:
42  * myClass a;
43  * myClass b(a); // fails
44  * myClass c = a; // fails
45  * \endcode
46  */
47 class noncopyable
48 {
49 protected:
50  noncopyable() {}
51  ~noncopyable() {}
52 private:
53  noncopyable(const noncopyable&);
54  const noncopyable& operator=(const noncopyable&);
55 };
56 
57 } /* atscppapi */
58 
59 
60 #endif /* ATSCPPAPI_NONCOPYABLE_H_ */