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 
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
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:36
The SoOutput class is an abstraction of an output stream.SoOutput offers the ability to write basic t...
Definition: SoOutput.h:42
The SoFieldContainer class is a base class for all classes that contain fields.The classes containing...
Definition: SoFieldContainer.h:34
virtual SoType getTypeId(void) const =0
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
The SoProtoInstance class handles PROTO instances.
Definition: SoProtoInstance.h:37
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition: SoNode.cpp:1466
The SoProto class handles PROTO definitions.
Definition: SoProto.h:41
virtual void destroy(void)
Definition: SoBase.cpp:286
The SoWriteAction class writes a scene graph to file.When applied to a scene, this action writes its ...
Definition: SoWriteAction.h:33
The SoInput class is an abstraction of file import functionality.This class takes care of most of the...
Definition: SoInput.h:52
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the &quot;bookkeeping&quot; tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:42
The SoType class is the basis for the run-time type system in Coin.Many of the classes in the Coin li...
Definition: SoType.h:50
virtual void write(SoWriteAction *action)
Definition: SoNode.cpp:1217
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:31

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

Generated on Fri Sep 9 2016 for Coin by Doxygen 1.8.5.