1//===- ObjectWriter.h -----------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#ifndef MCLD_LD_OBJECTWRITER_H_
10#define MCLD_LD_OBJECTWRITER_H_
11#include <system_error>
12
13namespace mcld {
14
15class FileOutputBuffer;
16class Module;
17
18/** \class ObjectWriter
19 *  \brief ObjectWriter provides a common interface for object file writers.
20 */
21class ObjectWriter {
22 protected:
23  ObjectWriter();
24
25 public:
26  virtual ~ObjectWriter();
27
28  virtual std::error_code writeObject(Module& pModule,
29                                      FileOutputBuffer& pOutput) = 0;
30
31  virtual size_t getOutputSize(const Module& pModule) const = 0;
32};
33
34}  // namespace mcld
35
36#endif  // MCLD_LD_OBJECTWRITER_H_
37