00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045
00046 #include <OSGConfig.h>
00047
00048 #include "OSGFCPtrAttributeMap.h"
00049
00050 OSG_USING_NAMESPACE
00051
00052
00053
00054
00055
00060
00061
00062
00063
00064
00065
00066
00067
00068 void FCPtrAttributeMap::initMethod (void)
00069 {
00070 }
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 FCPtrAttributeMap::FCPtrAttributeMap(void) :
00084 Inherited()
00085 {
00086 }
00087
00088 FCPtrAttributeMap::FCPtrAttributeMap(const FCPtrAttributeMap &source) :
00089 Inherited(source)
00090 {
00091 }
00092
00093 FCPtrAttributeMap::~FCPtrAttributeMap(void)
00094 {
00095 }
00096
00097
00098
00099 void FCPtrAttributeMap::changed(BitVector whichField, UInt32 origin)
00100 {
00101 Inherited::changed(whichField, origin);
00102 }
00103
00104 void FCPtrAttributeMap::dump( UInt32 ,
00105 const BitVector ) const
00106 {
00107 SLOG << "Dump FCPtrAttributeMap NI" << std::endl;
00108 }
00109
00120 void FCPtrAttributeMap::setAttribute(const std::string& key,
00121 FieldContainerPtr value)
00122 {
00123 MFString& keys = *this->FCPtrAttributeMapBase::editMFKeys();
00124 MFFieldContainerPtr& values = *this->FCPtrAttributeMapBase::editMFValues();
00125
00126 MFString::iterator i;
00127 unsigned int index(0);
00128
00129
00130
00131 for ( i = keys.begin(); i != keys.end(); ++i, ++index )
00132 {
00133 if ( *i == key )
00134 {
00135 values[index] = value;
00136 return;
00137 }
00138 }
00139
00140
00141
00142 keys.push_back(key);
00143 values.push_back(value);
00144 }
00145
00152 bool FCPtrAttributeMap::getAttribute(const std::string& key,
00153 FieldContainerPtr& value)
00154 const
00155 {
00156 if ( hasAttribute(key) )
00157 {
00158 const MFString& keys = *this->FCPtrAttributeMapBase::getMFKeys();
00159 const MFFieldContainerPtr& values =
00160 *this->FCPtrAttributeMapBase::getMFValues();
00161
00162
00163
00164 unsigned int index(0);
00165 MFString::const_iterator i;
00166 for ( i = keys.begin(); i != keys.end(); ++i, ++index )
00167 {
00168 if ( *i == key )
00169 {
00170
00171 value = values[index];
00172 return true;
00173 }
00174 }
00175 }
00176
00177
00178 return false;
00179 }
00180
00181
00182
00183
00184 OSG_BEGIN_NAMESPACE
00185
00195 FCPtrAttributeMapPtr fcptrAttributeMap(AttachmentContainerPtr container)
00196 {
00197 if ( NullFC == container )
00198 {
00199 FFATAL(("stringAttributeMap: no container?!?\n"));
00200 return NullFC;
00201 }
00202
00203 FCPtrAttributeMapPtr attr_map = NullFC;
00204 AttachmentPtr attach_ptr =
00205 container->findAttachment(FCPtrAttributeMap::getClassType().getGroupId());
00206
00207 if ( NullFC == attach_ptr )
00208 {
00209 attr_map = FCPtrAttributeMap::create();
00210 beginEditCP(container, AttachmentContainer::AttachmentsFieldMask);
00211 container->addAttachment(attr_map);
00212 endEditCP(container, AttachmentContainer::AttachmentsFieldMask);
00213 }
00214 else
00215 {
00216 attr_map = FCPtrAttributeMapPtr::dcast(attach_ptr);
00217
00218 if ( NullFC == attr_map )
00219 {
00220 FFATAL(("fcptrAttributeMap: FCPtrAttributeMap Attachment is not castable to FCPtrAttributeMap?!?\n"));
00221 return NullFC;
00222 }
00223 }
00224
00225 return attr_map;
00226 }
00227
00228 OSG_END_NAMESPACE
00229
00230
00231
00232
00233 #ifdef OSG_SGI_CC
00234 #pragma set woff 1174
00235 #endif
00236
00237 #ifdef OSG_LINUX_ICC
00238 #pragma warning( disable : 177 )
00239 #endif
00240
00241 namespace
00242 {
00243 static Char8 cvsid_cpp [] = "@(#)$Id: OSGFCPtrAttributeMap.cpp,v 1.3 2008/06/09 07:30:36 vossg Exp $";
00244 static Char8 cvsid_hpp [] = OSGFCPTRATTRIBUTEMAPBASE_HEADER_CVSID;
00245 static Char8 cvsid_inl [] = OSGFCPTRATTRIBUTEMAPBASE_INLINE_CVSID;
00246
00247 static Char8 cvsid_fields_hpp[] = OSGFCPTRATTRIBUTEMAPFIELDS_HEADER_CVSID;
00248 }
00249
00250 #ifdef __sgi
00251 #pragma reset woff 1174
00252 #endif
00253