Add ParcelFactory skeleton code
authorChanggyu Choi <changyu.choi@samsung.com>
Tue, 9 Feb 2021 00:37:22 +0000 (09:37 +0900)
committer최창규/Tizen Platform Lab(SR)/Engineer/삼성전자 <changyu.choi@samsung.com>
Tue, 9 Feb 2021 02:45:11 +0000 (11:45 +0900)
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/common/parcel/parcel_factory.cc [new file with mode: 0644]
src/common/parcel/parcel_factory.hh [new file with mode: 0644]

diff --git a/src/common/parcel/parcel_factory.cc b/src/common/parcel/parcel_factory.cc
new file mode 100644 (file)
index 0000000..c36157b
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include "parcel_factory.hh"
+#include "pkgmgrinfo_debug.h"
+
+#include "abstract_parcel.hh"
+#include "appctrlprivinfo_parcel.hh"
+#include "appinfo_parcel.hh"
+#include "certinfo_parcel.hh"
+#include "datactrlinfo_parcel.hh"
+#include "filter_parcel.hh"
+#include "pkginfo_parcel.hh"
+#include "string_parcel.hh"
+
+namespace pkgmgr_common {
+namespace parcel {
+
+ParcelFactory::ParcelFactory() {}
+ParcelFactory::~ParcelFactory() {}
+
+ParcelFactory& ParcelFactory::GetInst() {
+  static ParcelFactory instance;
+  return instance;
+}
+
+std::unique_ptr<AbstractParcel> ParcelFactory::CreateParcel(unsigned char* data,
+    int size) {
+  return nullptr;
+}
+
+}  // namespace parcel
+}  // namespace pkgmgr_common
diff --git a/src/common/parcel/parcel_factory.hh b/src/common/parcel/parcel_factory.hh
new file mode 100644 (file)
index 0000000..ce0995d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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 PARCEL_FACTORY_HH_
+#define PARCEL_FACTORY_HH_
+
+#include <memory>
+
+#include "abstract_parcel.hh"
+
+namespace pkgmgr_common {
+namespace parcel {
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+class EXPORT_API ParcelFactory {
+ public:
+  static ParcelFactory& GetInst();
+  std::unique_ptr<AbstractParcel> CreateParcel(unsigned char* data, int size);
+
+ private:
+  ParcelFactory();
+  ~ParcelFactory();
+};
+
+
+}  // namespace parcel
+}  // namespace pkgmgr_common
+
+#endif  // PARCEL_FACTORY_HH_