00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 //--------------------------------------------------------------------------- 00040 // Includes 00041 //--------------------------------------------------------------------------- 00042 00043 #include <stdlib.h> 00044 #include <stdio.h> 00045 00046 #include "OSGConfig.h" 00047 #include "OSGConnection.h" 00048 #include "OSGConnectionType.h" 00049 #include "OSGConnectionFactory.h" 00050 00051 OSG_USING_NAMESPACE 00052 00059 /*-------------------------------------------------------------------------*/ 00060 /* Constructors */ 00061 00066 ConnectionType::ConnectionType( CreateGroupFunction createGroup, 00067 const std::string &name ) : 00068 _createGroup(createGroup), 00069 _createPoint(NULL), 00070 _name(name) 00071 { 00072 ConnectionFactory::the().addGroupType(this); 00073 } 00074 00079 ConnectionType::ConnectionType( CreatePointFunction createPoint, 00080 const std::string &name ) : 00081 _createGroup(NULL), 00082 _createPoint(createPoint), 00083 _name(name) 00084 { 00085 ConnectionFactory::the().addPointType(this); 00086 } 00087 00088 /*-------------------------------------------------------------------------*/ 00089 /* Destructor */ 00090 00093 ConnectionType::~ConnectionType(void) 00094 { 00095 if(_createGroup) 00096 ConnectionFactory::the().subGroupType(this); 00097 if(_createPoint) 00098 ConnectionFactory::the().subPointType(this); 00099 } 00100 00101 /*-------------------------------------------------------------------------*/ 00102 /* Assignment */ 00103 00106 ConnectionType& ConnectionType::operator = (const ConnectionType &source) 00107 { 00108 if(this == &source) 00109 return *this; 00110 00111 _name = source._name; 00112 _createGroup = source._createGroup; 00113 _createPoint = source._createPoint; 00114 return *this; 00115 } 00116 00117 /*-------------------------------------------------------------------------*/ 00118 /* Comparison */ 00119 00122 bool ConnectionType::operator < (const ConnectionType &other) const 00123 { 00124 return _name < other._name; 00125 } 00126 00129 bool ConnectionType::operator == (const ConnectionType &other) const 00130 { 00131 return _name == other._name; 00132 } 00133 00136 bool ConnectionType::operator != (const ConnectionType &other) const 00137 { 00138 return ! (*this == other); 00139 } 00140 00141 00142 /*-------------------------------------------------------------------------*/ 00143 /* get */ 00144 00147 std::string ConnectionType::getName(void) const 00148 { 00149 return _name; 00150 } 00151 00154 ConnectionType::CreateGroupFunction ConnectionType::getCreateGroup(void) const 00155 { 00156 return _createGroup; 00157 } 00158 00161 ConnectionType::CreatePointFunction ConnectionType::getCreatePoint(void) const 00162 { 00163 return _createPoint; 00164 } 00165 00166 /*-------------------------------------------------------------------------*/ 00167 /* creation */ 00168 00171 GroupConnection *ConnectionType::createGroup(void) 00172 { 00173 return _createGroup(); 00174 } 00175 00178 PointConnection *ConnectionType::createPoint(void) 00179 { 00180 return _createPoint(); 00181 } 00182 00183 00184 /*-------------------------------------------------------------------------*/ 00185 /* cvs id's */ 00186 00187 #ifdef __sgi 00188 #pragma set woff 1174 00189 #endif 00190 00191 #ifdef OSG_LINUX_ICC 00192 #pragma warning( disable : 177 ) 00193 #endif 00194 00195 namespace 00196 { 00197 static Char8 cvsid_cpp[] = "@(#)$Id:$"; 00198 static Char8 cvsid_hpp[] = OSG_CONNECTIONTYPEHEADER_CVSID; 00199 }
1.4.3