OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
config_json_parser_base.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
3  */
5 
6 #include <boost/lexical_cast.hpp>
7 
9 
10 #include "base/autogen_util.h"
11 #include "config_client_log_types.h"
12 
14 }
15 
17 }
18 
20  return;
21 }
22 
23 std::string ConfigJsonParserBase::GetParentName(const string &left,
24  const string &right) const {
25  ParentNameMap::const_iterator it =
26  parent_name_map_.find(make_pair(left, right));
27  if (it == parent_name_map_.end())
28  return "";
29  return it->second;
30 }
31 
32 std::string ConfigJsonParserBase::GetLinkName(const string &left,
33  const string &right) const {
34  LinkNameMap::const_iterator it =
35  link_name_map_.find(make_pair(left, right));
36  if (it == link_name_map_.end())
37  return "";
38  return it->second.first;
39 }
40 
41 bool ConfigJsonParserBase::IsLinkWithAttr(const string &left,
42  const string &right) const {
43  LinkNameMap::const_iterator it =
44  link_name_map_.find(make_pair(left, right));
45  if (it == link_name_map_.end())
46  return false;
47  return it->second.second;
48 }
49 
50 std::string ConfigJsonParserBase::GetWrapperFieldName(const string &type_name,
51  const string &property_name) const {
52  WrapperFieldMap::const_iterator it =
53  wrapper_field_map_.find(type_name+':'+property_name);
54  if (it == wrapper_field_map_.end()) {
55  return "";
56  } else {
57  // TODO: Fix the autogen to have _ instead of -
58  string temp_str = it->second;
59  std::replace(temp_str.begin(), temp_str.end(), '-', '_');
60  return temp_str;
61  }
62 }
63 
64 bool ConfigJsonParserBase::IsListOrMapPropEmpty(const string &uuid_key,
65  const string &lookup_key) const {
66  return mgr_->config_db_client()->IsListOrMapPropEmpty(uuid_key, lookup_key);
67 }
68 
bool IsLinkWithAttr(const std::string &left, const std::string &right) const
bool IsListOrMapPropEmpty(const std::string &uuid_key, const std::string &lookup_key) const
ConfigDbClient * config_db_client() const
virtual bool IsListOrMapPropEmpty(const std::string &uuid_key, const std::string &lookup_key)=0
WrapperFieldMap wrapper_field_map_
std::string GetParentName(const std::string &left, const std::string &right) const
std::string GetLinkName(const std::string &left, const std::string &right) const
ConfigClientManager * mgr_
std::string GetWrapperFieldName(const std::string &type_name, const std::string &property_name) const