CloudStorage.h 1.83 KB
Newer Older
Paweł Wegner's avatar
Paweł Wegner committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*****************************************************************************
 * CloudStorage.h : interface of CloudStorage
 *
 *****************************************************************************
 * Copyright (C) 2016-2016 VideoLAN
 *
 * Authors: Paweł Wegner <pawel.wegner95@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef CLOUDSTORAGE_H
#define CLOUDSTORAGE_H

27
#include "CloudProvider/CloudProvider.h"
Paweł Wegner's avatar
Paweł Wegner committed
28 29
#include "ICloudStorage.h"

30 31
#include <map>

Paweł Wegner's avatar
Paweł Wegner committed
32 33 34 35
namespace cloudstorage {

class CloudStorage : public ICloudStorage {
 public:
36 37
  using CloudProviderFactory = std::function<CloudProvider::Pointer()>;

38 39
  CloudStorage();

40 41 42
  std::vector<std::string> providers() const override;
  ICloudProvider::Pointer provider(const std::string& name,
                                   ICloudProvider::InitData&&) const override;
43 44

 private:
45 46
  void add(CloudProviderFactory);

47 48 49 50 51
  template <class T>
  void add() {
    add([]() { return std::make_shared<T>(); });
  }

52
  std::map<std::string, CloudProviderFactory> providers_;
Paweł Wegner's avatar
Paweł Wegner committed
53 54 55 56 57
};

}  // namespace cloudstorage

#endif  // CLOUDSTORAGE_H