$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
scribo::object_links< L > Class Template Reference

#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 unsignedoperator() (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)

Detailed Description

template<typename L>
class scribo::object_links< L >

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 (

See Also
is_valid()).

Definition at line 88 of file object_links.hh.

Constructor & Destructor Documentation

template<typename L>
scribo::object_links< L >::object_links ( )

Default constructor. It produces an invalid structure.

template<typename L>
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.

template<typename L>
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.

Member Function Documentation

void scribo::Serializable< object_links< L > >::accept ( const SerializeVisitor< E2 > &  visitor) const
inherited

Allow this object to be serialized by visitor.

template<typename L>
void scribo::object_links< L >::clear ( unsigned  id)

Reset link for component with id id.

This component can be linked later.

template<typename L>
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.

template<typename L>
const component_set<L>& scribo::object_links< L >::components ( ) const

Return the underlying component_set.

template<typename L>
void scribo::object_links< L >::disable_linking ( unsigned  id)

Do not allow component with id id to be linked to another component.

template<typename L>
object_links<L> scribo::object_links< L >::duplicate ( ) const

Make a deep copy of this structure.

template<typename L>
bool scribo::object_links< L >::has_linking_enabled ( unsigned  comp_id) const

Return True if component comp_id can be linked to another component.

template<typename L>
void scribo::object_links< L >::init ( )

Initialize links.

Each component is linked to itself (i.e. has no link). Invalid components have linking disabled.

template<typename L>
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.

template<typename L>
bool scribo::object_links< L >::is_valid ( ) const

Return True if this object_links structure is correctly constructed.

template<typename L>
unsigned scribo::object_links< L >::nelements ( ) const

Return the number of links.

This is equivalent to the number of components + the background.

template<typename L>
const unsigned& scribo::object_links< L >::operator() ( unsigned  comp_id) const

Get link id for component comp_id.

template<typename L>
void scribo::object_links< L >::update ( unsigned  from_id,
unsigned  to_id 
)

Link related methods.

Set link between component from_id and to_id.

Friends And Related Function Documentation

template<typename L >
std::ostream & operator<< ( std::ostream &  ostr,
const object_links< L > &  links 
)
related