Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoProto.h
1#ifndef COIN_SOPROTO_H
2#define COIN_SOPROTO_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/nodes/SoNode.h>
28
29class SoProto;
30class SoInput;
31class SoProtoInstance;
32class SoProtoP;
33
34typedef SoProto * SoFetchExternProtoCB(SoInput * in,
35 const SbString * urls,
36 const int numurls,
37 void * closure);
38
39// We need to inherit SoNode to be able to insert the PROTO definition
40// into the scene graph.
41class COIN_DLL_API SoProto : public SoNode {
42public:
43 SoProto(const SbBool externproto = FALSE);
44
45 static void setFetchExternProtoCallback(SoFetchExternProtoCB * cb,
46 void * closure);
47
48 virtual SoType getTypeId(void) const;
49 static SoType getClassTypeId(void);
50
51 static SoProto * findProto(const SbName & name);
52 static void initClass(void);
53
55 void addISReference(SoNode * container,
56 const SbName & fieldname,
57 const SbName & interfacename);
58 SbName findISReference(const SoFieldContainer * container,
59 const SbName & fieldname);
60
61 void addReference(const SbName & name, SoBase * base);
62 void removeReference(const SbName & name);
63 SoBase * findReference(const SbName & name) const;
64
65 void addRoute(const SbName & fromnode, const SbName & fromfield,
66 const SbName & tonode, const SbName & tofield);
67
68 SbName getProtoName(void) const;
69
70 virtual SbBool readInstance(SoInput * input, unsigned short flags);
71 virtual void write(SoWriteAction * action);
72
73protected:
74
75 virtual ~SoProto();
76 virtual void destroy(void);
77
78private:
79 SbBool writeInterface(SoOutput * out);
80 SbBool writeDefinition(SoWriteAction * action);
81
82 SbBool readInterface(SoInput * in);
83 SbBool readDefinition(SoInput * in);
84
85 SbBool writeURLs(SoOutput * out);
86 SoProtoP * pimpl;
87 friend class SoProtoP;
88
89 SbBool setupExtern(SoInput * in, SoProto * externproto);
90
91 SoNode * createInstanceRoot(SoProtoInstance * inst) const;
92 void connectISRefs(SoProtoInstance * inst, SoNode * src, SoNode * dst) const;
93};
94
95#endif // !COIN_SOPROTO_H
The SbName class stores strings by reference.
Definition SbName.h:31
The SbString class is a string class with convenience functions for string operations.
Definition SbString.h:42
SoBase(void)
Definition SoBase.cpp:179
static SoType getClassTypeId(void)
Definition SoBase.cpp:616
static void initClass(void)
Definition SoBase.cpp:338
virtual SoType getTypeId(void) const =0
virtual void destroy(void)
Definition SoBase.cpp:286
SoFieldContainer(void)
Definition SoFieldContainer.cpp:123
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:52
SoNode(void)
Definition SoNode.cpp:350
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition SoNode.cpp:1466
virtual void write(SoWriteAction *action)
Definition SoNode.cpp:1217
The SoOutput class is an abstraction of an output stream.
Definition SoOutput.h:42
The SoProtoInstance class handles PROTO instances.
Definition SoProtoInstance.h:37
The SoProto class handles PROTO definitions.
Definition SoProto.h:41
SoProto(const SbBool externproto=FALSE)
Definition SoProto.cpp:261
void addRoute(const SbName &fromnode, const SbName &fromfield, const SbName &tonode, const SbName &tofield)
Definition SoProto.cpp:679
static SoProto * findProto(const SbName &name)
Definition SoProto.cpp:315
SbName findISReference(const SoFieldContainer *container, const SbName &fieldname)
Definition SoProto.cpp:633
void removeReference(const SbName &name)
Definition SoProto.cpp:658
void addReference(const SbName &name, SoBase *base)
Definition SoProto.cpp:649
SoProtoInstance * createProtoInstance(void)
Definition SoProto.cpp:334
void addISReference(SoNode *container, const SbName &fieldname, const SbName &interfacename)
Definition SoProto.cpp:617
SbName getProtoName(void) const
Definition SoProto.cpp:349
SoBase * findReference(const SbName &name) const
Definition SoProto.cpp:667
The SoType class is the basis for the run-time type system in Coin.
Definition SoType.h:50
The SoWriteAction class writes a scene graph to file.
Definition SoWriteAction.h:33

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 23 2025 for Coin by Doxygen 1.14.0.