$extrastylesheet
#include <scribo/core/object_links.hh>
Public Types | |
typedef Object< void > | category |
typedef object_links< L > | exact_t |
Public Member Functions | |
object_links () | |
object_links (const component_set< L > &components) | |
object_links (const component_set< L > &components, unsigned default_link_id) | |
void | accept (const SerializeVisitor< E2 > &visitor) const |
const mln::util::array < unsigned > & | comp_to_link () const |
const component_set< L > & | components () const |
object_links< L > | duplicate () const |
bool | has_linking_enabled (unsigned comp_id) const |
void | init () |
bool | is_linked (unsigned comp_id) const |
bool | is_valid () const |
unsigned | nelements () const |
void | update (unsigned from_id, unsigned to_id) |
void | clear (unsigned id) |
void | disable_linking (unsigned id) |
const unsigned & | operator() (unsigned comp_id) const |
Related Functions | |
(Note that these are not member functions.) | |
template<typename L > | |
std::ostream & | operator<< (std::ostream &ostr, const object_links< L > &links) |
Object links representation.
This structure is meant to store link information between components. Linking components can be considered as a first step towards component grouping.
It requires a component_set to be constructed. Each component existing in the component_set may have link in an object_link structure. If no component_set is used for construction, this object is invalid (
Definition at line 88 of file object_links.hh.
scribo::object_links< L >::object_links | ( | ) |
Default constructor. It produces an invalid structure.
scribo::object_links< L >::object_links | ( | const component_set< L > & | components | ) |
Construct a valid object_links.
Links is enabled for each valid component but no link is set. Invalid components links are disabled.
scribo::object_links< L >::object_links | ( | const component_set< L > & | components, |
unsigned | default_link_id | ||
) |
Construct a valid object_links.
Links is enabled for each valid component and set by default towards component with id default_link_id
. Invalid components links are disabled.
|
inherited |
Allow this object to be serialized by visitor
.
void scribo::object_links< L >::clear | ( | unsigned | id | ) |
Reset link for component with id id
.
This component can be linked later.
const mln::util::array<unsigned>& scribo::object_links< L >::comp_to_link | ( | ) | const |
Returns the underlying array encoding the component links.
Indexes in array correspond to component ids and the corresponding value is the component id involved in the link.
const component_set<L>& scribo::object_links< L >::components | ( | ) | const |
Return the underlying component_set.
void scribo::object_links< L >::disable_linking | ( | unsigned | id | ) |
Do not allow component with id id
to be linked to another component.
object_links<L> scribo::object_links< L >::duplicate | ( | ) | const |
Make a deep copy of this structure.
bool scribo::object_links< L >::has_linking_enabled | ( | unsigned | comp_id | ) | const |
Return True if component comp_id
can be linked to another component.
void scribo::object_links< L >::init | ( | ) |
Initialize links.
Each component is linked to itself (i.e. has no link). Invalid components have linking disabled.
bool scribo::object_links< L >::is_linked | ( | unsigned | comp_id | ) | const |
Return True if component comp_id
has a link starting from itself to another component.
bool scribo::object_links< L >::is_valid | ( | ) | const |
Return True if this object_links structure is correctly constructed.
unsigned scribo::object_links< L >::nelements | ( | ) | const |
Return the number of links.
This is equivalent to the number of components + the background.
const unsigned& scribo::object_links< L >::operator() | ( | unsigned | comp_id | ) | const |
Get link id for component comp_id
.
void scribo::object_links< L >::update | ( | unsigned | from_id, |
unsigned | to_id | ||
) |
Link related methods.
Set link between component from_id
and to_id
.
|
related |