TVSetting HAL 0.2.0
 
Loading...
Searching...
No Matches
als_bl_iniparser.h
Go to the documentation of this file.
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2016 RDK Management
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19
20/**
21 * @addtogroup HPK Hardware Porting Kit
22 * @{
23 * @par The Hardware Porting Kit
24 * HPK is the next evolution of the well-defined Hardware Abstraction Layer
25 * (HAL), but augmented with more comprehensive documentation and test suites
26 * that OEM or SOC vendors can use to self-certify their ports before taking
27 * them to RDKM for validation or to an operator for final integration and
28 * deployment. The Hardware Porting Kit effectively enables an OEM and/or SOC
29 * vendor to self-certify their own Video Accelerator devices, with minimal RDKM
30 * assistance.
31 *
32 */
33
34/**
35 * @addtogroup ALS_BL_Iniparser ALS BL Ini parser Module
36 * @{
37 */
38
39
40/**
41* @addtogroup ALS_BL_Iniparser_HAL ALS BL Ini parser HAL
42* @{
43*/
44
45/**
46* @defgroup ALS_BL_Iniparser_H ALS BL Ini parser Header
47* @{
48*/
49
50#include <iostream>
51#include <boost/filesystem.hpp>
52#include <boost/property_tree/ini_parser.hpp>
54{
55 std::string m_path;
56 std::string opt_path;
57 boost::property_tree::ptree m_data;
58public:
59 CIniFile(const std::string & filename, const std::string & filepath = "/etc/" )
60 {
61 opt_path = "/opt/panel/";
62 m_path = filepath;
63 m_path.append(filename);
64 opt_path.append(filename);
65 if(!boost::filesystem::exists( opt_path)) {
66 std::cout << "DS HAL : Using " << m_path <<std::endl;
67 boost::property_tree::ini_parser::read_ini(m_path, m_data);
68 }
69 else {
70 std::cout << "DS HAL : Using " << opt_path << std::endl;
71 boost::property_tree::ini_parser::read_ini(opt_path, m_data);
72 }
73 }
75 {
76 }
77 template <typename T>
78 T Get(const std::string & key)
79 {
80 return m_data.get<T>(key);
81 }
82 template <typename T>
83 void Set(const std::string & key, const T & value){
84 //TODO DD: Not required currently
85 //m_data.put(key, value);
86 }
87};
88
89/** @} */ // End of ALS_BL_Iniparser_H
90/** @} */ // End of ALS_BL_Iniparser_HAL
91/** @} */ // End of ALS_BL_Iniparser
92/** @} */ // End of HPK
Definition als_bl_iniparser.h:54
T Get(const std::string &key)
Definition als_bl_iniparser.h:78
CIniFile(const std::string &filename, const std::string &filepath="/etc/")
Definition als_bl_iniparser.h:59
~CIniFile()
Definition als_bl_iniparser.h:74
void Set(const std::string &key, const T &value)
Definition als_bl_iniparser.h:83