/usr/include/VTKEdge/vtkKWEXMLArchiveWriter.h is in libvtkedge-dev 0.2.0~20110819-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | //=============================================================================
// This file is part of VTKEdge. See vtkedge.org for more information.
//
// Copyright (c) 2010 Kitware, Inc.
//
// VTKEdge may be used under the terms of the BSD License
// Please see the file Copyright.txt in the root directory of
// VTKEdge for further information.
//
// Alternatively, you may see:
//
// http://www.vtkedge.org/vtkedge/project/license.html
//
//
// For custom extensions, consulting services, or training for
// this or any other Kitware supported open source project, please
// contact Kitware at sales@kitware.com.
//
//
//=============================================================================
// .NAME vtkKWEXMLArchiveWriter - Writes an XML archive to output stream
// .SECTION Description
// Given a vector of vtkObject, vtkKWEXMLArchiveWriter writes
// the object graph in an XML format. Note, to be written an object
// must either be a subclass of vtkSerializableObject or have a helper
// registered with vtkKWESerializationHelperMap which knows how to
// serialize the object type. All objects are written in a flat collection
// under the root element. All references to these objects are stored using
// elements of type Pointer. All objects in the input vector are stored under
// a RootObjects element. For example:
// \code
// <ConceptualModel version="1">
// <RootObjects>
// <Item type="Pointer" to_id="1"/>
// </RootObjects>
// <Object type="vtkCmbShell" id="1">
// <Properties type="vtkInformation">
// <vtkConceptualModelItem::COLOR values="0 0 0 0" length="4"/>
// </Properties>
// <Associations type="vtkObjectVectorMap">
// <Key_1 type="vtkObjectVector">
// <Item type="Pointer" to_id="2"/>
// </Key_1>
// </Associations>
// </Object>
// <Object type="vtkCmbModelFaceUse" id="2">
// <Properties type="vtkInformation">
// <vtkConceptualModelItem::COLOR values="1 0 0 0" length="4"/>
// </Properties>
// <Associations type="vtkObjectVectorMap">
// <Key_0 type="vtkObjectVector">
// <Item type="Pointer" to_id="1"/>
// </Key_0>
// </Associations>
// </Object>
// </ConceptualModel>
// \endcode
// .SECTION See Also
// vtkKWESerializer
#ifndef __vtkKWEXMLArchiveWriter_h
#define __vtkKWEXMLArchiveWriter_h
#include "vtkKWESerializer.h"
#include "VTKEdgeConfigure.h" // include configuration header
#include <vtkstd/vector> // Vector of smart pointers
#include "vtkSmartPointer.h" // Vector of smart pointers
//BTX
struct vtkKWEXMLArchiveWriterInternals;
class vtkKWEXMLElement;
//ETX
class VTKEdge_IO_EXPORT vtkKWEXMLArchiveWriter : public vtkKWESerializer
{
public:
static vtkKWEXMLArchiveWriter *New();
vtkTypeRevisionMacro(vtkKWEXMLArchiveWriter,vtkKWESerializer);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// This method returns true if the serializer is an output
// serializer (writer). Returns true.
virtual bool IsWriting() {return true;}
// Description:
// This is the main entry point used to write a vector of
// objects to the XML archive. The rootName is the name
// of the root XML element in the archive. This name is
// not used when restoring the archive so it is for information
// only. For example:
// \code
// vtkKWEObjectTreeTransformableNode *root =
// vtkKWEObjectTreeTransformableNode::New();
// root->SetName("RootNode");
//
// vtkKWEObjectTreeTransformableNode *child =
// vtkKWEObjectTreeTransformableNode::New();
// root->SetName("Child Node");
// root->AddChild( child );
//
// vtkSmartPointer<vtkKWEXMLArchiveWriter> writer =
// vtkSmartPointer<vtkKWEXMLArchiveWriter>::New();
// vtksys_ios::ostringstream ostr;
// writer->SetArchiveVersion(1);
// vtkstd::vector<vtkSmartPointer<vtkObject> > objs;
// objs.push_back(root);
// writer->Serialize(ostr, "ObjectTree", objs);
// \endcode
virtual void Serialize(ostream& ostr, const char* rootName,
vtkstd::vector<vtkSmartPointer<vtkObject> >& objs);
// Description:
// Additional entry point, used to write a vector of
// objects to the XML archive, in the form of a vtkKWEXMLElement which
// is assumed to have been allocated by the caller.
virtual void Serialize(vtkKWEXMLElement* elem, const char* rootName,
vtkstd::vector<vtkSmartPointer<vtkObject> >& objs);
// Description:
// Additional entry point, used to write a single (root) object
// to the XML archive, in the form of a vtkKWEXMLElement which
// is assumed to have been allocated by the caller.
virtual void Serialize(vtkKWEXMLElement* elem, const char* rootName,
vtkObject *objs);
// Description:
// Serializes a single integer.
virtual void Serialize(const char* name, int& val);
// Description:
// Serializes an array.
virtual void Serialize(const char* name, int*& val, unsigned int& length);
// Description:
// Serializes a single unsigned long.
virtual void Serialize(const char* name, unsigned long& val) ;
// Description:
// Serializes an array.
virtual void Serialize(const char* name, unsigned long*& val, unsigned int& length);
// Description:
// Reads a single vtkIdType.
#if defined(VTK_USE_64BIT_IDS)
virtual void Serialize(const char* name, vtkIdType& val);
#endif
// Description:
// Reads an array.
#if defined(VTK_USE_64BIT_IDS)
virtual void Serialize(const char* name, vtkIdType*& val, unsigned int& length);
#endif
// Description:
// Serializes a single double.
virtual void Serialize(const char* name, double& val);
// Description:
// Serializes an array.
virtual void Serialize(const char* name, double*& val, unsigned int& length);
// Description:
// Serializes a string.
virtual void Serialize(const char* name, char*& str);
// Description:
// Serializes a string.
virtual void Serialize(const char* name, vtkstd::string& str);
// Description:
// Serializes a vtkObject. Note, the object must either be subclass of
// vtkKWESerializableObject or have a helper registered with
// vtkKWESerializableObjectManager which knows how to serialize the object
// type. The weakPtr parameter is actually ignored (we don't write an
// attribute indicating it is weak, if it is) because the reading code will
// have the same parameter specifying the pointer is weak. Here for symmetry.
virtual void Serialize(const char* name, vtkObject*& object, bool weakPtr = false);
// Description:
// Serializes a vtkInformationObject.
virtual void Serialize(const char* name, vtkInformation* info);
// Description:
// Serializes a vector of vtkObjects. The weakPtr parameter
// is actually ignored (we don't write an attribute indicating it is weak,
// if it is) because the reading code will have the same paremter specifying
// the pointer is weak. Here for symmetry.
virtual void Serialize(const char* name,
vtkstd::vector<vtkSmartPointer<vtkObject> >& objs,
bool weakPtr = false);
// Description:
// Serializes a map from int to vector of vtkObjects.
virtual void Serialize(const char* name,
vtkstd::map<int, vtkstd::vector<vtkSmartPointer<vtkObject> > >& objs);
protected:
vtkKWEXMLArchiveWriter();
~vtkKWEXMLArchiveWriter();
// Description:
// Try to serialize the given vtkObject if it has not been serialized already.
// If the object could not be serialized then return 0, else return the
// id for serialized object's xml tag. The id is always greater than or
// equal to 1. If the object has already been serialized then this will just
// lookup and return the id.
virtual unsigned int Serialize(vtkObject*& obj);
private:
vtkKWEXMLArchiveWriter(const vtkKWEXMLArchiveWriter&); // Not implemented.
void operator=(const vtkKWEXMLArchiveWriter&); // Not implemented.
virtual void CreateDOM(const char* rootName,
vtkstd::vector<vtkSmartPointer<vtkObject> >& objs);
void SetRootElement(vtkKWEXMLElement*);
// Description:
// Serializes a vtkInformationObject.
virtual void Serialize(vtkKWEXMLElement* elem, vtkInformation* info);
vtkKWEXMLArchiveWriterInternals* Internal;
vtkKWEXMLElement* RootElement;
};
#endif
|