#include <AbstractDataLink.h>
AbstractDataLink is the base class for every link between two data fields The targeted BaseData is called the "target", The base object owning the current "child" object is the "owner" it is possible to store a path in a DataLink, in that case, at each DataLink access the path is resolved to search for a corresponding Data until one is found. Once a Data is set, the path is discarded. More...
AbstractDataLink is the base class for every link between two data fields The targeted BaseData is called the "target", The base object owning the current "child" object is the "owner" it is possible to store a path in a DataLink, in that case, at each DataLink access the path is resolved to search for a corresponding Data until one is found. Once a Data is set, the path is discarded.
Protected Attributes | |
std::string | m_path {""} |
Public Member Functions | |
const BaseData & | getOwner () const |
void | setTarget (BaseData *target) |
Change the targeted DataField and set the path to the empty string. More... | |
BaseData * | getTarget () const |
Get the targeted DataField. More... | |
bool | hasTarget () const |
Returns true if there is a target. More... | |
const std::string | getPath () const |
Get the path (is any) More... | |
void | setPath (const std::string &path) |
Set the path, try to resolve it, on success set the DataField. More... | |
bool | hasPath () const |
Returns true if the path is set (and thus getTarget() == nullptr) More... | |
bool | resolvePathAndSetTarget () |
BaseData * | resolvePathAndGetTarget () |
|
protected |
const BaseData & sofa::core::objectmodel::AbstractDataLink::getOwner | ( | ) | const |
Returns the BaseData object that this DataLink belong to. There is a one to one owner relationship. A BaseData have one and only one DataLink object. A DataLink object has one and only one BaseData as owner.
Get the DataField having thins link as an attribute there is a one to one owner relationship.
const std::string sofa::core::objectmodel::AbstractDataLink::getPath | ( | ) | const |
Get the path (is any)
BaseData * sofa::core::objectmodel::AbstractDataLink::getTarget | ( | ) | const |
Get the targeted DataField.
bool sofa::core::objectmodel::AbstractDataLink::hasPath | ( | ) | const |
Returns true if the path is set (and thus getTarget() == nullptr)
bool sofa::core::objectmodel::AbstractDataLink::hasTarget | ( | ) | const |
Returns true if there is a target.
BaseData * sofa::core::objectmodel::AbstractDataLink::resolvePathAndGetTarget | ( | ) |
Get the targeted DataField If there is no path set, returns nullptr If there is no owner set, returns nullptr If there is no compatible Data at pointed path, returns nullptr Otherwise, returns pointed target.
bool sofa::core::objectmodel::AbstractDataLink::resolvePathAndSetTarget | ( | ) |
void sofa::core::objectmodel::AbstractDataLink::setPath | ( | const std::string & | path | ) |
Set the path, try to resolve it, on success set the DataField.
void sofa::core::objectmodel::AbstractDataLink::setTarget | ( | BaseData * | target | ) |
Change the targeted DataField and set the path to the empty string.
Change the targeted DataField.