1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Module: FGPropertyValue.cpp
5 Date started: 12/10/2004
6 Purpose: Stores property values
8 ------------- Copyright (C) 2001 Jon S. Berndt (jon@jsbsim.org) -------------
9 ------ Copyright (C) 2010 - 2011 Anders Gidenstam (anders(at)gidenstam.org) -
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU Lesser General Public License as published by the Free Software
13 Foundation; either version 2 of the License, or (at your option) any later
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
21 You should have received a copy of the GNU Lesser General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23 Place - Suite 330, Boston, MA 02111-1307, USA.
25 Further information about the GNU Lesser General Public License can also be found on
26 the world wide web at http://www.gnu.org.
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32 #include "FGPropertyValue.h"
36 static const char *IdSrc = "$Id: FGPropertyValue.cpp,v 1.7 2011/04/05 20:20:21 andgi Exp $";
37 static const char *IdHdr = ID_PROPERTYVALUE;
39 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43 FGPropertyValue::FGPropertyValue(FGPropertyManager* propNode)
44 : PropertyManager(0L), PropertyNode(propNode)
48 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 FGPropertyValue::FGPropertyValue(std::string propName, FGPropertyManager* propertyManager)
51 : PropertyManager(propertyManager), PropertyNode(0L), PropertyName(propName)
55 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 double FGPropertyValue::GetValue(void) const
59 FGPropertyManager* node = PropertyNode;
62 // The node cannot be cached since this is a const method.
63 node = PropertyManager->GetNode(PropertyName);
66 throw(std::string("FGPropertyValue::GetValue() The property " +
67 PropertyName + " does not exist."));
71 return node->getDoubleValue();
74 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 std::string FGPropertyValue::GetName(void) const
79 return PropertyNode->GetName();