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 
111 
112 typedef enum {
113  NVPAIR_MODE_STRING,
114  NVPAIR_MODE_INTEGER,
115  NVPAIR_MODE_URL,
116  NVPAIR_MODE_METRIC,
117  NVPAIR_MODE_TIME,
118  NVPAIR_MODE_TIMESTAMP
119 } nvpair_mode_t;
120 
121 typedef enum {
122  NVPAIR_ALIGN_LEFT,
123  NVPAIR_ALIGN_RIGHT
124 } nvpair_align_t;
125 
127  const char *name;
128  const char *title;
129  nvpair_mode_t mode;
130  nvpair_align_t align;
131  int width;
132 };
133 
138 void nvpair_print_text(struct nvpair *n, FILE * stream);
139 
144 void nvpair_print_xml(struct nvpair *n, FILE * stream);
145 
150 void nvpair_print_json(struct nvpair *n, FILE * stream);
151 
156 void nvpair_print_new_classads(struct nvpair *n, FILE * stream);
157 
162 void nvpair_print_old_classads(struct nvpair *n, FILE * stream);
163 
168 void nvpair_print_html_solo(struct nvpair *n, FILE * stream);
169 
170 void nvpair_print_html_header(FILE * stream, struct nvpair_header *h);
171 void nvpair_print_html(struct nvpair *n, FILE * stream, struct nvpair_header *h);
172 void nvpair_print_html_with_link(struct nvpair *n, FILE * stream, struct nvpair_header *h, const char *linkname, const char *linktext);
173 
174 void nvpair_print_html_footer(FILE * stream, struct nvpair_header *h);
175 
176 void nvpair_print_table_header(FILE * stream, struct nvpair_header *h);
177 void nvpair_print_table(struct nvpair *n, FILE * stream, struct nvpair_header *h);
178 void nvpair_print_table_footer(FILE * stream, struct nvpair_header *h);
179 
180 #endif
Definition: nvpair.h:126
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.
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_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.
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.