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
54 SoProtoInstance * createProtoInstance(void);
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
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition SoBase.h:36
virtual SoType getTypeId(void) const =0
virtual void destroy(void)
Definition SoBase.cpp:286
The SoFieldContainer class is a base class for all classes that contain fields.
Definition SoFieldContainer.h:34
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:52
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:47
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
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 17 2024 for Coin by Doxygen 1.12.0.