| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- // Filename: nodeAttribute.I
- // Created by: drose (20Mar00)
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE NodeAttribute::
- NodeAttribute() {
- _priority = 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE NodeAttribute::
- NodeAttribute(const NodeAttribute ©) :
- TypedReferenceCount(copy),
- _priority(copy._priority)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Copy Assignment Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE void NodeAttribute::
- operator = (const NodeAttribute ©) {
- TypedReferenceCount::operator = (copy);
- _priority = copy._priority;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Equality Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool NodeAttribute::
- operator == (const NodeAttribute &other) const {
- return compare_to(other) == 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Inequality Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool NodeAttribute::
- operator != (const NodeAttribute &other) const {
- return compare_to(other) != 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Inequality Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool NodeAttribute::
- operator < (const NodeAttribute &other) const {
- return compare_to(other) < 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Inequality Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool NodeAttribute::
- operator <= (const NodeAttribute &other) const {
- return compare_to(other) <= 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Inequality Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool NodeAttribute::
- operator > (const NodeAttribute &other) const {
- return compare_to(other) > 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::Inequality Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE bool NodeAttribute::
- operator >= (const NodeAttribute &other) const {
- return compare_to(other) >= 0;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::compare_to
- // Access: Public
- // Description: This function works like strcmp(): it compares the
- // two attributes and returns a number less than zero
- // if this attribute sorts before the other one, equal
- // to zero if they are equivalent, or greater than zero
- // if this attribute sorts after the other one.
- //
- // This imposes an arbitrary sorting order across all
- // attributes, whose sole purpose is to allow grouping
- // of equivalent attributes together in STL structures
- // like maps and sets.
- ////////////////////////////////////////////////////////////////////
- INLINE int NodeAttribute::
- compare_to(const NodeAttribute &other) const {
- TypeHandle my_handle = get_handle();
- TypeHandle other_handle = other.get_handle();
- if (my_handle == other_handle) {
- return internal_compare_to(&other);
- } else {
- return
- (my_handle < other_handle) ? -1 : 1;
- }
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::set_priority
- // Access: Public
- // Description: Changes the priority associated with this attribute.
- // The attribute will not be affected by transitions
- // with a lower priority.
- ////////////////////////////////////////////////////////////////////
- INLINE void NodeAttribute::
- set_priority(int priority) {
- _priority = priority;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttribute::get_priority
- // Access: Public
- // Description: Returns the priority associated with this attribute.
- // Normally this is of limited value; the priority is
- // meaningful primarily on the transitions.
- ////////////////////////////////////////////////////////////////////
- INLINE int NodeAttribute::
- get_priority() const {
- return _priority;
- }
|