Version: 8.3.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 ~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 888 of file guiObservers.hxx.

Constructor & Destructor Documentation

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

Definition at line 3997 of file guiObservers.cxx.

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

4002  : Subject(parent),
4003  _subOutNode(subOutNode), _outPort(outPort), _subInNode(subInNode), _inPort(inPort)
4004 {
4005  _name = "";
4006  ComposedNode *cla = ComposedNode::getLowestCommonAncestor(_subOutNode->getNode()->getFather(),
4007  _subInNode->getNode()->getFather());
4008  DEBTRACE(_subOutNode->getName() << "." << _outPort->getName());
4009  DEBTRACE(_subInNode->getName() << "." << _inPort->getName());
4010  DEBTRACE(cla->getName());
4011  _name += cla->getChildName(_subOutNode->getNode());
4012  _name += "." + _outPort->getName();
4013  _name += "->";
4014  _name += cla->getChildName(_subInNode->getNode());
4015  _name += "." + _inPort->getName();
4016  DEBTRACE("SubjectLink::SubjectLink " << _name);
4017 }
SubjectLink::~SubjectLink ( )
virtual

Definition at line 4019 of file guiObservers.cxx.

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

4020 {
4021  DEBTRACE("SubjectLink::~SubjectLink " << getName());
4024 }

Member Function Documentation

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 4026 of file guiObservers.cxx.

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

4027 {
4028  if (_askRegisterUndo)
4029  {
4030  _askRegisterUndo = false;
4032  }
4033  localclean(command);
4034  Subject::clean(command);
4035 }
std::string SubjectLink::getName ( )
virtual
std::map< std::string, std::string > SubjectLink::getProperties ( )
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 4062 of file guiObservers.cxx.

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

Referenced by registerUndoDestroy().

4063 {
4064  return getSubjectInPort()->getProperties();
4065 }
SubjectNode* YACS::HMI::SubjectLink::getSubjectInNode ( )
inline

Definition at line 901 of file guiObservers.hxx.

References _subInNode.

Referenced by registerUndoDestroy().

901 { return _subInNode; };
SubjectNode* YACS::HMI::SubjectLink::getSubjectOutNode ( )
inline

Definition at line 900 of file guiObservers.hxx.

References _subOutNode.

Referenced by registerUndoDestroy().

900 { return _subOutNode; };
SubjectDataPort* YACS::HMI::SubjectLink::getSubjectOutPort ( )
inline
virtual TypeOfElem YACS::HMI::SubjectLink::getType ( )
inlinevirtual

Reimplemented from YACS::HMI::Subject.

Definition at line 907 of file guiObservers.hxx.

References YACS::HMI::DATALINK.

907 {return DATALINK;}
std::vector< std::string > SubjectLink::knownProperties ( )
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 4067 of file guiObservers.cxx.

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

4068 {
4069  return getSubjectInPort()->knownProperties();
4070 }
void SubjectLink::localclean ( Command command = 0)

Definition at line 4037 of file guiObservers.cxx.

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

Referenced by clean().

4038 {
4039  DEBTRACE("SubjectLink::localClean ");
4040  if (_parent)
4041  {
4042  DEBTRACE("clean link: " << _parent->getName() << " " << getName());
4043  SubjectComposedNode* father = dynamic_cast<SubjectComposedNode*>(_parent);
4044  YASSERT(father);
4045  father->removeLink(this); // --- clean subjects first
4046  _cla = dynamic_cast<ComposedNode*>(father->getNode());
4047  YASSERT(_cla);
4048  _outp = dynamic_cast<OutPort*>(_outPort->getPort());
4049  YASSERT(_outp);
4050  _inp = dynamic_cast<InPort*>(_inPort->getPort());
4051  YASSERT(_inp);
4052  if (isDestructible())
4054  }
4055 }
void SubjectLink::registerUndoDestroy ( )

Definition at line 4088 of file guiObservers.cxx.

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 YACS::HMI::Subject::getType().

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

4089 {
4090  DEBTRACE("SubjectLink::registerUndoDestroy");
4091  Proc *proc = GuiContext::getCurrent()->getProc();
4092  Node *outn = getSubjectOutNode()->getNode();
4093  Node *inn = getSubjectInNode()->getNode();
4094  DataPort *outp = getSubjectOutPort()->getPort();
4095  DataPort *inp = getSubjectInPort()->getPort();
4096  CommandAddLink *command = new CommandAddLink(proc->getChildName(outn),
4097  outp->getName(),
4099  proc->getChildName(inn),
4100  inp->getName(),
4102  false);
4103  GuiContext::getCurrent()->getInvoc()->add(command);
4104 
4105  map<string, string> properties = getProperties();
4106  if (properties.empty())
4107  return;
4108 
4110  outp->getName(),
4111  proc->getChildName(inn),
4112  inp->getName(),
4113  properties);
4114  GuiContext::getCurrent()->getInvoc()->add(command2);
4115 }
bool SubjectLink::setProperties ( std::map< std::string, std::string >  properties)
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 4072 of file guiObservers.cxx.

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

4073 {
4074  Proc *proc = GuiContext::getCurrent()->getProc();
4075  CommandSetLinkProperties *command =
4076  new CommandSetLinkProperties(proc->getChildName(getSubjectOutPort()->getPort()->getNode()), getSubjectOutPort()->getName(),
4077  proc->getChildName(getSubjectInPort()->getPort()->getNode()), getSubjectInPort()->getName(),
4078  properties);
4079  if (command->execute())
4080  {
4081  GuiContext::getCurrent()->getInvoc()->add(command);
4082  return true;
4083  }
4084  else delete command;
4085  return false;
4086 }

Member Data Documentation

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

Definition at line 915 of file guiObservers.hxx.

Referenced by localclean().

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

Definition at line 917 of file guiObservers.hxx.

Referenced by localclean().

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

Definition at line 913 of file guiObservers.hxx.

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

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

Definition at line 914 of file guiObservers.hxx.

Referenced by getName(), and SubjectLink().

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

Definition at line 916 of file guiObservers.hxx.

Referenced by localclean().

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

Definition at line 911 of file guiObservers.hxx.

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

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

Definition at line 912 of file guiObservers.hxx.

Referenced by getSubjectInNode(), and SubjectLink().

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

Definition at line 910 of file guiObservers.hxx.

Referenced by getSubjectOutNode(), and SubjectLink().


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