cctools
nvpair.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef NVPAIR_H
9 #define NVPAIR_H
10 
11 #include <stdio.h>
12 
13 #include "int_sizes.h"
14 #include "hash_table.h"
15 
29 struct nvpair *nvpair_create();
30 
34 void nvpair_delete(struct nvpair *n);
35 
40 void nvpair_parse(struct nvpair *n, const char *text);
41 
46 int nvpair_parse_stream(struct nvpair *n, FILE * stream);
47 int nvpair_parse_stream_limited(struct nvpair *n, FILE * stream, char ** attr_list, int attr_len);
48 
55 int nvpair_print(struct nvpair *n, char *text, int length);
56 
62 int nvpair_print_alloc(struct nvpair *n, char **text);
63 
68 void nvpair_remove( struct nvpair *n, const char *name );
69 
75 void nvpair_insert_string(struct nvpair *n, const char *name, const char *value);
76  void nvpair_insert_integer(struct nvpair *n, const char *name, INT64_T value);
82 
88 void nvpair_insert_float(struct nvpair *n, const char *name, double value);
89 
95 const char *nvpair_lookup_string(struct nvpair *n, const char *name);
96 
102 INT64_T nvpair_lookup_integer(struct nvpair *n, const char *name);
103 
109 double nvpair_lookup_float(struct nvpair *n, const char *name);
110 
115 void nvpair_export( struct nvpair *nv );
116 
117 
125 void nvpair_first_item(struct nvpair *nv);
126 
135 int nvpair_next_item(struct nvpair *nv, char **name, char **value);
136 
137 
138 typedef enum {
139  NVPAIR_MODE_STRING,
140  NVPAIR_MODE_INTEGER,
141  NVPAIR_MODE_URL,
142  NVPAIR_MODE_METRIC,
143  NVPAIR_MODE_TIME,
144  NVPAIR_MODE_TIMESTAMP
145 } nvpair_mode_t;
146 
147 typedef enum {
148  NVPAIR_ALIGN_LEFT,
149  NVPAIR_ALIGN_RIGHT
150 } nvpair_align_t;
151 
153  const char *name;
154  const char *title;
155  nvpair_mode_t mode;
156  nvpair_align_t align;
157  int width;
158 };
159 
164 void nvpair_print_text(struct nvpair *n, FILE * stream);
165 
170 void nvpair_print_xml(struct nvpair *n, FILE * stream);
171 
176 void nvpair_print_json(struct nvpair *n, FILE * stream);
177 
182 void nvpair_print_new_classads(struct nvpair *n, FILE * stream);
183 
188 void nvpair_print_old_classads(struct nvpair *n, FILE * stream);
189 
194 void nvpair_print_html_solo(struct nvpair *n, FILE * stream);
195 
196 void nvpair_print_html_header(FILE * stream, struct nvpair_header *h);
197 void nvpair_print_html(struct nvpair *n, FILE * stream, struct nvpair_header *h);
198 void nvpair_print_html_with_link(struct nvpair *n, FILE * stream, struct nvpair_header *h, const char *linkname, const char *linktext);
199 
200 void nvpair_print_html_footer(FILE * stream, struct nvpair_header *h);
201 
202 void nvpair_print_table_header(FILE * stream, struct nvpair_header *h);
203 void nvpair_print_table(struct nvpair *n, FILE * stream, struct nvpair_header *h);
204 void nvpair_print_table_footer(FILE * stream, struct nvpair_header *h);
205 
206 #endif
Definition: nvpair.h:152
void nvpair_print_xml(struct nvpair *n, FILE *stream)
Print an entire nvpair in XML form.
struct nvpair * nvpair_create()
Create an empty nvpair.
void nvpair_print_old_classads(struct nvpair *n, FILE *stream)
Print an entire nvpair in old ClassAd form.
void nvpair_export(struct nvpair *nv)
Export all items in the nvpair to the environment with setenv.
int nvpair_print_alloc(struct nvpair *n, char **text)
Print an nvpair to ASCII text, allocating the needed buffer.
const char * nvpair_lookup_string(struct nvpair *n, const char *name)
Lookup a property in string form.
void nvpair_insert_string(struct nvpair *n, const char *name, const char *value)
Insert a property in string form.
void nvpair_parse(struct nvpair *n, const char *text)
Load in an nvpair from ASCII text.
void nvpair_print_json(struct nvpair *n, FILE *stream)
Print an entire nvpair in JSON form.
void nvpair_print_text(struct nvpair *n, FILE *stream)
Print an entire nvpair in text form.
double nvpair_lookup_float(struct nvpair *n, const char *name)
Lookup a property in floating point form.
void nvpair_first_item(struct nvpair *nv)
Begin iteration over all items.
void nvpair_print_html_solo(struct nvpair *n, FILE *stream)
Print an entire nvpair in HTML form.
INT64_T nvpair_lookup_integer(struct nvpair *n, const char *name)
Lookup a property in integer form.
void nvpair_print_new_classads(struct nvpair *n, FILE *stream)
Print an entire nvpair in new ClassAd form.
void nvpair_remove(struct nvpair *n, const char *name)
Remove a property from an nvpair.
int nvpair_parse_stream(struct nvpair *n, FILE *stream)
Load in an nvpair from a standard I/O stream.
Definition: nvpair_private.h:15
int nvpair_print(struct nvpair *n, char *text, int length)
Print an nvpair to ASCII text with a limit.
int nvpair_next_item(struct nvpair *nv, char **name, char **value)
Continue iteration over all items.
A general purpose hash table.
void nvpair_insert_integer(struct nvpair *n, const char *name, INT64_T value)
Insert a property in integer form.
void nvpair_insert_float(struct nvpair *n, const char *name, double value)
Insert a property in floating point form.
void nvpair_delete(struct nvpair *n)
Delete an nvpair.