build a structure around the VTS compiler

this uses a generator class which can generate some part of
C/C++ header or main body code of HAL and HAL_SUBMODULE for now.
that'll be extended to support HAL_BINDER in the future.
So this architecture generally improves the maintainability.

Change-Id: I4548b5d1abbfac015f36600d8d94c18534da0e3e
diff --git a/sysfuzzer/vtscompiler/code_gen/CodeGenBase.h b/sysfuzzer/vtscompiler/code_gen/CodeGenBase.h
new file mode 100644
index 0000000..f1a966b
--- /dev/null
+++ b/sysfuzzer/vtscompiler/code_gen/CodeGenBase.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VTS_SYSFUZZER_COMPILER_CODEGENBASE_H__
+#define __VTS_SYSFUZZER_COMPILER_CODEGENBASE_H__
+
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <string>
+
+#include "test/vts/sysfuzzer/common/proto/InterfaceSpecificationMessage.pb.h"
+
+using namespace std;
+
+namespace android {
+namespace vts {
+
+class CodeGenBase {
+ public:
+  explicit CodeGenBase(const char* input_vts_file_path, const char* vts_name);
+  virtual ~CodeGenBase();
+
+  // Generate both a C/C++ file and its header file.
+  void GenerateAll(std::stringstream& cpp_ss,
+                   std::stringstream& h_ss,
+                   const InterfaceSpecificationMessage& message);
+
+ protected:
+  // Generates code for Fuzz(...) function body.
+  virtual void GenerateCppBodyFuzzFunction(
+      std::stringstream& cpp_ss,
+      const InterfaceSpecificationMessage& message,
+      const string& fuzzer_extended_class_name) = 0;
+
+  // Generates header code to declare the C/C++ global functions.
+  virtual void GenerateHeaderGlobalFunctionDeclarations(
+      std::stringstream& h_ss,
+      const string& function_prototype) = 0;
+
+  // Generates code for the bodies of the C/C++ global functions.
+  virtual void GenerateCppBodyGlobalFunctions(
+      std::stringstream& cpp_ss,
+      const string& function_prototype,
+      const string& fuzzer_extended_class_name) = 0;
+
+  // Generates code that opens the default namespaces.
+  void GenerateOpenNameSpaces(std::stringstream& ss);
+
+  // Generates code that closes the default namespaces.
+  void GenerateCloseNameSpaces(std::stringstream& ss);
+
+ private:
+  const char* input_vts_file_path_;
+  const char* vts_name_;
+};
+
+}  // namespace vts
+}  // namespace android
+
+#endif  // __VTS_SYSFUZZER_COMPILER_CODEGENBASE_H__