]> git.mxchange.org Git - flightgear.git/blob - src/Main/fg_props.cxx
New log class for TerraSync
[flightgear.git] / src / Main / fg_props.cxx
1 // fg_props.cxx -- support for FlightGear properties.
2 //
3 // Written by David Megginson, started 2000.
4 //
5 // Copyright (C) 2000, 2001 David Megginson - david@megginson.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26
27 #include <simgear/compiler.h>
28 #include <simgear/structure/exception.hxx>
29 #include <simgear/props/props_io.hxx>
30
31 #include <simgear/timing/sg_time.hxx>
32 #include <simgear/misc/sg_path.hxx>
33 #include <simgear/scene/model/particles.hxx>
34 #include <simgear/sound/soundmgr_openal.hxx>
35
36 #include <GUI/gui.h>
37
38 #include "globals.hxx"
39 #include "fg_props.hxx"
40
41 static bool frozen = false;     // FIXME: temporary
42
43 using std::string;
44 ////////////////////////////////////////////////////////////////////////
45 // Default property bindings (not yet handled by any module).
46 ////////////////////////////////////////////////////////////////////////
47
48 struct LogClassMapping {
49   sgDebugClass c;
50   string name;
51   LogClassMapping(sgDebugClass cc, string nname) { c = cc; name = nname; }
52 };
53
54 LogClassMapping log_class_mappings [] = {
55   LogClassMapping(SG_NONE, "none"),
56   LogClassMapping(SG_TERRAIN, "terrain"),
57   LogClassMapping(SG_ASTRO, "astro"),
58   LogClassMapping(SG_FLIGHT, "flight"),
59   LogClassMapping(SG_INPUT, "input"),
60   LogClassMapping(SG_GL, "gl"),
61   LogClassMapping(SG_VIEW, "view"),
62   LogClassMapping(SG_COCKPIT, "cockpit"),
63   LogClassMapping(SG_GENERAL, "general"),
64   LogClassMapping(SG_MATH, "math"),
65   LogClassMapping(SG_EVENT, "event"),
66   LogClassMapping(SG_AIRCRAFT, "aircraft"),
67   LogClassMapping(SG_AUTOPILOT, "autopilot"),
68   LogClassMapping(SG_IO, "io"),
69   LogClassMapping(SG_CLIPPER, "clipper"),
70   LogClassMapping(SG_NETWORK, "network"),
71   LogClassMapping(SG_INSTR, "instrumentation"),
72   LogClassMapping(SG_ATC, "atc"),
73   LogClassMapping(SG_NASAL, "nasal"),
74   LogClassMapping(SG_SYSTEMS, "systems"),
75   LogClassMapping(SG_AI, "ai"),
76   LogClassMapping(SG_ENVIRONMENT, "environment"),
77   LogClassMapping(SG_SOUND, "sound"),
78   LogClassMapping(SG_NAVAID, "navaid"),
79   LogClassMapping(SG_GUI, "gui"),
80   LogClassMapping(SG_TERRASYNC, "terrasync"),
81   LogClassMapping(SG_UNDEFD, "")
82 };
83
84
85 /**
86  * Get the logging classes.
87  */
88 // XXX Making the result buffer be global is a band-aid that hopefully
89 // delays its destruction 'til after its last use.
90 namespace
91 {
92 string loggingResult;
93 }
94
95 static const char *
96 getLoggingClasses ()
97 {
98   sgDebugClass classes = sglog().get_log_classes();
99   loggingResult.clear();
100   for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
101     if ((classes&log_class_mappings[i].c) > 0) {
102       if (!loggingResult.empty())
103         loggingResult += '|';
104       loggingResult += log_class_mappings[i].name;
105     }
106   }
107   return loggingResult.c_str();
108 }
109
110
111 static void
112 addLoggingClass (const string &name)
113 {
114   sgDebugClass classes = sglog().get_log_classes();
115   for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
116     if (name == log_class_mappings[i].name) {
117       sglog().set_log_classes(sgDebugClass(classes|log_class_mappings[i].c));
118       return;
119     }
120   }
121   SG_LOG(SG_GENERAL, SG_WARN, "Unknown logging class: " << name);
122 }
123
124
125 /**
126  * Set the logging classes.
127  */
128 void
129 setLoggingClasses (const char * c)
130 {
131   string classes = c;
132   sglog().set_log_classes(SG_NONE);
133
134   if (classes == "none") {
135     SG_LOG(SG_GENERAL, SG_INFO, "Disabled all logging classes");
136     return;
137   }
138
139   if (classes.empty() || classes == "all") { // default
140     sglog().set_log_classes(SG_ALL);
141     SG_LOG(SG_GENERAL, SG_INFO, "Enabled all logging classes: "
142            << getLoggingClasses());
143     return;
144   }
145
146   string rest = classes;
147   string name = "";
148   string::size_type sep = rest.find('|');
149   if (sep == string::npos)
150     sep = rest.find(',');
151   while (sep != string::npos) {
152     name = rest.substr(0, sep);
153     rest = rest.substr(sep+1);
154     addLoggingClass(name);
155     sep = rest.find('|');
156     if (sep == string::npos)
157       sep = rest.find(',');
158   }
159   addLoggingClass(rest);
160   SG_LOG(SG_GENERAL, SG_INFO, "Set logging classes to "
161          << getLoggingClasses());
162 }
163
164
165 /**
166  * Get the logging priority.
167  */
168 static const char *
169 getLoggingPriority ()
170 {
171   switch (sglog().get_log_priority()) {
172   case SG_BULK:
173     return "bulk";
174   case SG_DEBUG:
175     return "debug";
176   case SG_INFO:
177     return "info";
178   case SG_WARN:
179     return "warn";
180   case SG_ALERT:
181     return "alert";
182   default:
183     SG_LOG(SG_GENERAL, SG_WARN, "Internal: Unknown logging priority number: "
184            << sglog().get_log_priority());
185     return "unknown";
186   }
187 }
188
189
190 /**
191  * Set the logging priority.
192  */
193 void
194 setLoggingPriority (const char * p)
195 {
196   if (p == 0)
197       return;
198   string priority = p;
199   if (priority == "bulk") {
200     sglog().set_log_priority(SG_BULK);
201   } else if (priority == "debug") {
202     sglog().set_log_priority(SG_DEBUG);
203   } else if (priority.empty() || priority == "info") { // default
204     sglog().set_log_priority(SG_INFO);
205   } else if (priority == "warn") {
206     sglog().set_log_priority(SG_WARN);
207   } else if (priority == "alert") {
208     sglog().set_log_priority(SG_ALERT);
209   } else {
210     SG_LOG(SG_GENERAL, SG_WARN, "Unknown logging priority " << priority);
211   }
212   SG_LOG(SG_GENERAL, SG_DEBUG, "Logging priority is " << getLoggingPriority());
213 }
214
215
216 /**
217  * Return the current frozen state.
218  */
219 static bool
220 getFreeze ()
221 {
222   return frozen;
223 }
224
225
226 /**
227  * Set the current frozen state.
228  */
229 static void
230 setFreeze (bool f)
231 {
232     frozen = f;
233
234     // Stop sound on a pause
235     SGSoundMgr *smgr = globals->get_subsystem<SGSoundMgr>();
236     if ( smgr != NULL ) {
237         if ( f ) {
238             smgr->suspend();
239         } else if (fgGetBool("/sim/sound/working")) {
240             smgr->resume();
241         }
242     }
243
244     // Pause the particle system
245     simgear::Particles::setFrozen(f);
246 }
247
248
249 /**
250  * Return the number of milliseconds elapsed since simulation started.
251  */
252 static double
253 getElapsedTime_sec ()
254 {
255   return globals->get_sim_time_sec();
256 }
257
258
259 /**
260  * Return the current Zulu time.
261  */
262 static const char *
263 getDateString ()
264 {
265   static char buf[64];          // FIXME
266   
267   SGTime * st = globals->get_time_params();
268   if (!st) {
269     buf[0] = 0;
270     return buf;
271   }
272   
273   struct tm * t = st->getGmt();
274   sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
275           t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
276           t->tm_hour, t->tm_min, t->tm_sec);
277   return buf;
278 }
279
280
281 /**
282  * Set the current Zulu time.
283  */
284 static void
285 setDateString (const char * date_string)
286 {
287   SGTime * st = globals->get_time_params();
288   struct tm * current_time = st->getGmt();
289   struct tm new_time;
290
291                                 // Scan for basic ISO format
292                                 // YYYY-MM-DDTHH:MM:SS
293   int ret = sscanf(date_string, "%d-%d-%dT%d:%d:%d",
294                    &(new_time.tm_year), &(new_time.tm_mon),
295                    &(new_time.tm_mday), &(new_time.tm_hour),
296                    &(new_time.tm_min), &(new_time.tm_sec));
297
298                                 // Be pretty picky about this, so
299                                 // that strange things don't happen
300                                 // if the save file has been edited
301                                 // by hand.
302   if (ret != 6) {
303     SG_LOG(SG_INPUT, SG_WARN, "Date/time string " << date_string
304            << " not in YYYY-MM-DDTHH:MM:SS format; skipped");
305     return;
306   }
307
308                                 // OK, it looks like we got six
309                                 // values, one way or another.
310   new_time.tm_year -= 1900;
311   new_time.tm_mon -= 1;
312                                 // Now, tell flight gear to use
313                                 // the new time.  This was far
314                                 // too difficult, by the way.
315   long int warp =
316     mktime(&new_time) - mktime(current_time) + globals->get_warp();
317     
318   fgSetInt("/sim/time/warp", warp);
319 }
320
321 /**
322  * Return the GMT as a string.
323  */
324 static const char *
325 getGMTString ()
326 {
327   static char buf[16];
328   SGTime * st = globals->get_time_params();
329   if (!st) {
330     buf[0] = 0;
331     return buf;
332   }
333   
334   struct tm *t = st->getGmt();
335   snprintf(buf, 16, "%.2d:%.2d:%.2d",
336       t->tm_hour, t->tm_min, t->tm_sec);
337   return buf;
338 }
339
340 /**
341  * Return the current heading in degrees.
342  */
343 static double
344 getHeadingMag ()
345 {
346   double magheading = fgGetDouble("/orientation/heading-deg") -
347     fgGetDouble("/environment/magnetic-variation-deg");
348   return SGMiscd::normalizePeriodic(0, 360, magheading );
349 }
350
351 /**
352  * Return the current track in degrees.
353  */
354 static double
355 getTrackMag ()
356 {
357   double magtrack = fgGetDouble("/orientation/track-deg") -
358     fgGetDouble("/environment/magnetic-variation-deg");
359   return SGMiscd::normalizePeriodic(0, 360, magtrack );
360 }
361
362 ////////////////////////////////////////////////////////////////////////
363 // Tie the properties.
364 ////////////////////////////////////////////////////////////////////////
365 SGConstPropertyNode_ptr FGProperties::_longDeg;
366 SGConstPropertyNode_ptr FGProperties::_latDeg;
367 SGConstPropertyNode_ptr FGProperties::_lonLatformat;
368
369 const char *
370 FGProperties::getLongitudeString ()
371 {
372   static char buf[32];
373   double d = _longDeg->getDoubleValue();
374   int format = _lonLatformat->getIntValue();
375   char c = d < 0.0 ? 'W' : 'E';
376   d = fabs(d);
377
378   if (format == 0) {
379     snprintf(buf, 32, "%3.6f%c", d, c);
380
381   } else if (format == 1) {
382     // dd mm.mmm' (DMM-Format) -- uses a round-off factor tailored to the
383     // required precision of the minutes field (three decimal places),
384     // preventing minute values of 60.
385     double min = (d - int(d)) * 60.0;
386     if (min >= 59.9995) {
387         min -= 60.0;
388         d += 1.0;
389     }
390     snprintf(buf, 32, "%d*%06.3f%c", int(d), fabs(min), c);
391
392   } else {
393     // mm'ss.s'' (DMS-Format) -- uses a round-off factor tailored to the
394     // required precision of the seconds field (one decimal place),
395     // preventing second values of 60.
396     double min = (d - int(d)) * 60.0;
397     double sec = (min - int(min)) * 60.0;
398     if (sec >= 59.95) {
399         sec -= 60.0;
400         min += 1.0;
401         if (min >= 60.0) {
402             min -= 60.0;
403             d += 1.0;
404         }
405     }
406     snprintf(buf, 32, "%d*%02d %04.1f%c", int(d),
407         int(min), fabs(sec), c);
408   }
409   buf[31] = '\0';
410   return buf;
411 }
412
413 const char *
414 FGProperties::getLatitudeString ()
415 {
416   static char buf[32];
417   double d = _latDeg->getDoubleValue();
418   int format = _lonLatformat->getIntValue();
419   char c = d < 0.0 ? 'S' : 'N';
420   d = fabs(d);
421
422   if (format == 0) {
423     snprintf(buf, 32, "%3.6f%c", d, c);
424
425   } else if (format == 1) {
426     double min = (d - int(d)) * 60.0;
427     if (min >= 59.9995) {
428         min -= 60.0;
429         d += 1.0;
430     }
431     snprintf(buf, 32, "%d*%06.3f%c", int(d), fabs(min), c);
432
433   } else {
434     double min = (d - int(d)) * 60.0;
435     double sec = (min - int(min)) * 60.0;
436     if (sec >= 59.95) {
437         sec -= 60.0;
438         min += 1.0;
439         if (min >= 60.0) {
440             min -= 60.0;
441             d += 1.0;
442         }
443     }
444     snprintf(buf, 32, "%d*%02d %04.1f%c", int(d),
445         int(min), fabs(sec), c);
446   }
447   buf[31] = '\0';
448   return buf;
449 }
450
451
452
453 \f
454
455 FGProperties::FGProperties ()
456 {
457 }
458
459 FGProperties::~FGProperties ()
460 {
461 }
462
463 void
464 FGProperties::init ()
465 {
466 }
467
468 void
469 FGProperties::bind ()
470 {
471   _longDeg      = fgGetNode("/position/longitude-deg", true);
472   _latDeg       = fgGetNode("/position/latitude-deg", true);
473   _lonLatformat = fgGetNode("/sim/lon-lat-format", true);
474
475   _offset = fgGetNode("/sim/time/local-offset", true);
476
477   // utc date/time
478   _uyear = fgGetNode("/sim/time/utc/year", true);
479   _umonth = fgGetNode("/sim/time/utc/month", true);
480   _uday = fgGetNode("/sim/time/utc/day", true);
481   _uhour = fgGetNode("/sim/time/utc/hour", true);
482   _umin = fgGetNode("/sim/time/utc/minute", true);
483   _usec = fgGetNode("/sim/time/utc/second", true);
484   _uwday = fgGetNode("/sim/time/utc/weekday", true);
485   _udsec = fgGetNode("/sim/time/utc/day-seconds", true);
486
487   // real local date/time
488   _ryear = fgGetNode("/sim/time/real/year", true);
489   _rmonth = fgGetNode("/sim/time/real/month", true);
490   _rday = fgGetNode("/sim/time/real/day", true);
491   _rhour = fgGetNode("/sim/time/real/hour", true);
492   _rmin = fgGetNode("/sim/time/real/minute", true);
493   _rsec = fgGetNode("/sim/time/real/second", true);
494   _rwday = fgGetNode("/sim/time/real/weekday", true);
495
496   _tiedProperties.setRoot(globals->get_props());
497
498   // Simulation
499   _tiedProperties.Tie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
500   _tiedProperties.Tie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
501   _tiedProperties.Tie("/sim/freeze/master", getFreeze, setFreeze);
502
503   _tiedProperties.Tie("/sim/time/elapsed-sec", getElapsedTime_sec);
504   _tiedProperties.Tie("/sim/time/gmt", getDateString, setDateString);
505   fgSetArchivable("/sim/time/gmt");
506   _tiedProperties.Tie("/sim/time/gmt-string", getGMTString);
507
508   // Position
509   _tiedProperties.Tie("/position/latitude-string", getLatitudeString);
510   _tiedProperties.Tie("/position/longitude-string", getLongitudeString);
511
512   // Orientation
513   _tiedProperties.Tie("/orientation/heading-magnetic-deg", getHeadingMag);
514   _tiedProperties.Tie("/orientation/track-magnetic-deg", getTrackMag);
515 }
516
517 void
518 FGProperties::unbind ()
519 {
520     _tiedProperties.Untie();
521
522     // drop static references to properties
523     _longDeg = 0;
524     _latDeg = 0;
525     _lonLatformat = 0;
526 }
527
528 void
529 FGProperties::update (double dt)
530 {
531     _offset->setIntValue(globals->get_time_params()->get_local_offset());
532
533     // utc date/time
534     struct tm *u = globals->get_time_params()->getGmt();
535     _uyear->setIntValue(u->tm_year + 1900);
536     _umonth->setIntValue(u->tm_mon + 1);
537     _uday->setIntValue(u->tm_mday);
538     _uhour->setIntValue(u->tm_hour);
539     _umin->setIntValue(u->tm_min);
540     _usec->setIntValue(u->tm_sec);
541     _uwday->setIntValue(u->tm_wday);
542     _udsec->setIntValue(u->tm_hour * 3600 + u->tm_min * 60 + u->tm_sec);
543
544     // real local date/time
545     time_t real = time(0);
546     struct tm *r = localtime(&real);
547     _ryear->setIntValue(r->tm_year + 1900);
548     _rmonth->setIntValue(r->tm_mon + 1);
549     _rday->setIntValue(r->tm_mday);
550     _rhour->setIntValue(r->tm_hour);
551     _rmin->setIntValue(r->tm_min);
552     _rsec->setIntValue(r->tm_sec);
553     _rwday->setIntValue(r->tm_wday);
554 }
555
556
557 \f
558 ////////////////////////////////////////////////////////////////////////
559 // Save and restore.
560 ////////////////////////////////////////////////////////////////////////
561
562
563 /**
564  * Save the current state of the simulator to a stream.
565  */
566 bool
567 fgSaveFlight (std::ostream &output, bool write_all)
568 {
569
570   fgSetBool("/sim/presets/onground", false);
571   fgSetArchivable("/sim/presets/onground");
572   fgSetBool("/sim/presets/trim", false);
573   fgSetArchivable("/sim/presets/trim");
574   fgSetString("/sim/presets/speed-set", "UVW");
575   fgSetArchivable("/sim/presets/speed-set");
576
577   try {
578     writeProperties(output, globals->get_props(), write_all);
579   } catch (const sg_exception &e) {
580     guiErrorMessage("Error saving flight: ", e);
581     return false;
582   }
583   return true;
584 }
585
586
587 /**
588  * Restore the current state of the simulator from a stream.
589  */
590 bool
591 fgLoadFlight (std::istream &input)
592 {
593   SGPropertyNode props;
594   try {
595     readProperties(input, &props);
596   } catch (const sg_exception &e) {
597     guiErrorMessage("Error reading saved flight: ", e);
598     return false;
599   }
600
601   fgSetBool("/sim/presets/onground", false);
602   fgSetBool("/sim/presets/trim", false);
603   fgSetString("/sim/presets/speed-set", "UVW");
604
605   copyProperties(&props, globals->get_props());
606
607   return true;
608 }
609
610
611 bool
612 fgLoadProps (const char * path, SGPropertyNode * props, bool in_fg_root, int default_mode)
613 {
614     string fullpath;
615     if (in_fg_root) {
616         SGPath loadpath(globals->get_fg_root());
617         loadpath.append(path);
618         fullpath = loadpath.str();
619     } else {
620         fullpath = path;
621     }
622
623     try {
624         readProperties(fullpath, props, default_mode);
625     } catch (const sg_exception &e) {
626         guiErrorMessage("Error reading properties: ", e);
627         return false;
628     }
629     return true;
630 }
631
632
633 \f
634 ////////////////////////////////////////////////////////////////////////
635 // Property convenience functions.
636 ////////////////////////////////////////////////////////////////////////
637
638 SGPropertyNode *
639 fgGetNode (const char * path, bool create)
640 {
641   return globals->get_props()->getNode(path, create);
642 }
643
644 SGPropertyNode * 
645 fgGetNode (const char * path, int index, bool create)
646 {
647   return globals->get_props()->getNode(path, index, create);
648 }
649
650 bool
651 fgHasNode (const char * path)
652 {
653   return (fgGetNode(path, false) != 0);
654 }
655
656 void
657 fgAddChangeListener (SGPropertyChangeListener * listener, const char * path)
658 {
659   fgGetNode(path, true)->addChangeListener(listener);
660 }
661
662 void
663 fgAddChangeListener (SGPropertyChangeListener * listener,
664                      const char * path, int index)
665 {
666   fgGetNode(path, index, true)->addChangeListener(listener);
667 }
668
669 bool
670 fgGetBool (const char * name, bool defaultValue)
671 {
672   return globals->get_props()->getBoolValue(name, defaultValue);
673 }
674
675 int
676 fgGetInt (const char * name, int defaultValue)
677 {
678   return globals->get_props()->getIntValue(name, defaultValue);
679 }
680
681 long
682 fgGetLong (const char * name, long defaultValue)
683 {
684   return globals->get_props()->getLongValue(name, defaultValue);
685 }
686
687 float
688 fgGetFloat (const char * name, float defaultValue)
689 {
690   return globals->get_props()->getFloatValue(name, defaultValue);
691 }
692
693 double
694 fgGetDouble (const char * name, double defaultValue)
695 {
696   return globals->get_props()->getDoubleValue(name, defaultValue);
697 }
698
699 const char *
700 fgGetString (const char * name, const char * defaultValue)
701 {
702   return globals->get_props()->getStringValue(name, defaultValue);
703 }
704
705 bool
706 fgSetBool (const char * name, bool val)
707 {
708   return globals->get_props()->setBoolValue(name, val);
709 }
710
711 bool
712 fgSetInt (const char * name, int val)
713 {
714   return globals->get_props()->setIntValue(name, val);
715 }
716
717 bool
718 fgSetLong (const char * name, long val)
719 {
720   return globals->get_props()->setLongValue(name, val);
721 }
722
723 bool
724 fgSetFloat (const char * name, float val)
725 {
726   return globals->get_props()->setFloatValue(name, val);
727 }
728
729 bool
730 fgSetDouble (const char * name, double val)
731 {
732   return globals->get_props()->setDoubleValue(name, val);
733 }
734
735 bool
736 fgSetString (const char * name, const char * val)
737 {
738   return globals->get_props()->setStringValue(name, val);
739 }
740
741 void
742 fgSetArchivable (const char * name, bool state)
743 {
744   SGPropertyNode * node = globals->get_props()->getNode(name);
745   if (node == 0)
746     SG_LOG(SG_GENERAL, SG_DEBUG,
747            "Attempt to set archive flag for non-existant property "
748            << name);
749   else
750     node->setAttribute(SGPropertyNode::ARCHIVE, state);
751 }
752
753 void
754 fgSetReadable (const char * name, bool state)
755 {
756   SGPropertyNode * node = globals->get_props()->getNode(name);
757   if (node == 0)
758     SG_LOG(SG_GENERAL, SG_DEBUG,
759            "Attempt to set read flag for non-existant property "
760            << name);
761   else
762     node->setAttribute(SGPropertyNode::READ, state);
763 }
764
765 void
766 fgSetWritable (const char * name, bool state)
767 {
768   SGPropertyNode * node = globals->get_props()->getNode(name);
769   if (node == 0)
770     SG_LOG(SG_GENERAL, SG_DEBUG,
771            "Attempt to set write flag for non-existant property "
772            << name);
773   else
774     node->setAttribute(SGPropertyNode::WRITE, state);
775 }
776
777 void
778 fgUntie(const char * name)
779 {
780   SGPropertyNode* node = globals->get_props()->getNode(name);
781   if (!node) {
782     SG_LOG(SG_GENERAL, SG_WARN, "fgUntie: unknown property " << name);
783     return;
784   }
785   
786   if (!node->isTied()) {
787     return;
788   }
789   
790   if (!node->untie()) {
791     SG_LOG(SG_GENERAL, SG_WARN, "Failed to untie property " << name);
792   }
793 }
794
795
796 // end of fg_props.cxx