1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #include "OSGOSBNameElement.h"
41 #include "OSGOSBRootElement.h"
42 #include "OSGNameAttachment.h"
46 /*-------------------------------------------------------------------------*/
48 /*-------------------------------------------------------------------------*/
50 /*-------------------------------------------------------------------------*/
53 OSBElementRegistrationHelper
<OSBNameElement
>
54 OSBNameElement::_regHelper
=
55 OSBElementRegistrationHelper
<OSBNameElement
>("Name");
57 /*-------------------------------------------------------------------------*/
60 OSBNameElement::OSBNameElement(OSBRootElement
*root
)
61 : Inherited(root
, OSGOSBHeaderVersion200
)
65 /*-------------------------------------------------------------------------*/
68 OSBNameElement::~OSBNameElement(void)
72 /*-------------------------------------------------------------------------*/
76 OSBNameElement::read(const std::string
&typeName
)
78 OSG_OSB_LOG(("OSBNameElement::read [%s]\n", typeName
.c_str()));
80 BinaryReadHandler
*rh
= editRoot()->getReadHandler();
84 rh
->getValue(fcPtrType
);
85 rh
->getValue(version
);
87 setContainer(NameUnrecPtr(Name::create()));
92 OSBNameElement::postRead(void)
96 /*-------------------------------------------------------------------------*/
100 OSBNameElement::preWrite(FieldContainer
* const fc
)
102 OSG_OSB_LOG(("OSBNameElement::preWrite\n"));
104 preWriteFieldContainer(fc
, "");
108 OSBNameElement::write(void)
110 OSG_OSB_LOG(("OSBNameElement::write\n"));
112 if(getContainer() == NULL
)
114 FWARNING(("OSBNameElement::write: Attempt to write NULL.\n"));
118 BinaryWriteHandler
*wh
= editRoot()->getWriteHandler();
120 wh
->putValue(getFCPtrType(getContainer()));
121 wh
->putValue(getVersion() );
123 writeFields("", true);