Version: 9.15.0
YACS::HMI::SubjectLink Class Reference

#include <guiObservers.hxx>

Inheritance diagram for YACS::HMI::SubjectLink:
Collaboration diagram for YACS::HMI::SubjectLink:

Public Member Functions

 SubjectLink (SubjectNode *subOutNode, SubjectDataPort *outPort, SubjectNode *subInNode, SubjectDataPort *inPort, Subject *parent)
 
virtual ~SubjectLink ()
 
virtual std::string getName ()
 
virtual void clean (Command *command=0)
 
void localclean (Command *command=0)
 
SubjectNodegetSubjectOutNode ()
 
SubjectNodegetSubjectInNode ()
 
SubjectDataPortgetSubjectOutPort ()
 
SubjectDataPortgetSubjectInPort ()
 
virtual bool setProperties (std::map< std::string, std::string > properties)
 
virtual std::map< std::string, std::string > getProperties ()
 
virtual std::vector< std::string > knownProperties ()
 
virtual TypeOfElem getType ()
 
void registerUndoDestroy ()
 
- Public Member Functions inherited from YACS::HMI::Subject
 Subject (Subject *parent=0)
 
virtual ~Subject ()
 
virtual void attach (GuiObserver *obs)
 
virtual void detach (GuiObserver *obs)
 
virtual void select (bool isSelected)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual bool setName (std::string name)
 
virtual SubjectgetParent ()
 
virtual void setParent (Subject *son)
 
virtual bool destroy (Subject *son)
 From user action in Ihm, destroy an object. More...
 
virtual void loadChildren ()
 
virtual void loadLinks ()
 
virtual void addSubjectReference (Subject *ref)
 
void localclean (Command *command=0)
 
void registerUndoDestroy ()
 
void askRegisterUndoDestroy ()
 
bool isDestructible ()
 
virtual void setProgress (std::string newProgress)
 
virtual std::string getProgress ()
 
- Public Member Functions inherited from YACS::ENGINE::Observer
virtual void notifyObserver (Node *object, const std::string &event)
 
virtual void notifyObserver2 (Node *object, const std::string &event, void *something)
 
virtual void notifyObserverFromClone (Node *originalInstance, const std::string &event, Node *clonedInstanceGeneratingEvent)
 
virtual ~Observer ()
 

Protected Attributes

SubjectNode_subOutNode
 
SubjectDataPort_outPort
 
SubjectNode_subInNode
 
SubjectDataPort_inPort
 
std::string _name
 
YACS::ENGINE::ComposedNode_cla
 
YACS::ENGINE::OutPort_outp
 
YACS::ENGINE::InPort_inp
 
- Protected Attributes inherited from YACS::HMI::Subject
std::set< GuiObserver * > _setObs
 
Subject_parent
 
bool _destructible
 
bool _askRegisterUndo
 
std::string _progress
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::Subject
static void erase (Subject *sub, Command *command=0, bool post=false)
 

Detailed Description

Definition at line 889 of file guiObservers.hxx.

Constructor & Destructor Documentation

◆ SubjectLink()

SubjectLink::SubjectLink ( SubjectNode subOutNode,
SubjectDataPort outPort,
SubjectNode subInNode,
SubjectDataPort inPort,
Subject parent 
)

Definition at line 4000 of file guiObservers.cxx.

4005  : Subject(parent),
4006  _subOutNode(subOutNode), _outPort(outPort), _subInNode(subInNode), _inPort(inPort)
4007 {
4008  _name = "";
4009  ComposedNode *cla = ComposedNode::getLowestCommonAncestor(_subOutNode->getNode()->getFather(),
4010  _subInNode->getNode()->getFather());
4011  DEBTRACE(_subOutNode->getName() << "." << _outPort->getName());
4012  DEBTRACE(_subInNode->getName() << "." << _inPort->getName());
4013  DEBTRACE(cla->getName());
4014  _name += cla->getChildName(_subOutNode->getNode());
4015  _name += "." + _outPort->getName();
4016  _name += "->";
4017  _name += cla->getChildName(_subInNode->getNode());
4018  _name += "." + _inPort->getName();
4019  DEBTRACE("SubjectLink::SubjectLink " << _name);
4020 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Base class for all composed nodes.
std::string getChildName(const Node *node) const
std::string getName() const
ComposedNode * getFather() const
Definition: Node.hxx:127
virtual std::string getName()
virtual std::string getName()
virtual YACS::ENGINE::Node * getNode()
Subject(Subject *parent=0)

References _inPort, _name, _outPort, _subInNode, _subOutNode, DEBTRACE, YACS::ENGINE::ComposedNode::getChildName(), YACS::ENGINE::Node::getFather(), YACS::HMI::SubjectDataPort::getName(), YACS::HMI::SubjectNode::getName(), YACS::ENGINE::ComposedNode::getName(), and YACS::HMI::SubjectNode::getNode().

◆ ~SubjectLink()

SubjectLink::~SubjectLink ( )
virtual

Definition at line 4022 of file guiObservers.cxx.

4023 {
4024  DEBTRACE("SubjectLink::~SubjectLink " << getName());
4027 }
virtual void update(GuiEvent event, int type, Subject *son)

References _inPort, _outPort, YACS::HMI::DATALINK, DEBTRACE, getName(), YACS::HMI::UPDATE, and YACS::HMI::Subject::update().

Member Function Documentation

◆ clean()

void SubjectLink::clean ( Command command = 0)
virtual

Clean process prior to delete is redefined in derived classes: a local clean treatment relative to the derived class, then a call to the parent class clean method.

Reimplemented from YACS::HMI::Subject.

Definition at line 4029 of file guiObservers.cxx.

4030 {
4031  if (_askRegisterUndo)
4032  {
4033  _askRegisterUndo = false;
4035  }
4036  localclean(command);
4037  Subject::clean(command);
4038 }
virtual void clean(Command *command=0)

References YACS::HMI::Subject::_askRegisterUndo, YACS::HMI::Subject::clean(), localclean(), and registerUndoDestroy().

◆ getName()

◆ getProperties()

std::map< std::string, std::string > SubjectLink::getProperties ( )
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 4065 of file guiObservers.cxx.

4066 {
4067  return getSubjectInPort()->getProperties();
4068 }
virtual std::map< std::string, std::string > getProperties()

References YACS::HMI::Subject::getProperties(), and getSubjectInPort().

Referenced by registerUndoDestroy().

◆ getSubjectInNode()

SubjectNode* YACS::HMI::SubjectLink::getSubjectInNode ( )
inline

Definition at line 902 of file guiObservers.hxx.

902 { return _subInNode; };

References _subInNode.

Referenced by registerUndoDestroy().

◆ getSubjectInPort()

◆ getSubjectOutNode()

SubjectNode* YACS::HMI::SubjectLink::getSubjectOutNode ( )
inline

Definition at line 901 of file guiObservers.hxx.

901 { return _subOutNode; };

References _subOutNode.

Referenced by registerUndoDestroy().

◆ getSubjectOutPort()

SubjectDataPort* YACS::HMI::SubjectLink::getSubjectOutPort ( )
inline

◆ getType()

virtual TypeOfElem YACS::HMI::SubjectLink::getType ( )
inlinevirtual

Reimplemented from YACS::HMI::Subject.

Definition at line 908 of file guiObservers.hxx.

908 {return DATALINK;}

References YACS::HMI::DATALINK.

Referenced by registerUndoDestroy().

◆ knownProperties()

std::vector< std::string > SubjectLink::knownProperties ( )
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 4070 of file guiObservers.cxx.

4071 {
4072  return getSubjectInPort()->knownProperties();
4073 }
virtual std::vector< std::string > knownProperties()

References getSubjectInPort(), and YACS::HMI::Subject::knownProperties().

◆ localclean()

void SubjectLink::localclean ( Command command = 0)

Definition at line 4040 of file guiObservers.cxx.

4041 {
4042  DEBTRACE("SubjectLink::localClean ");
4043  if (_parent)
4044  {
4045  DEBTRACE("clean link: " << _parent->getName() << " " << getName());
4046  SubjectComposedNode* father = dynamic_cast<SubjectComposedNode*>(_parent);
4047  YASSERT(father);
4048  father->removeLink(this); // --- clean subjects first
4049  _cla = dynamic_cast<ComposedNode*>(father->getNode());
4050  YASSERT(_cla);
4051  _outp = dynamic_cast<OutPort*>(_outPort->getPort());
4052  YASSERT(_outp);
4053  _inp = dynamic_cast<InPort*>(_inPort->getPort());
4054  YASSERT(_inp);
4055  if (isDestructible())
4057  }
4058 }
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
void edRemoveLink(OutPort *start, InPort *end)
Remove a dataflow link.
virtual void removeLink(SubjectLink *link)
virtual YACS::ENGINE::DataPort * getPort()
virtual std::string getName()

References _cla, _inp, _inPort, _outp, _outPort, YACS::HMI::Subject::_parent, DEBTRACE, YACS::ENGINE::ComposedNode::edRemoveLink(), YACS::HMI::Subject::getName(), getName(), YACS::HMI::SubjectNode::getNode(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::Subject::isDestructible(), YACS::HMI::SubjectComposedNode::removeLink(), and YASSERT.

Referenced by clean().

◆ registerUndoDestroy()

void SubjectLink::registerUndoDestroy ( )

Definition at line 4091 of file guiObservers.cxx.

4092 {
4093  DEBTRACE("SubjectLink::registerUndoDestroy");
4094  Proc *proc = GuiContext::getCurrent()->getProc();
4095  Node *outn = getSubjectOutNode()->getNode();
4096  Node *inn = getSubjectInNode()->getNode();
4097  DataPort *outp = getSubjectOutPort()->getPort();
4098  DataPort *inp = getSubjectInPort()->getPort();
4099  CommandAddLink *command = new CommandAddLink(proc->getChildName(outn),
4100  outp->getName(),
4102  proc->getChildName(inn),
4103  inp->getName(),
4105  false);
4106  GuiContext::getCurrent()->getInvoc()->add(command);
4107 
4108  map<string, string> properties = getProperties();
4109  if (properties.empty())
4110  return;
4111 
4113  outp->getName(),
4114  proc->getChildName(inn),
4115  inp->getName(),
4116  properties);
4117  GuiContext::getCurrent()->getInvoc()->add(command2);
4118 }
std::string getName() const
Definition: DataPort.hxx:55
Base class for all nodes.
Definition: Node.hxx:70
Base class for all schema objects.
Definition: Proc.hxx:44
YACS::ENGINE::Proc * getProc()
Definition: guiContext.hxx:50
YACS::HMI::ProcInvoc * getInvoc()
Definition: guiContext.hxx:51
static GuiContext * getCurrent()
Definition: guiContext.hxx:67
void add(Command *command)
Definition: commands.cxx:156

References YACS::HMI::Invocator::add(), DEBTRACE, YACS::ENGINE::ComposedNode::getChildName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), YACS::ENGINE::DataPort::getName(), YACS::HMI::SubjectNode::getNode(), YACS::HMI::SubjectDataPort::getPort(), YACS::HMI::GuiContext::getProc(), getProperties(), getSubjectInNode(), getSubjectInPort(), getSubjectOutNode(), getSubjectOutPort(), and getType().

Referenced by clean(), and YACS::HMI::SubjectNode::registerUndoDestroy().

◆ setProperties()

bool SubjectLink::setProperties ( std::map< std::string, std::string >  properties)
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 4075 of file guiObservers.cxx.

4076 {
4077  Proc *proc = GuiContext::getCurrent()->getProc();
4078  CommandSetLinkProperties *command =
4079  new CommandSetLinkProperties(proc->getChildName(getSubjectOutPort()->getPort()->getNode()), getSubjectOutPort()->getName(),
4080  proc->getChildName(getSubjectInPort()->getPort()->getNode()), getSubjectInPort()->getName(),
4081  properties);
4082  if (command->execute())
4083  {
4084  GuiContext::getCurrent()->getInvoc()->add(command);
4085  return true;
4086  }
4087  else delete command;
4088  return false;
4089 }
virtual bool execute()
the command is executed a first time after its registration for undo redo, then on redo
Definition: commands.cxx:51

References YACS::HMI::Invocator::add(), YACS::HMI::Command::execute(), YACS::ENGINE::ComposedNode::getChildName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), getName(), YACS::HMI::GuiContext::getProc(), getSubjectInPort(), and getSubjectOutPort().

Member Data Documentation

◆ _cla

YACS::ENGINE::ComposedNode* YACS::HMI::SubjectLink::_cla
protected

Definition at line 916 of file guiObservers.hxx.

Referenced by localclean().

◆ _inp

YACS::ENGINE::InPort* YACS::HMI::SubjectLink::_inp
protected

Definition at line 918 of file guiObservers.hxx.

Referenced by localclean().

◆ _inPort

SubjectDataPort* YACS::HMI::SubjectLink::_inPort
protected

Definition at line 914 of file guiObservers.hxx.

Referenced by getSubjectInPort(), localclean(), SubjectLink(), and ~SubjectLink().

◆ _name

std::string YACS::HMI::SubjectLink::_name
protected

Definition at line 915 of file guiObservers.hxx.

Referenced by getName(), and SubjectLink().

◆ _outp

YACS::ENGINE::OutPort* YACS::HMI::SubjectLink::_outp
protected

Definition at line 917 of file guiObservers.hxx.

Referenced by localclean().

◆ _outPort

SubjectDataPort* YACS::HMI::SubjectLink::_outPort
protected

Definition at line 912 of file guiObservers.hxx.

Referenced by getSubjectOutPort(), localclean(), SubjectLink(), and ~SubjectLink().

◆ _subInNode

SubjectNode* YACS::HMI::SubjectLink::_subInNode
protected

Definition at line 913 of file guiObservers.hxx.

Referenced by getSubjectInNode(), and SubjectLink().

◆ _subOutNode

SubjectNode* YACS::HMI::SubjectLink::_subOutNode
protected

Definition at line 911 of file guiObservers.hxx.

Referenced by getSubjectOutNode(), and SubjectLink().


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