VTK  9.1.0
vtkBlueObeliskDataParser.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkBlueObeliskDataParser.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
36#ifndef vtkBlueObeliskDataParser_h
37#define vtkBlueObeliskDataParser_h
38
39#include "vtkDomainsChemistryModule.h" // For export macro
40#include "vtkXMLParser.h"
41
42#include "vtkSmartPointer.h" // For vtkSmartPointer
43
46class vtkFloatArray;
47class vtkStdString;
48class vtkStringArray;
50
51class VTKDOMAINSCHEMISTRY_EXPORT vtkBlueObeliskDataParser : public vtkXMLParser
52{
53public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
63 virtual void SetTarget(vtkBlueObeliskData* bodr);
64
68 int Parse() override;
69
71
76 int Parse(const char*) override;
77 int Parse(const char*, unsigned int) override;
79
80protected:
83
84 void StartElement(const char* name, const char** attr) override;
85 void EndElement(const char* name) override;
86
87 void CharacterDataHandler(const char* data, int length) override;
88
89 void SetCurrentValue(const char* data, int length);
90 void SetCurrentValue(const char* data);
91
93
95 void NewAtomStarted(const char** attr);
97
99 void NewValueStarted(const char** attr);
101
103
105 {
106 None = 0,
124 Group
125 } CurrentValueType;
126
140 float CurrentDefaultColor[3];
143 unsigned int CurrentPeriod;
144 unsigned int CurrentGroup;
145
146private:
148 void operator=(const vtkBlueObeliskDataParser&) = delete;
149
151
154 static void ResizeArrayIfNeeded(vtkAbstractArray* arr, vtkIdType ind);
155 static void ResizeAndSetValue(vtkStdString* val, vtkStringArray* arr, vtkIdType ind);
156 static void ResizeAndSetValue(float val, vtkFloatArray* arr, vtkIdType ind);
157 static void ResizeAndSetValue(unsigned short val, vtkUnsignedShortArray* arr, vtkIdType ind);
159
161
164 static int parseInt(const char*);
165 static float parseFloat(const char*);
166 static void parseFloat3(const char* str, float[3]);
167 static unsigned short parseUnsignedShort(const char*);
169
171
175 static vtkStdString* ToLower(vtkStdString*);
177};
178
179#endif
Abstract superclass for all arrays.
Fill a vtkBlueObeliskData container with data from the BODR XML dataset.
static vtkBlueObeliskDataParser * New()
void EndElement(const char *name) override
void NewAtomStarted(const char **attr)
void StartElement(const char *name, const char **attr) override
void NewValueStarted(const char **attr)
~vtkBlueObeliskDataParser() override
void SetCurrentValue(const char *data)
virtual void SetTarget(vtkBlueObeliskData *bodr)
Set the target vtkBlueObeliskData object that this parser will populate.
int Parse(const char *, unsigned int) override
These are only implemented to prevent compiler warnings about hidden virtual overloads.
int Parse() override
Start parsing.
int Parse(const char *) override
These are only implemented to prevent compiler warnings about hidden virtual overloads.
void CharacterDataHandler(const char *data, int length) override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetCurrentValue(const char *data, int length)
Contains chemical data from the Blue Obelisk Data Repository.
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:113
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of unsigned short
Parse XML to handle element tags and attributes.
Definition: vtkXMLParser.h:40
@ Group
Definition: vtkX3D.h:57
@ length
Definition: vtkX3D.h:399
@ name
Definition: vtkX3D.h:225
@ data
Definition: vtkX3D.h:321
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332