Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create noncopyable.h #852

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/sdk/bfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <map>
#include <vector>

#include "noncopyable.h"

namespace baidu {
namespace bfs {

Expand Down Expand Up @@ -59,7 +61,7 @@ struct FSOptions {
};

/// Bfs File interface
class File {
class File : public noncopyable {
public:
File() {}
virtual ~File() {}
Expand All @@ -71,10 +73,6 @@ class File {
virtual int32_t Flush() = 0;
virtual int32_t Sync() = 0;
virtual int32_t Close() = 0;
private:
// No copying allowed
File(const File&);
void operator=(const File&);
};

struct BfsFileInfo {
Expand All @@ -86,7 +84,7 @@ struct BfsFileInfo {
};

// Bfs fileSystem interface
class FS {
class FS : public noncopyable {
public:
FS() { }
virtual ~FS() { }
Expand Down Expand Up @@ -128,10 +126,6 @@ class FS {
std::map<int64_t, std::vector<std::string> >* locations) = 0;
virtual int32_t ShutdownChunkServer(const std::vector<std::string>& cs_address) = 0;
virtual int32_t ShutdownChunkServerStat() = 0;
private:
// No copying allowed
FS(const FS&);
void operator=(const FS&);
};

} // namespace bfs
Expand Down
3 changes: 0 additions & 3 deletions src/sdk/file_impl_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ class FileImplWrapper : public File {
virtual int32_t Close();
private:
std::shared_ptr<FileImpl> impl_;
// No copying allowed
FileImplWrapper(const FileImplWrapper&);
void operator=(const FileImplWrapper&);
};

} // namespace bfs
Expand Down
24 changes: 24 additions & 0 deletions src/sdk/noncopyable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) 2017, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

#ifndef BFS_SDK_NONCOPYABLE_H_
#define BFS_SDK_NONCOPYABLE_H_

namespace baidu {
namespace bfs {

class noncopyable {
public:
noncopyable() {}
~noncopyable() {}
private:
noncopyable(const noncopyable&) {}
void operator=(const noncopyable&) {}
};

} // namespace bfs
} // namespace baidu

#endif // BFS_SDK_NONCOPYABLE_H_