Fawkes API  Fawkes Development Version
fawkes::OneToManyDependency Class Reference

One-to-Many dependency constraint. More...

#include <>>

Inheritance diagram for fawkes::OneToManyDependency:

List of all members.

Public Member Functions

 OneToManyDependency ()
 Constructor.
virtual ~OneToManyDependency ()
 Destructor.
virtual void add (Provider *p)
 Add provider object.
virtual void add (Dependant *d)
 Add dependant object.
virtual void remove (Provider *p)
 Remove provider object.
virtual void remove (Dependant *d)
 Remove a depending object.
virtual bool can_add (Provider *p)
 Check if provider can be added.
virtual bool can_add (Dependant *d)
 Check if dependant can be added.
virtual bool can_remove (Provider *p)
 Check if provider can be removed.
virtual bool can_remove (Dependant *d)
 Check if dependant can be removed.
virtual Provider * provider ()
 Get provider.
virtual std::list< Dependant * > & dependants ()
 Get dependants.

Detailed Description

One-to-Many dependency constraint.

This dependency constraint models a 1-to-n relationship. There is one object called provider, that any number of other objects (dependants) rely on.

The provider is unique and only one provider may exist at any one time. There may be an arbitrary number of dependants. Dependants may only be added if there is already a provider.

Dependants can always be removed. The provider can only be removed if there are no more dependants.

Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::OneToManyDependency::OneToManyDependency ( )

Constructor.

Definition at line 78 of file dependency_onetomany.h.

fawkes::OneToManyDependency::~OneToManyDependency ( ) [virtual]

Destructor.

Definition at line 87 of file dependency_onetomany.h.


Member Function Documentation

void fawkes::OneToManyDependency::add ( Provider *  p) [virtual]

Add provider object.

This will add the provider to this dependency or throw an exception if there is already a provider.

Parameters:
pprovider object to add
Exceptions:
DependencyViolationExceptionthrown, if a second provider is added

Definition at line 101 of file dependency_onetomany.h.

Referenced by fawkes::VisionMasterAspectIniFin::init(), and fawkes::VisionMasterAspectIniFin::add_vision_thread().

void fawkes::OneToManyDependency::add ( Dependant *  d) [virtual]

Add dependant object.

This will add the dependant to this dependency or throw an exception if there is no provider.

Parameters:
ddependant object to add
Exceptions:
DependencyViolationExceptionthrown, if no provider has been set

Definition at line 119 of file dependency_onetomany.h.

bool fawkes::OneToManyDependency::can_add ( Provider *  p) [virtual]

Check if provider can be added.

Parameters:
pprovider object to add
Returns:
true, if add(p) would succeed, false otherwise

Definition at line 165 of file dependency_onetomany.h.

bool fawkes::OneToManyDependency::can_add ( Dependant *  d) [virtual]

Check if dependant can be added.

Parameters:
ddependant object to add
Returns:
true, if add(d) would succeed, false otherwise

Definition at line 177 of file dependency_onetomany.h.

bool fawkes::OneToManyDependency::can_remove ( Provider *  p) [virtual]

Check if provider can be removed.

Parameters:
pprovider object to remove
Returns:
true, if remove(p) would succeed, false otherwise

Definition at line 189 of file dependency_onetomany.h.

Referenced by fawkes::VisionMasterAspectIniFin::prepare_finalize(), and fawkes::VisionMasterAspectIniFin::can_remove_vision_thread().

bool fawkes::OneToManyDependency::can_remove ( Dependant *  d) [virtual]

Check if dependant can be removed.

Parameters:
ddepending object to remove
Returns:
always true

Definition at line 201 of file dependency_onetomany.h.

std::list< Dependant * > & fawkes::OneToManyDependency::dependants ( ) [virtual]

Get dependants.

Returns:
list of dependants.

Definition at line 223 of file dependency_onetomany.h.

Provider * fawkes::OneToManyDependency::provider ( ) [virtual]

Get provider.

Returns:
provider if set, 0 otherwise

Definition at line 212 of file dependency_onetomany.h.

Referenced by fawkes::VisionMasterAspectIniFin::vision_master().

void fawkes::OneToManyDependency::remove ( Provider *  p) [virtual]

Remove provider object.

Parameters:
pprovider object to remove
Exceptions:
DependencyViolationExceptionthrown, if the provider should be removed while there is still at least one dependant.

Definition at line 136 of file dependency_onetomany.h.

Referenced by fawkes::VisionMasterAspectIniFin::finalize(), and fawkes::VisionMasterAspectIniFin::remove_vision_thread().

void fawkes::OneToManyDependency::remove ( Dependant *  d) [virtual]

Remove a depending object.

Parameters:
ddepending object to remove

Definition at line 151 of file dependency_onetomany.h.


The documentation for this class was generated from the following file: