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