fawkes::OneToManyDependency< Provider, Dependant > Class Template Reference
One-to-Many dependency constraint. More...
#include <utils/constraints/dependency_onetomany.h>
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
template<class Provider, class Dependant>
class fawkes::OneToManyDependency< Provider, Dependant >
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.
Definition at line 51 of file dependency_onetomany.h.
Constructor & Destructor Documentation
| fawkes::OneToManyDependency< Provider, Dependant >::OneToManyDependency | ( | ) | [inline] |
| fawkes::OneToManyDependency< Provider, Dependant >::~OneToManyDependency | ( | ) | [inline, virtual] |
Member Function Documentation
| void fawkes::OneToManyDependency< Provider, Dependant >::add | ( | Dependant * | d | ) | [inline, virtual] |
Add dependant object.
This will add the dependant to this dependency or throw an exception if there is no provider.
- Parameters:
-
d dependant object to add
- Exceptions:
-
DependencyViolationException thrown, if no provider has been set
Definition at line 119 of file dependency_onetomany.h.
| void fawkes::OneToManyDependency< Provider, Dependant >::add | ( | Provider * | p | ) | [inline, virtual] |
Add provider object.
This will add the provider to this dependency or throw an exception if there is already a provider.
- Parameters:
-
p provider object to add
- Exceptions:
-
DependencyViolationException thrown, if a second provider is added
Definition at line 101 of file dependency_onetomany.h.
| bool fawkes::OneToManyDependency< Provider, Dependant >::can_add | ( | Dependant * | d | ) | [inline, virtual] |
Check if dependant can be added.
- Parameters:
-
d dependant object to add
- Returns:
- true, if add(d) would succeed, false otherwise
Definition at line 177 of file dependency_onetomany.h.
| bool fawkes::OneToManyDependency< Provider, Dependant >::can_add | ( | Provider * | p | ) | [inline, virtual] |
Check if provider can be added.
- Parameters:
-
p provider object to add
- Returns:
- true, if add(p) would succeed, false otherwise
Definition at line 165 of file dependency_onetomany.h.
| bool fawkes::OneToManyDependency< Provider, Dependant >::can_remove | ( | Dependant * | d | ) | [inline, virtual] |
Check if dependant can be removed.
- Parameters:
-
d depending object to remove
- Returns:
- always true
Definition at line 201 of file dependency_onetomany.h.
| bool fawkes::OneToManyDependency< Provider, Dependant >::can_remove | ( | Provider * | p | ) | [inline, virtual] |
Check if provider can be removed.
- Parameters:
-
p provider object to remove
- Returns:
- true, if remove(p) would succeed, false otherwise
Definition at line 189 of file dependency_onetomany.h.
| std::list< Dependant * > & fawkes::OneToManyDependency< Provider, Dependant >::dependants | ( | ) | [inline, virtual] |
| Provider * fawkes::OneToManyDependency< Provider, Dependant >::provider | ( | ) | [inline, virtual] |
Get provider.
- Returns:
- provider if set, NULL otherwise
Definition at line 212 of file dependency_onetomany.h.
| void fawkes::OneToManyDependency< Provider, Dependant >::remove | ( | Dependant * | d | ) | [inline, virtual] |
Remove a depending object.
- Parameters:
-
d depending object to remove
Definition at line 151 of file dependency_onetomany.h.
| void fawkes::OneToManyDependency< Provider, Dependant >::remove | ( | Provider * | p | ) | [inline, virtual] |
Remove provider object.
- Parameters:
-
p provider object to remove
- Exceptions:
-
DependencyViolationException thrown, if the provider should be removed while there is still at least one dependant.
Definition at line 136 of file dependency_onetomany.h.
The documentation for this class was generated from the following file:
- src/libs/utils/constraints/dependency_onetomany.h

