![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SOPROTO_H 00002 #define COIN_SOPROTO_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/nodes/SoNode.h> 00028 00029 class SoProto; 00030 class SoInput; 00031 class SoProtoInstance; 00032 class SoProtoP; 00033 00034 typedef SoProto * SoFetchExternProtoCB(SoInput * in, 00035 const SbString * urls, 00036 const int numurls, 00037 void * closure); 00038 00039 // We need to inherit SoNode to be able to insert the PROTO definition 00040 // into the scene graph. 00041 class COIN_DLL_API SoProto : public SoNode { 00042 public: 00043 SoProto(const SbBool externproto = FALSE); 00044 00045 static void setFetchExternProtoCallback(SoFetchExternProtoCB * cb, 00046 void * closure); 00047 00048 virtual SoType getTypeId(void) const; 00049 static SoType getClassTypeId(void); 00050 00051 static SoProto * findProto(const SbName & name); 00052 static void initClass(void); 00053 00054 SoProtoInstance * createProtoInstance(void); 00055 void addISReference(SoNode * container, 00056 const SbName & fieldname, 00057 const SbName & interfacename); 00058 SbName findISReference(const SoFieldContainer * container, 00059 const SbName & fieldname); 00060 00061 void addReference(const SbName & name, SoBase * base); 00062 void removeReference(const SbName & name); 00063 SoBase * findReference(const SbName & name) const; 00064 00065 void addRoute(const SbName & fromnode, const SbName & fromfield, 00066 const SbName & tonode, const SbName & tofield); 00067 00068 SbName getProtoName(void) const; 00069 00070 virtual SbBool readInstance(SoInput * input, unsigned short flags); 00071 virtual void write(SoWriteAction * action); 00072 00073 protected: 00074 00075 virtual ~SoProto(); 00076 virtual void destroy(void); 00077 00078 private: 00079 SbBool writeInterface(SoOutput * out); 00080 SbBool writeDefinition(SoWriteAction * action); 00081 00082 SbBool readInterface(SoInput * in); 00083 SbBool readDefinition(SoInput * in); 00084 00085 SbBool writeURLs(SoOutput * out); 00086 SoProtoP * pimpl; 00087 friend class SoProtoP; 00088 00089 SbBool setupExtern(SoInput * in, SoProto * externproto); 00090 00091 SoNode * createInstanceRoot(SoProtoInstance * inst) const; 00092 void connectISRefs(SoProtoInstance * inst, SoNode * src, SoNode * dst) const; 00093 }; 00094 00095 #endif // !COIN_SOPROTO_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Thu Apr 28 2011 03:43:06 for Coin by Doxygen 1.7.4.