41 #include <boost/iterator/transform_iterator.hpp> 42 #include <boost/range/empty.hpp> 83 auto to_constraint_ref = +[](
const Constraint::SharedPtr& constraint) ->
const Constraint&
97 UUID constraint_uuid = constraint->uuid();
106 auto is_constraint_added = [&constraint_uuid](
const Constraint::SharedPtr& added_constraint)
108 return constraint_uuid == added_constraint->uuid();
117 *added_constraints_iter = std::move(constraint);
125 auto is_constraint_added = [&constraint_uuid](
const Constraint::SharedPtr& added_constraint)
127 return constraint_uuid == added_constraint->uuid();
146 auto to_variable_ref = +[](
const Variable::SharedPtr& variable) ->
const Variable&
167 UUID variable_uuid = variable->uuid();
176 auto is_variable_added = [&variable_uuid](
const Variable::SharedPtr& added_variable)
178 return variable_uuid == added_variable->uuid();
187 *added_variables_iter = std::move(variable);
195 auto is_variable_added = [&variable_uuid](
const Variable::SharedPtr& added_variable)
197 return variable_uuid == added_variable->uuid();
239 stream <<
"Stamp: " <<
stamp_ <<
"\n";
240 stream <<
"Involved Timestamps:\n";
243 stream <<
" - " << involved_stamp <<
"\n";
245 stream <<
"Added Variables:\n";
248 stream <<
" - " << *added_variable <<
"\n";
250 stream <<
"Added Constraints:\n";
253 stream <<
" - " << *added_constraint <<
"\n";
255 stream <<
"Removed Variables:\n";
258 stream <<
" - " << removed_variable <<
"\n";
260 stream <<
"Removed Constraints:\n";
263 stream <<
" - " << removed_constraint <<
"\n";
269 return Transaction::make_unique(*
this);
294 transaction.
print(stream);
boost::any_range< const Variable, boost::forward_traversal_tag > const_variable_range
A range of Variable::SharedPtr objects.
void merge(const Transaction &other, bool overwrite=false)
Merge the contents of another transaction into this one.
The Variable interface definition.
ros::Time stamp_
The transaction message timestamp.
boost::archive::text_oarchive TextOutputArchive
void serialize(fuse_core::BinaryOutputArchive &) const
Serialize this Constraint into the provided binary archive.
std::set< ros::Time > involved_stamps_
The set of timestamps involved in this transaction.
void deserialize(fuse_core::BinaryInputArchive &)
Deserialize data from the provided binary archive into this Constraint.
const_variable_range addedVariables() const
Read-only access to the added variables.
void print(std::ostream &stream=std::cout) const
Print a human-readable description of the transaction to the provided stream.
std::vector< Constraint::SharedPtr > added_constraints_
The constraints to be added.
const ros::Time & minStamp() const
Read-only access to the minimum (oldest), timestamp among the transaction's stamp and all involved ti...
const ros::Time & stamp() const
Read-only access to this transaction's timestamp.
bool empty() const
Check if the transaction is empty, i.e. it has no added or removed constraints or variables...
const ros::Time & maxStamp() const
Read-only access to the maximum (newest) timestamp among the transaction's stamp and all involved tim...
std::vector< Variable::SharedPtr > added_variables_
The variables to be added.
boost::archive::binary_oarchive BinaryOutputArchive
void addInvolvedStamp(const ros::Time &stamp)
Add a timestamp to the "involved stamps" collection.
The Constraint interface definition.
boost::archive::binary_iarchive BinaryInputArchive
Transaction::UniquePtr clone() const
Perform a deep copy of the Transaction and return a unique pointer to the copy.
boost::archive::text_iarchive TextInputArchive
std::vector< UUID > removed_constraints_
The constraint UUIDs to be removed.
const_constraint_range addedConstraints() const
Read-only access to the added constraints.
A transaction is a group of variable and constraint additions and subtractions that should all be pro...
boost::any_range< const Constraint, boost::forward_traversal_tag > const_constraint_range
A range of Constraint::SharedPtr objects.
std::vector< UUID > removed_variables_
The variable UUIDs to be removed.
std::ostream & operator<<(std::ostream &stream, const Constraint &constraint)
void removeVariable(const UUID &variable_uuid)
Remove the variable from this transaction if it was previously added, or mark the variable for remova...
void removeConstraint(const UUID &constraint_uuid)
Remove a constraint from this transaction if it was previously added, or mark the constraint for remo...
void addConstraint(Constraint::SharedPtr constraint, bool overwrite=false)
Add a constraint to this transaction.
void addVariable(Variable::SharedPtr variable, bool overwrite=false)
Add a variable to this transaction.