1 #ifndef _rrdata__hpp__included__
2 #define _rrdata__hpp__included__
4 #define RRDATA_BYTES 32
20 * Create new random load ID.
22 * throws std::bad_alloc: Not enough memory
24 instance() throw(std::bad_alloc
);
26 * Create new load id from bytes.
28 * parameter b: 32 byte array containing the new ID.
30 instance(unsigned char* b
) throw();
34 unsigned char bytes
[RRDATA_BYTES
];
36 * Is this ID before another one?
38 * parameter i: Another ID.
39 * returns: True if this ID is before another one, false otherwise.
41 bool operator<(const struct instance
& i
) const throw();
43 * Is this ID equal to another one?
45 * parameter i: Another ID.
46 * returns: True if this ID is equal to another one, false otherwise.
48 bool operator==(const struct instance
& i
) const throw();
52 * returns: Copy of the ID before the increment.
54 const struct instance
operator++(int) throw();
58 * returns: Reference to this.
60 struct instance
& operator++() throw();
63 * Read the saved set of load IDs for specified project and switch to that project.
65 * parameter project: The name of project.
66 * throws std::bad_alloc: Not enough memory
68 static void read_base(const std::string
& project
) throw(std::bad_alloc
);
70 * Switch to no project, closing the load IDs.
72 static void close() throw();
74 * Add new specified instance to current project.
76 * Not allowed if there is no project open.
78 * parameter i: The load ID to add.
80 static void add(const struct instance
& i
) throw(std::bad_alloc
);
82 * Generate new load ID and add it to the current proejct.
84 * Not allowed if there is no project open.
86 * throws std::bad_alloc: Not enough memory.
88 static void add_internal() throw(std::bad_alloc
);
90 * Write compressed representation of current load ID set to stream.
92 * parameter strm: The stream to write to.
93 * throws std::bad_alloc: Not enough memory.
95 static uint64_t write(std::ostream
& strm
) throw(std::bad_alloc
);
97 * Load compressed representation of load ID set from stream and union it with current set to form new current
100 * parameter strm: The stream to read from.
101 * throws std::bad_alloc: Not enough memory.
103 static uint64_t read(std::istream
& strm
) throw(std::bad_alloc
);
105 * Internal pointer used by add_internal.
107 static struct instance
* internal
;
111 * Print load ID. Mainly useful for deubugging.
113 * parameter os: Stream to print to.
114 * parameter i: load ID to print.
116 std::ostream
& operator<<(std::ostream
& os
, const struct rrdata::instance
& i
);