| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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
29 class SoProto;
30 class SoInput;
31 class SoProtoInstance;
32 class SoProtoP;
33
34 typedef 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.
41 class COIN_DLL_API SoProto : public SoNode {
42 public:
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
73 protected:
74
75 virtual ~SoProto();
76 virtual void destroy(void);
77
78 private:
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

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