| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- // Filename: nodeAttributeWrapper.I
- // Created by: drose (20Mar00)
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH NodeAttributeWrapper::
- NodeAttributeWrapper(TypeHandle handle) : _handle(handle) {
- nassertv(_handle != TypeHandle::none());
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH NodeAttributeWrapper::
- NodeAttributeWrapper(const NodeAttributeWrapper ©) :
- _handle(copy._handle),
- _attrib(copy._attrib)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::Copy Assignment Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH void NodeAttributeWrapper::
- operator = (const NodeAttributeWrapper ©) {
- _handle = copy._handle;
- _attrib = copy._attrib;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::get_handle
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH TypeHandle NodeAttributeWrapper::
- get_handle() const {
- return _handle;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::get_attrib
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH NodeAttribute *NodeAttributeWrapper::
- get_attrib() const {
- return _attrib;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::set_attrib
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH void NodeAttributeWrapper::
- set_attrib(NodeAttribute *attrib) {
- _attrib = attrib;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::is_initial
- // Access: Public
- // Description: Returns true if the wrapper represents an initial
- // attribute.
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH bool NodeAttributeWrapper::
- is_initial() const {
- return (_attrib == (NodeAttribute *)NULL);
- // || _attrib->is_initial()
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::compare_to
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH int NodeAttributeWrapper::
- compare_to(const NodeAttributeWrapper &other) const {
- nassertr(_handle == other._handle, false);
- if (_attrib == other._attrib) {
- return 0;
- }
- if (_attrib == (NodeAttribute *)NULL) {
- return -1;
- }
- if (other._attrib == (NodeAttribute *)NULL) {
- return 1;
- }
- return _attrib->compare_to(*other._attrib);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: NodeAttributeWrapper::make_initial
- // Access: Public
- // Description: Resets the wrapper to the initial attribute.
- ////////////////////////////////////////////////////////////////////
- INLINE_GRAPH void NodeAttributeWrapper::
- make_initial() {
- _attrib.clear();
- }
- INLINE_GRAPH ostream &operator << (ostream &out, const NodeAttributeWrapper &naw) {
- naw.output(out);
- return out;
- }
|