(C++)
Class:
HnProperties
Constructor:
HnProperties new_HnProperties(void);
Methods:
HnString setProperty(const HnString &key, const HnString &value);
void load(const char *buffer);
(C )
Structure:
HnPropertiesSt
Allocation:
HnProperties *HnPropertiesSt_allocate(void);
Deletion:
void HnPropertiesSt_free(HnPropertiesSt *properties);
Methods:
void HnPropertiesSt_setProperty(HnPropertiesSt *properties,
const char *key,
const char *value);
void HnPropertiesSt_load(HnPropertiesSt *properties,
const char *buffer);
|
An object of the class `HnProperties
' is a set of
label-value pairs. Both labels and values are given in the form of a
character string. For example, the following code allocates an object
of the class `HnProperties
' and then sets the property
whose label and value are `HnSRTreeBlockSize' and `16384'
respectively.
(C++)
HnProperties properties;
properties = new_HnProperties();
properties.setProperty("HnSRTreeBlockSize", "16384");
(C )
HnPropertiesSt *properties;
properties = HnPropertiesSt_allocate();
HnPropertiesSt_setProperty(properties, "HnSRTreeBlockSize", "16384");
In the C++ language interface, the arguments of the method
`setProperties
' has the type `HnString
'.
`HnString
' is the class defined for a character
string. Because this class has the type converter from a character
string to itself, you can set character strings directly to the
arguments of `setProperties
'.
Alternatively, properties can be loaded from a character string. The
character string should consist of one or more lines and each line
should be a label-value pair connected by the equal sign. For example,
the following code loads two properties, `A=B
' and
`P=Q
' from the character string "A=B\nP=Q\n"
.
(C++)
properties.load("A=B\nP=Q\n");
(C )
HnPropertiesSt_load(properties, "A=B\nP=Q\n");
(C++)
Class:
HnDataItem
Constructor:
HnDataItem new_HnDataItem(const void *bytes, int length);
Methods:
int length(void) const;
char *toCharArray(void) const;
(C )
Structure:
HnDataItemSt
Allocation:
HnDataItemSt *HnDataItemSt_allocate(const char *bytes, int length);
Deletion:
void HnDataItemSt_free(HnDataItemSt *dataItem);
Member variables:
int length;
unsigned char *buffer;
Methods:
HnDataItemSt_equals(const HnDataItemSt *dataItem1,
const HnDataItemSt *dataItem2);
|
The class `HnDataItem
' is used for allocating an object
which contains a piece of data in the form of a byte string. A data
item whose content is the character string "Hello world!"
can be allocated in the following way:
(C++)
char *s = "Hello world!";
HnDataItem dataItem;
dataItem = new_HnDataItem(s, strlen(s) + 1);
(C )
char *s = "Hello world!";
HnDataItemSt *dataItem;
dataItem = HnDataItemSt_allocate(s, strlen(s) + 1);
The content of an object can be accessed in the following way:
(C++)
printf("%s\n", dataItem.toCharArray());
(C )
printf("%s\n", dataItem->buffer);
In the following example, an integer value 1234
is stored
in an object of the class `HnDataItem
':
(C++)
int n = 1234;
HnDataItem dataItem;
dataItem = new_HnDataItem(&n, sizeof(n));
printf("%d\n", *((int *)dataItem.toCharArray()));
(C )
int n = 1234;
HnDataItemSt *dataItem;
dataItem = HnDataItemSt_allocate(&n, sizeof(n));
printf("%d\n", *((int *)dataItem->buffer));
(C++)
Class:
HnSphere
Constructor:
HnSphere new_HnSphere(const HnPoint ¢er, double radius);
Methods:
HnPoint &getCenter(void) const;
double getRadius(void) const;
int getDimension(void) const;
(C )
Structure:
HnSphereSt
Allocation:
HnSphereSt *HnSphereSt_allocate(int dimension);
Deletion:
void HnSphereSt_free(HnSphereSt *sphere);
Member variables:
HnPoint *center;
double *radius;
|
See also HnPoint.
The class `HnSphere
' is used for allocating an object
representing a sphere. For example, the following
code allocates a 3-dimensional sphere whose center is (0.2, 0.4, 0.6)
and whose radius is 0.8:
(C++)
HnPoint center;
HnSphere sphere;
center = new_HnPoint(3);
center.setCoordAt(0.2, 0);
center.setCoordAt(0.4, 1);
center.setCoordAt(0.6, 2);
sphere = new_HnSphere(center, 0.8);
(C )
HnSphereSt *sphere;
sphere = HnSphereSt_allocate(3);
sphere->center->coords[0] = 0.2;
sphere->center->coords[1] = 0.4;
sphere->center->coords[2] = 0.6;
sphere->radius = 0.8;
The dimensionality, coordinates, and radius of a sphere can be
obtained in the following way:
(C++)
for ( i=0; i<sphere.getDimension(); i++ ) {
printf("coords[%d]=%g\n",
i, sphere.getCenter().getCoordAt(i));
}
printf("radius=%g\n", sphere.getRadius());
(C )
for ( i=0; i<sphere->center->dimension; i++ ) {
printf("coords[%d]=%g\n",
i, sphere->center->coords[i]);
}
printf("radius=%g\n", sphere->radius);
(C++)
Class:
HnRect
Constructor:
HnRect new_HnRect(int dimension);
Methods:
int getDimension(void) const;
HnRange &getRangeAt(int index) const;
void setRangeAt(double min, double max, int index);
(C )
Structure:
HnRectSt
Allocation:
HnRectSt *HnRectSt_allocate(int dimension);
Deletion:
void HnRectSt_free(HnRectSt *rect);
Member variables:
int dimension;
HnRangeSt *ranges;
|
See also HnRange.
The class `HnRect
' is used for allocating an object
representing a (axis-aligned) rectangle. For example, the following
code allocates a 3-dimensional rectangle whose ranges are 0.2 to 0.3
in the first dimension, 0.4 to 0.5 in the second, and 0.6 to 0.7 in
the third:
(C++)
HnRect rect;
rect = new_HnRect(3);
rect.setRangeAt(0.2, 0.3, 0);
rect.setRangeAt(0.4, 0.5, 1);
rect.setRangeAt(0.6, 0.7, 2);
(C )
HnRectSt *rect;
rect = HnRectSt_allocate(3);
rect->ranges[0].min = 0.2;
rect->ranges[0].max = 0.3;
rect->ranges[1].min = 0.4;
rect->ranges[1].max = 0.5;
rect->ranges[2].min = 0.6;
rect->ranges[2].max = 0.7;
The dimensionality and the coordinates of a rectangle can be obtained
in the following way:
(C++)
for ( i=0; i<rect.getDimension(); i++ ) {
printf("min=%g, max=%g\n",
rect.getRangeAt(i).getMin(), rect.getRangeAt(i).getMax());
}
(C )
for ( i=0; i<rect->dimension; i++ ) {
printf("min=%g, max=%g\n",
rect->ranges[i].min, rect->ranges[i].max);
}
(C++ and C)
Structure:
HnSRTreeProfileSt
Allocation:
HnSRTreeProfileSt *HnSRTreeProfileSt_allocate(void);
Deletion:
void HnSRTreeProfileSt_free(HnSRTreeProfileSt *profile);
Member variables:
/* block I/O */
int numSuperBlockReads;
int numSuperBlockWrites;
int numNodeBlockReads;
int numNodeBlockWrites;
int numLeafBlockReads;
int numLeafBlockWrites;
/* split */
int numNodeSplits;
int numLeafSplits;
/* search */
int numVisitedNodes;
int numVisitedLeaves;
int numComparedNodeEntries;
int numComparedLeafEntries;
/* nearest neighbor search */
int numEqualDistances;
int numFartherSpheres;
int numFartherRects;
Methods:
void HnSRTreeProfileSt_print(const HnSRTreeProfileSt *profile);
|
The structure `HnSRTreeProfileSt
' is used to keep the
profile information of an index file.
The member variables, `numEqualDistances
',
`numFartherSpheres
', and `numFartherRects
',
store the characteristics on the distance measurement in nearest
neighbor search. The variable `numEqualDistances
' stores
the count of the case that the bounding sphere and the bounding
rectangle of a region has the same distance to the query point. The
variable `numFartherSpheres
' stores the count of the case
that the distance from the query point to the bounding sphere is
longer than the one to the bounding rectangle, while
`numFartherRects
' stores the count of the opposite case.