fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FieldContainer / Field / OSGAspectIdFieldTraits.h
blob34282c34d708d5d3ef9ca5cd36fc4bdb9b863103
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2003 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGASPECTIDFIELDTRAITS_H_
40 #define _OSGASPECTIDFIELDTRAITS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGSystemDef.h"
46 #include "OSGSysFieldTraits.h"
47 #include "OSGAspectPool.h"
49 OSG_BEGIN_NAMESPACE
51 /*! \ingroup GrpBaseFieldTraits
52 \ingroup GrpLibOSGBase
55 template <>
56 struct FieldTraits<AspectId, 2> :
57 public FieldTraitsPODTemplateBase<AspectId, 2>
59 private:
61 static DataType _type;
63 public:
65 typedef FieldTraits<AspectId, 2> Self;
67 enum { Convertible = (Self::ToStreamConvertible |
68 Self::FromStringConvertible) };
70 static OSG_SYSTEM_DLLMAPPING
71 DataType &getType (void);
73 static const Char8 *getSName(void) { return "SFAspectId"; }
75 static const Char8 *getMName(void) { return "MFAspectId"; }
77 static BitVector getDefault(void) { return AspectId(); }
79 static void putToStream(const AspectId &val,
80 OutStream &str)
82 FieldTraits<UInt32>::putToStream(val, str);
85 static bool getFromCString( AspectId &outVal,
86 const Char8 *&inVal )
88 outVal = 0;
90 if(inVal[0] == '\0')
91 return false;
93 if(inVal[0] >= '0' && inVal[0] <= '9')
95 FieldTraits<UInt32>::getFromCString(outVal, inVal);
97 return true;
100 outVal = AspectPool::the()->get(inVal);
102 return true;
106 #ifndef DOXYGEN_SHOULD_SKIP_THIS
108 /*! \ingroup GrpBaseFieldSingle */
109 typedef SField<AspectId, 2> SFAspectId;
111 #else
113 /*! \ingroup GrpBaseFieldSingle \ingroup GrpLibOSGBase */
114 struct SFAspectId : public SField<AspectId, 2> {};
116 #endif
118 OSG_END_NAMESPACE
120 #endif /* _OSGASPECTIDFIELDTRAITS_H_ */