summaryrefslogtreecommitdiffstats
path: root/hl/c++/examples/ptExampleFL.cpp
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /hl/c++/examples/ptExampleFL.cpp
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'hl/c++/examples/ptExampleFL.cpp')
-rw-r--r--hl/c++/examples/ptExampleFL.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/hl/c++/examples/ptExampleFL.cpp b/hl/c++/examples/ptExampleFL.cpp
index 26cbf09..d0b62da 100644
--- a/hl/c++/examples/ptExampleFL.cpp
+++ b/hl/c++/examples/ptExampleFL.cpp
@@ -22,56 +22,55 @@
*-------------------------------------------------------------------------
*/
-const char* FILE_NAME("PTcppexampleFL.h5");
-const char* PT_NAME("/examplePacketTable");
+const char *FILE_NAME("PTcppexampleFL.h5");
+const char *PT_NAME("/examplePacketTable");
-int main(void)
+int
+main(void)
{
- herr_t err; /* Return value from function calls */
- hid_t fileID; /* HDF5 identifier for file */
- hid_t plistID; /* HDF5 identifier for property list to use compression */
- hsize_t count; /* Number of records in table */
- int x; /* Temporary counter variable */
+ herr_t err; /* Return value from function calls */
+ hid_t fileID; /* HDF5 identifier for file */
+ hid_t plistID; /* HDF5 identifier for property list to use compression */
+ hsize_t count; /* Number of records in table */
+ int x; /* Temporary counter variable */
/* Buffers to hold data */
int readBuffer[5];
int writeBuffer[5];
/* Initialize buffers */
- for(x=0; x<5; x++)
- {
- writeBuffer[x]=x;
- readBuffer[x] = -1;
+ for (x = 0; x < 5; x++) {
+ writeBuffer[x] = x;
+ readBuffer[x] = -1;
}
/* Create a new HDF5 file */
fileID = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if(fileID <0)
+ if (fileID < 0)
fprintf(stderr, "Couldn't create file.\n");
/* Prepare property list to set compression, randomly use deflate
with compression level 5. */
plistID = H5Pcreate(H5P_DATASET_CREATE);
- err = H5Pset_deflate(plistID, 5);
- if(err < 0)
+ err = H5Pset_deflate(plistID, 5);
+ if (err < 0)
fprintf(stderr, "Error setting compression level.");
/* Create a fixed-length packet table. */
FL_PacketTable ptable(fileID, plistID, PT_NAME, H5T_NATIVE_INT, 100);
- if(! ptable.IsValid())
+ if (!ptable.IsValid())
fprintf(stderr, "Unable to create packet table.");
/* Append five packets to the packet table, one at a time */
- for(x=0; x<5; x++)
- {
- err = ptable.AppendPacket( &(writeBuffer[x]) );
- if(err<0)
+ for (x = 0; x < 5; x++) {
+ err = ptable.AppendPacket(&(writeBuffer[x]));
+ if (err < 0)
fprintf(stderr, "Error adding record.");
}
/* Get the number of packets in the packet table. This should be five. */
count = ptable.GetPacketCount(err);
- if(err < 0)
+ if (err < 0)
fprintf(stderr, "Error getting packet count.");
printf("Number of packets in packet table after five appends: %d\n", count);
@@ -80,10 +79,9 @@ int main(void)
ptable.ResetIndex();
/* Iterate through packets, read each one back */
- for(x=0; x<5; x++)
- {
- err = ptable.GetNextPacket( &(readBuffer[x]) );
- if(err < 0)
+ for (x = 0; x < 5; x++) {
+ err = ptable.GetNextPacket(&(readBuffer[x]));
+ if (err < 0)
fprintf(stderr, "Error reading record.");
printf("Packet %d's value is %d.\n", x, readBuffer[x]);
@@ -93,9 +91,8 @@ int main(void)
/* out of scope. */
err = H5Fclose(fileID);
- if( err < 0 )
+ if (err < 0)
fprintf(stderr, "Failed to close file.\n");
return 0;
}
-