VPTissue Reference Manual
NodeAttributes.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "NodeAttributes.h"
21 
22 #include "util/misc/Exception.h"
23 #include "util/misc/log_debug.h"
24 
25 namespace SimPT_Sim {
26 
27 using namespace std;
28 using namespace boost::property_tree;
29 using namespace SimPT_Sim::Util;
30 
31 void NodeAttributes::ReadPtree(const ptree& node_pt)
32 {
33  try {
34  m_fixed = node_pt.get<bool>("fixed");
35  m_sam = node_pt.get<bool>("sam");
36  }
37  catch(exception& e) {
38  const string here = string(VL_HERE) + " exception:\n";
39  throw Exception(here + e.what());
40  }
41 }
42 
44 {
45  ptree ret;
46  ret.put("fixed", IsFixed());
47  ret.put("sam", IsSam());
48  return ret;
49 }
50 
51 }
STL namespace.
Namespace for miscellaneous utilities.
Definition: PTreeFile.cpp:44
virtual boost::property_tree::ptree ToPtree() const
Convert the node attributes to a ptree.
Extremely simple Exception root class.
Definition: Exception.h:28
Interface for NodeAttributes.
Namespace for the core simulator.
Macro defs for debug and logging.
virtual void ReadPtree(const boost::property_tree::ptree &node_pt)
Read the given ptree into the attributes.
Header file for Exception class.