1 #ifndef _rrdata__hpp__included__
2 #define _rrdata__hpp__included__
4 #define RRDATA_BYTES 32
21 * Create new random load ID.
23 * throws std::bad_alloc: Not enough memory
25 instance() throw(std::bad_alloc
);
27 * Create new load id from bytes.
29 * parameter b: 32 byte array containing the new ID.
31 instance(unsigned char* b
) throw();
35 unsigned char bytes
[RRDATA_BYTES
];
37 * Is this ID before another one?
39 * parameter i: Another ID.
40 * returns: True if this ID is before another one, false otherwise.
42 bool operator<(const struct instance
& i
) const throw();
44 * Is this ID equal to another one?
46 * parameter i: Another ID.
47 * returns: True if this ID is equal to another one, false otherwise.
49 bool operator==(const struct instance
& i
) const throw();
53 * returns: Copy of the ID before the increment.
55 const struct instance
operator++(int) throw();
59 * returns: Reference to this.
61 struct instance
& operator++() throw();
64 * Read the saved set of load IDs for specified project and switch to that project.
66 * parameter project: The name of project.
67 * throws std::bad_alloc: Not enough memory
69 static void read_base(const std::string
& project
) throw(std::bad_alloc
);
71 * Switch to no project, closing the load IDs.
73 static void close() throw();
75 * Add new specified instance to current project.
77 * Not allowed if there is no project open.
79 * parameter i: The load ID to add.
81 static void add(const struct instance
& i
) throw(std::bad_alloc
);
83 * Generate new load ID and add it to the current proejct.
85 * Not allowed if there is no project open.
87 * throws std::bad_alloc: Not enough memory.
89 static void add_internal() throw(std::bad_alloc
);
91 * Write compressed representation of current load ID set to stream.
93 * parameter strm: The stream to write to.
94 * returns: Rerecord count.
95 * throws std::bad_alloc: Not enough memory.
97 static uint64_t write(std::vector
<char>& strm
) throw(std::bad_alloc
);
99 * Load compressed representation of load ID set from stream and union it with current set to form new current
102 * parameter strm: The stream to read from.
103 * returns: Rerecord count.
104 * throws std::bad_alloc: Not enough memory.
106 static uint64_t read(std::vector
<char>& strm
, bool dummy
= false) throw(std::bad_alloc
);
108 * Load compressed representation of load ID set from stream, but don't do anything to it.
110 * parameter strm: The stream to read from.
111 * returns: Rerecord count.
112 * throws std::bad_alloc: Not enough memory.
114 static uint64_t count(std::vector
<char>& strm
) throw(std::bad_alloc
);
116 * Internal pointer used by add_internal.
118 static struct instance
* internal
;
122 * Print load ID. Mainly useful for deubugging.
124 * parameter os: Stream to print to.
125 * parameter i: load ID to print.
127 std::ostream
& operator<<(std::ostream
& os
, const struct rrdata::instance
& i
);