Panda3D

findApproxPath.I

00001 // Filename: findApproxPath.I
00002 // Created by:  drose (13Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: FindApproxPath::Constructor
00018 //       Access: Public
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE FindApproxPath::
00022 FindApproxPath() {
00023   _return_hidden = true;
00024   _return_stashed = false;
00025   _case_insensitive = false;
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: FindApproxPath::get_num_components
00030 //       Access: Public
00031 //  Description: Returns the number of components in the path.
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE int FindApproxPath::
00034 get_num_components() const {
00035   return _path.size();
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: FindApproxPath::is_component_match_many
00040 //       Access: Public
00041 //  Description: Returns true if the nth component is of type
00042 //               match_many, which will require special handling.
00043 ////////////////////////////////////////////////////////////////////
00044 INLINE bool FindApproxPath::
00045 is_component_match_many(int index) const {
00046   nassertr(index >= 0 && index < (int)_path.size(), false);
00047   return (_path[index]._type == CT_match_many);
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: FindApproxPath::matches_component
00052 //       Access: Public
00053 //  Description: Returns true if the nth component of the path matches
00054 //               the indicated node, false otherwise.
00055 ////////////////////////////////////////////////////////////////////
00056 INLINE bool FindApproxPath::
00057 matches_component(int index, PandaNode *node) const {
00058   nassertr(index >= 0 && index < (int)_path.size(), false);
00059   return (_path[index].matches(node));
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: FindApproxPath::matches_stashed
00064 //       Access: Public
00065 //  Description: Returns true if the nth component of the path matches
00066 //               a stashed node only, false otherwise.
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE bool FindApproxPath::
00069 matches_stashed(int index) const {
00070   if (index >= 0 && index < (int)_path.size()) {
00071     return ((_path[index]._flags & CF_stashed) != 0);
00072   } else {
00073     return false;
00074   }
00075 }
00076 
00077 ////////////////////////////////////////////////////////////////////
00078 //     Function: FindApproxPath::return_hidden
00079 //       Access: Public
00080 //  Description: Returns true if this path allows returning of hidden
00081 //               nodes, false otherwise.
00082 ////////////////////////////////////////////////////////////////////
00083 INLINE bool FindApproxPath::
00084 return_hidden() const {
00085   return _return_hidden;
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: FindApproxPath::return_stashed
00090 //       Access: Public
00091 //  Description: Returns true if this path allows returning of stashed
00092 //               nodes, false otherwise.
00093 ////////////////////////////////////////////////////////////////////
00094 INLINE bool FindApproxPath::
00095 return_stashed() const {
00096   return _return_stashed;
00097 }
00098 
00099 ////////////////////////////////////////////////////////////////////
00100 //     Function: FindApproxPath::case_insensitive
00101 //       Access: Public
00102 //  Description: Returns true if the search is case-insensitive, false
00103 //               if it is case-sensitive.
00104 ////////////////////////////////////////////////////////////////////
00105 INLINE bool FindApproxPath::
00106 case_insensitive() const {
00107   return _case_insensitive;
00108 }
00109 
00110 ////////////////////////////////////////////////////////////////////
00111 //     Function: FindApproxPath::output_component
00112 //       Access: Public
00113 //  Description: Formats the nth component of the path to the
00114 //               indicated output stream.
00115 ////////////////////////////////////////////////////////////////////
00116 INLINE void FindApproxPath::
00117 output_component(ostream &out, int index) const {
00118   nassertv(index >= 0 && index < (int)_path.size());
00119   out << _path[index];
00120 }
 All Classes Functions Variables Enumerations