-// FGPropertyManager.h
-// Class wrapper for property handling.
-// based on FlightGear source src/Main/fg_props.hxx
-// Originally written by David Megginson, started 2000.
-//
-// This file is in the Public Domain, and comes with no warranty.
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Header: FGPropertyManager.h
+ Author: Tony Peden
+ Based on work originally by David Megginson
+ Date: 2/2002
+
+ ------------- Copyright (C) 2002 -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+SENTRY
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGPROPERTYMANAGER_H
#define FGPROPERTYMANAGER_H
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#include <simgear/misc/props.hxx>
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_PROPERTYMANAGER "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
using namespace std;
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Class wrapper for property handling.
+ @author David Megginson, Tony Peden
+ @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+ Header File </a>
+ @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+ Source File </a>
+ */
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
class FGPropertyManager:public SGPropertyNode {
public:
+ /// Constructor
FGPropertyManager(void) {
}
-
+ /// Destructor
~FGPropertyManager(void) {
}
return (GetNode(path, false) != 0);
}
+ /**
+ * Get the name of a node
+ */
+ inline string
+ GetName( void ) {
+ return string( getName() );
+ }
/**
* Get a bool value for a property.
}
- \f
////////////////////////////////////////////////////////////////////////
// Convenience functions for setting property attributes.
////////////////////////////////////////////////////////////////////////
if (node == 0)
cout <<
"Attempt to set archive flag for non-existant property "
- << name;
+ << name << endl;
else
node->setAttribute(SGPropertyNode::ARCHIVE, state);
}
if (node == 0)
cout <<
"Attempt to set read flag for non-existant property "
- << name;
+ << name << endl;
else
node->setAttribute(SGPropertyNode::READ, state);
}
if (node == 0)
cout <<
"Attempt to set write flag for non-existant property "
- << name;
+ << name << endl;
else
node->setAttribute(SGPropertyNode::WRITE, state);
}
- \f
////////////////////////////////////////////////////////////////////////
// Convenience functions for tying properties, with logging.
////////////////////////////////////////////////////////////////////////
Untie (const string &name)
{
if (!untie(name.c_str()))
- cout << "Failed to untie property " << name;
+ cout << "Failed to untie property " << name << endl;
}
if (!tie(name.c_str(), SGRawValuePointer<bool>(pointer),
useDefault))
cout <<
- "Failed to tie property " << name << " to a pointer";
+ "Failed to tie property " << name << " to a pointer" << endl;
}
if (!tie(name.c_str(), SGRawValuePointer<int>(pointer),
useDefault))
cout <<
- "Failed to tie property " << name << " to a pointer";
+ "Failed to tie property " << name << " to a pointer" << endl;
}
if (!tie(name.c_str(), SGRawValuePointer<long>(pointer),
useDefault))
cout <<
- "Failed to tie property " << name << " to a pointer";
+ "Failed to tie property " << name << " to a pointer" << endl;
}
if (!tie(name.c_str(), SGRawValuePointer<float>(pointer),
useDefault))
cout <<
- "Failed to tie property " << name << " to a pointer";
+ "Failed to tie property " << name << " to a pointer" << endl;
}
if (!tie(name.c_str(), SGRawValuePointer<double>(pointer),
useDefault))
cout <<
- "Failed to tie property " << name << " to a pointer";
+ "Failed to tie property " << name << " to a pointer" << endl;
}
/* template <class V> void
- FGPropertyManager::Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
+ Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
bool useDefault = true);
template <class V> void
- FGPropertyManager::Tie (const string &name, int index, V (*getter)(int),
+ Tie (const string &name, int index, V (*getter)(int),
void (*setter)(int, V) = 0, bool useDefault = true);
template <class T, class V> void
- FGPropertyManager::Tie (const string &name, T * obj, V (T::*getter)() const,
+ Tie (const string &name, T * obj, V (T::*getter)() const,
void (T::*setter)(V) = 0, bool useDefault = true);
template <class T, class V> void
- FGPropertyManager::Tie (const string &name, T * obj, int index,
+ Tie (const string &name, T * obj, int index,
V (T::*getter)(int) const, void (T::*setter)(int, V) = 0,
bool useDefault = true); */
*/
template <class V>
inline void
- FGPropertyManager::Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
+ Tie (const string &name, V (*getter)(), void (*setter)(V) = 0,
bool useDefault = true)
{
if (!tie(name.c_str(), SGRawValueFunctions<V>(getter, setter),
useDefault))
cout <<
- "Failed to tie property " << name << " to functions";
+ "Failed to tie property " << name << " to functions" << endl;
}
*/
template <class V>
inline void
- FGPropertyManager::Tie (const string &name, int index, V (*getter)(int),
+ Tie (const string &name, int index, V (*getter)(int),
void (*setter)(int, V) = 0, bool useDefault = true)
{
if (!tie(name.c_str(),
setter),
useDefault))
cout <<
- "Failed to tie property " << name << " to indexed functions";
+ "Failed to tie property " << name << " to indexed functions" << endl;
}
*/
template <class T, class V>
inline void
- FGPropertyManager::Tie (const string &name, T * obj, V (T::*getter)() const,
+ Tie (const string &name, T * obj, V (T::*getter)() const,
void (T::*setter)(V) = 0, bool useDefault = true)
{
if (!tie(name.c_str(),
SGRawValueMethods<T,V>(*obj, getter, setter),
useDefault))
cout <<
- "Failed to tie property " << name << " to object methods";
+ "Failed to tie property " << name << " to object methods" << endl;
}
*/
template <class T, class V>
inline void
- FGPropertyManager::Tie (const string &name, T * obj, int index,
+ Tie (const string &name, T * obj, int index,
V (T::*getter)(int) const, void (T::*setter)(int, V) = 0,
bool useDefault = true)
{
setter),
useDefault))
cout <<
- "Failed to tie property " << name << " to indexed object methods";
+ "Failed to tie property " << name << " to indexed object methods" << endl;
}
};
-
#endif // FGPROPERTYMANAGER_H