1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef LIBRARIES_NACL_IO_TYPED_FS_FACTORY_H_
6#define LIBRARIES_NACL_IO_TYPED_FS_FACTORY_H_
7
8#include "nacl_io/fs_factory.h"
9
10namespace nacl_io {
11
12template <typename T>
13class TypedFsFactory : public FsFactory {
14 public:
15  virtual Error CreateFilesystem(const FsInitArgs& args,
16                                 ScopedFilesystem* out_fs) {
17    sdk_util::ScopedRef<T> fs(new T());
18    Error error = fs->Init(args);
19    if (error)
20      return error;
21
22    *out_fs = fs;
23    return 0;
24  }
25};
26
27}  // namespace nacl_io
28
29#endif  // LIBRARIES_NACL_IO_TYPED_FS_FACTORY_H_
30