2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file application_data.cpp
18 * @author Yunchan Cho (yunchan.cho@samsung.com)
20 * @brief implementation file for application_data.h
23 #include "application_data.h"
24 #include <dpl/singleton_impl.h>
25 #include <dpl/log/log.h>
28 IMPLEMENT_SINGLETON(ApplicationData)
30 ApplicationData::ApplicationData() :
36 ApplicationData::~ApplicationData()
40 bundle* ApplicationData::getBundle() const
42 return m_originBundle;
45 const char* ApplicationData::getEncodedBundle() const
47 return (const char *)m_encodedBundle;
50 bool ApplicationData::setBundle(bundle *originBundle)
54 LogError("Bundle is empty!");
60 m_originBundle = originBundle;
64 bool ApplicationData::setEncodedBundle(bundle* originBundle)
69 LogError("Bundle is empty!");
75 ret = bundle_encode(originBundle, &m_encodedBundle, &len);
78 LogError("Failed to encode bundle data");
82 LogInfo("Encoded Bundle : " << m_encodedBundle);
86 void ApplicationData::freeBundle()
93 if(!bundle_free(m_originBundle))
95 LogDebug("Bundle data freed for new bundle data");
96 m_originBundle = NULL;
100 void ApplicationData::freeEncodedBundle()
102 if (!m_encodedBundle)
109 if(!bundle_free_encoded_rawdata(
112 LogDebug("Bundle data freed for new bundle data");
113 m_encodedBundle = NULL;