Open Inventor Reference
SoNotification.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91,92 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | Definition of (internal) SoNotRec and SoNotList classes, which
48 | handle notification propagation through instances of classes
49 | derived from SoBase.
50 |
51 | Author(s) : Paul S. Strauss, Nick Thompson
52 |
53 ______________ S I L I C O N G R A P H I C S I N C . ____________
54 _______________________________________________________________________
55 */
56
57#ifndef _SO_NOTIFICATION_
58#define _SO_NOTIFICATION_
59
60#include <Inventor/SbBasic.h>
61
62class SoBase;
63class SoField;
64
96
98
99 public:
100
106 enum Type {
111 ENGINE
112 };
113
115 SoNotRec(SoBase *b) { base = b; }
116
118 void setType(SoNotRec::Type t) { type = t; }
119
121 SoBase * getBase() const { return base; }
122 SoNotRec::Type getType() const { return type; }
123 const SoNotRec * getPrevious() const { return previous; }
124
126 void setPrevious(SoNotRec *prev) { previous = prev; }
127
129 void print(FILE *fp) const;
130
131 private:
132
133 SoBase *base;
134 Type type;
135 const SoNotRec *previous;
136};
137
152
154
155 public:
158
160 SoNotList(const SoNotList *copyFrom) { *this = *copyFrom; }
161
163 void append(SoNotRec *rec);
164
167 void append(SoNotRec *rec, SoField *field);
168
171 {
172 last->setType(t);
175 if (t == SoNotRec::FIELD || t == SoNotRec::ENGINE)
176 firstAtNode = NULL;
177 }
178
180 SoNotRec * getFirstRec() const { return first; }
181 SoNotRec * getLastRec() const { return last; }
182
187 SoNotRec * getFirstRecAtNode() const { return firstAtNode; }
188
191 SoField * getLastField() const { return lastField; }
192
195 SbNodeIdType getTimeStamp() const { return timeStamp; }
196
198 void print(FILE *fp) const;
199
200 private:
201 SoNotRec *first, *last;
202 SoNotRec *firstAtNode;
203 SoField *lastField;
204 SbNodeIdType timeStamp;
205};
206
207#endif /* _SO_NOTIFICATION_ */
#define SoINTERNAL
Definition SbBasic.h:155
size_t SbNodeIdType
Type of unique ids of SoNode, used in the notification/change detection handling.
Definition SbBasic.h:90
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
Base class for all nodes, paths, and engines.
Definition SoBase.h:90
Base class for all fields.
Definition SoField.h:185
Holds a list of SoNotRec notification records.
SoNotRec * getLastRec() const
SoNotRec * getFirstRec() const
Returns first and last records in list.
SoField * getLastField() const
Returns last field set by notification (or NULL if notification did not originate at or propagate thr...
SoNotList()
Constructor.
SoNotList(const SoNotList *copyFrom)
Copy constructor.
void append(SoNotRec *rec, SoField *field)
Appends given (container) field record to end of list.
SbNodeIdType getTimeStamp() const
Returns the time stamp so nodes can check if notification has already been handled.
void setLastType(SoNotRec::Type t)
Sets the type of the last (current) record in the list.
void append(SoNotRec *rec)
Appends given non-field record to end of list.
SoNotRec * getFirstRecAtNode() const
Returns first record in list that has a node base in the current chain of node-to-node notification.
void print(FILE *fp) const
Prints a notification list for debugging.
Records one step in the path taken by notification.
void setType(SoNotRec::Type t)
Sets notification type.
const SoNotRec * getPrevious() const
void print(FILE *fp) const
Prints a notification record for debugging.
Type
Notification types (what receives notification).
@ FIELD
Field notifying connected field.
@ ENGINE
Engine notifying connected field.
@ PARENT
Child node notifying parent.
@ CONTAINER
Field notifying container.
@ SENSOR
Some base notifying sensor.
void setPrevious(SoNotRec *prev)
Sets previous record pointer.
SoNotRec(SoBase *b)
Constructor - passed the base pointer.
SoNotRec::Type getType() const
SoBase * getBase() const
Returns base pointer, type, or previous record in list.