Debian Codegraph @

lib/nodekits/src/details/SoNodeKitDetail.c++

raw
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 * Copyright (C) 1991 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Classes:
46 | SoNodeKitDetail
47 |
48 | Author(s) : Paul Isaacs
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54
55 #include <Inventor/details/SoNodeKitDetail.h>
56
57 #include <Inventor/nodekits/SoBaseKit.h>
58
59 SO_DETAIL_SOURCE(SoNodeKitDetail);
60
61 ////////////////////////////////////////////////////////////////////////
62 //
63 // Class: SoNodeKitDetail
64 //
65 ////////////////////////////////////////////////////////////////////////
66
67 ////////////////////////////////////////////////////////////////////////
68 //
69 // Class initialization
70 //
71 // SoINTERNAL public
72 //
73 void
74 SoNodeKitDetail::initClass()
75 //
76 ////////////////////////////////////////////////////////////////////////
77 {
78 SO_DETAIL_INIT_CLASS(SoNodeKitDetail, SoDetail);
79 }
80
81 ////////////////////////////////////////////////////////////////////////
82 //
83 // Description:
84 // Constructors.
85 //
86 // Use: public
87 //
88 ////////////////////////////////////////////////////////////////////////
89
90 SoNodeKitDetail::SoNodeKitDetail()
91 {
92 myNodeKit = NULL;
93 myPart = NULL;
94 myPartName = "";
95 }
96
97 ////////////////////////////////////////////////////////////////////////
98 //
99 // Description:
100 // Destructor
101 //
102 // Use: public
103
104 SoNodeKitDetail::~SoNodeKitDetail()
105 //
106 ////////////////////////////////////////////////////////////////////////
107 {
108 if ( myNodeKit )
109 myNodeKit->unref();
110 if ( myPart )
111 myPart->unref();
112 }
113
114 ////////////////////////////////////////////////////////////////////////
115 //
116 // Description:
117 // Returns an instance that is a copy of this instance. The caller
118 // is responsible for deleting the copy when done.
119 //
120 // Use: public, virtual
121 //
122
123 SoDetail *
124 SoNodeKitDetail::copy() const
125 //
126 ////////////////////////////////////////////////////////////////////////
127 {
128 SoNodeKitDetail *newDetail = new SoNodeKitDetail;
129
130 newDetail->myNodeKit = myNodeKit;
131 newDetail->myPart = myPart;
132 newDetail->myPartName = myPartName;
133
134 if (myNodeKit != NULL)
135 myNodeKit->ref();
136 if (myPart != NULL)
137 myPart->ref();
138
139 return newDetail;
140 }
141
142 ////////////////////////////////////////////////////////////////////////
143 //
144 // Description:
145 // Set the the nodekit.
146 //
147 void
148 SoNodeKitDetail::setNodeKit( SoBaseKit *theNodeKit )
149 //
150 ////////////////////////////////////////////////////////////////////////
151 {
152 theNodeKit->ref();
153 if ( myNodeKit )
154 myNodeKit->unref();
155 myNodeKit = theNodeKit;
156 }
157
158 ////////////////////////////////////////////////////////////////////////
159 //
160 // Description:
161 // Set the the part node within the nodekit.
162 //
163 void
164 SoNodeKitDetail::setPart( SoNode *thePart )
165 //
166 ////////////////////////////////////////////////////////////////////////
167 {
168 thePart->ref();
169 if ( myPart )
170 myPart->unref();
171 myPart = thePart;
172 }