Overte C++ Documentation
HFMSerializer.h
1 //
2 // FBXSerializer.h
3 // libraries/hfm/src/hfm
4 //
5 // Created by Sabrina Shanman on 2018/11/07.
6 // Copyright 2018 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_HFMSerializer_h
13 #define hifi_HFMSerializer_h
14 
15 #include <shared/HifiTypes.h>
16 
17 #include "HFM.h"
18 #include <shared/MediaTypeLibrary.h>
19 
20 namespace hfm {
21 
22 class Serializer {
23 public:
24  class Factory {
25  public:
26  virtual ~Factory() {}
27  virtual std::shared_ptr<Serializer> get() = 0;
28  };
29 
30  template<typename T>
31  class SimpleFactory : public Factory {
32  std::shared_ptr<Serializer> get() override {
33  return std::make_shared<T>();
34  }
35  };
36 
37  virtual MediaType getMediaType() const = 0;
38  virtual std::unique_ptr<Factory> getFactory() const = 0;
39 
40  virtual Model::Pointer read(const hifi::ByteArray& data, const hifi::VariantHash& mapping, const hifi::URL& url = hifi::URL()) = 0;
41 };
42 
43 };
44 
45 using HFMSerializer = hfm::Serializer;
46 
47 #endif // hifi_HFMSerializer_h