Version: 8.3.0
YACS::HMI::SubjectServiceNode Class Reference

#include <guiObservers.hxx>

Inheritance diagram for YACS::HMI::SubjectServiceNode:
Collaboration diagram for YACS::HMI::SubjectServiceNode:

Public Member Functions

 SubjectServiceNode (YACS::ENGINE::ServiceNode *serviceNode, Subject *parent)
 
virtual ~SubjectServiceNode ()
 
virtual void setComponentFromCatalog (YACS::ENGINE::Catalog *catalog, std::string compo, std::string service)
 
virtual void setComponent ()
 
virtual bool associateToComponent (SubjectComponent *subcomp)
 
virtual void removeSubRefComponent ()
 
virtual void removeSubjectReference ()
 
virtual void addSubjectReference (Subject *ref)
 
virtual SubjectReferencegetSubjectReference ()
 
virtual void clean (Command *command=0)
 
void localclean (Command *command=0)
 
- Public Member Functions inherited from YACS::HMI::SubjectElementaryNode
 SubjectElementaryNode (YACS::ENGINE::ElementaryNode *elementaryNode, Subject *parent)
 
virtual ~SubjectElementaryNode ()
 
virtual void recursiveUpdate (GuiEvent event, int type, Subject *son)
 
virtual SubjectDataPortaddInputPort (YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
 
virtual SubjectDataPortaddOutputPort (YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
 
virtual SubjectDataPortaddIDSPort (YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
 
virtual SubjectDataPortaddODSPort (YACS::ENGINE::Catalog *catalog, std::string type, std::string name)
 
virtual bool OrderDataPorts (SubjectDataPort *portToMove, int isUp)
 
virtual void removePort (SubjectDataPort *port)
 
virtual void loadChildren ()
 
void localclean (Command *command=0)
 
virtual void saveLinks ()
 
virtual void restoreLinks ()
 
- Public Member Functions inherited from YACS::HMI::SubjectNode
 SubjectNode (YACS::ENGINE::Node *node, Subject *parent)
 
virtual ~SubjectNode ()
 
virtual bool setProperties (std::map< std::string, std::string > properties)
 
virtual std::map< std::string,
std::string > 
getProperties ()
 
virtual bool reparent (Subject *parent)
 
virtual bool copy (Subject *parent)
 
virtual std::string getName ()
 
virtual bool setName (std::string name)
 
virtual YACS::ENGINE::NodegetNode ()
 
void registerUndoDestroy ()
 
SubjectControlLinkaddSubjectControlLink (SubjectControlLink *sub)
 
void removeSubjectControlLink (SubjectControlLink *sub)
 
std::list< SubjectLink * > getSubjectLinks () const
 
std::list< SubjectControlLink * > getSubjectControlLinks () const
 
std::list< SubjectInputPort * > getSubjectInputPorts () const
 
std::list< SubjectOutputPort * > getSubjectOutputPorts () const
 
std::list
< SubjectInputDataStreamPort * > 
getSubjectInputDataStreamPorts () const
 
std::list
< SubjectOutputDataStreamPort * > 
getSubjectOutputDataStreamPorts () const
 
void localclean (Command *command=0)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void removeExternalLinks ()
 
virtual void removeExternalControlLinks ()
 
virtual bool putInComposedNode (std::string name, std::string type, bool toSaveRestoreLinks=true)
 
virtual int isValid ()
 
void setExecState (int execState)
 
- 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 std::vector< std::string > knownProperties ()
 
virtual SubjectgetParent ()
 
virtual void setParent (Subject *son)
 
virtual bool destroy (Subject *son)
 From user action in Ihm, destroy an object. More...
 
virtual void loadLinks ()
 
void localclean (Command *command=0)
 
void registerUndoDestroy ()
 
void askRegisterUndoDestroy ()
 
bool isDestructible ()
 
virtual TypeOfElem getType ()
 
virtual void setProgress (std::string newProgress)
 
virtual std::string getProgress ()
 
- Public Member Functions inherited from YACS::ENGINE::Observer
virtual void notifyObserver2 (Node *object, const std::string &event, void *something)
 
virtual ~Observer ()
 

Protected Attributes

YACS::ENGINE::ServiceNode_serviceNode
 
SubjectReference_subjectReference
 
SubjectReference_subRefComponent
 
- Protected Attributes inherited from YACS::HMI::SubjectElementaryNode
YACS::ENGINE::ElementaryNode_elementaryNode
 
- Protected Attributes inherited from YACS::HMI::SubjectNode
YACS::ENGINE::Node_node
 
std::list< SubjectInputPort * > _listSubjectInputPort
 
std::list< SubjectOutputPort * > _listSubjectOutputPort
 
std::list
< SubjectInputDataStreamPort * > 
_listSubjectIDSPort
 
std::list
< SubjectOutputDataStreamPort * > 
_listSubjectODSPort
 
std::list< SubjectLink * > _listSubjectLink
 
std::list< SubjectControlLink * > _listSubjectControlLink
 
int _execState
 
std::list
< YACS::ENGINE::OutGate * > 
loutgate
 
std::list< YACS::ENGINE::InGate * > singate
 
std::vector< std::pair
< YACS::ENGINE::OutPort
*, YACS::ENGINE::InPort * > > 
dataLinks
 
std::vector< std::pair
< YACS::ENGINE::OutPort
*, YACS::ENGINE::InPort * > > 
dataflowLinks
 
- Protected Attributes inherited from YACS::HMI::Subject
std::set< GuiObserver * > _setObs
 
Subject_parent
 
bool _destructible
 
bool _askRegisterUndo
 
std::string _progress
 

Friends

class CommandAssociateServiceToComponent
 
class CommandAddComponentFromCatalog
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::SubjectNode
static bool tryCreateLink (SubjectNode *subOutNode, SubjectNode *subInNode)
 
- Protected Member Functions inherited from YACS::HMI::SubjectNode
virtual SubjectInputPortaddSubjectInputPort (YACS::ENGINE::InputPort *port, std::string name="")
 
virtual SubjectOutputPortaddSubjectOutputPort (YACS::ENGINE::OutputPort *port, std::string name="")
 
virtual
SubjectInputDataStreamPort
addSubjectIDSPort (YACS::ENGINE::InputDataStreamPort *port, std::string name="")
 
virtual
SubjectOutputDataStreamPort
addSubjectODSPort (YACS::ENGINE::OutputDataStreamPort *port, std::string name="")
 
virtual void notifyObserver (YACS::ENGINE::Node *object, const std::string &event)
 

Detailed Description

Definition at line 731 of file guiObservers.hxx.

Constructor & Destructor Documentation

SubjectServiceNode::SubjectServiceNode ( YACS::ENGINE::ServiceNode serviceNode,
Subject parent 
)

Definition at line 2346 of file guiObservers.cxx.

References _subjectReference, and _subRefComponent.

2347  : SubjectElementaryNode(serviceNode, parent), _serviceNode(serviceNode)
2348 {
2349  _subjectReference = 0;
2350  _subRefComponent = 0;
2351 }
SubjectServiceNode::~SubjectServiceNode ( )
virtual

Definition at line 2353 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectComponent, _serviceNode, YACS::HMI::SubjectProc::addPostErase(), DEBTRACE, YACS::ENGINE::ServiceNode::getComponent(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::SubjectNode::getName(), YACS::HMI::GuiContext::getSubjectProc(), and YACS::HMI::SubjectComponent::hasServices().

2354 {
2355  DEBTRACE("SubjectServiceNode::~SubjectServiceNode " << getName());
2357  if (!instance) return;
2358  if (GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
2359  {
2361  if (!scomp->hasServices())
2363  }
2364 }

Member Function Documentation

void SubjectServiceNode::addSubjectReference ( Subject ref)
virtual

Reimplemented from YACS::HMI::Subject.

Definition at line 2495 of file guiObservers.cxx.

References _subjectReference, YACS::HMI::ADDREF, DEBTRACE, YACS::HMI::Subject::getName(), YACS::HMI::SubjectNode::getName(), and YACS::HMI::SubjectNode::update().

Referenced by YACS::HMI::CommandAddComponentFromCatalog::localExecute(), and setComponent().

2496 {
2497  DEBTRACE("Subject::addSubjectReference " << getName() << " " << ref->getName());
2498  SubjectReference *son = new SubjectReference(ref, this);
2499  _subjectReference = son;
2500  update(ADDREF, 0, son);
2501 }
bool SubjectServiceNode::associateToComponent ( SubjectComponent subcomp)
virtual

Definition at line 2479 of file guiObservers.cxx.

References _serviceNode, _subjectReference, YACS::HMI::Invocator::add(), CommandAssociateServiceToComponent, DEBTRACE, YACS::HMI::Command::execute(), YACS::ENGINE::ComposedNode::getChildName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), YACS::HMI::SubjectNode::getName(), YACS::HMI::SubjectComponent::getName(), and YACS::HMI::GuiContext::getProc().

2480 {
2481  DEBTRACE("SubjectServiceNode::associateToComponent " << getName() << " " << subcomp->getName());
2482  SubjectReference* oldSReference = _subjectReference;
2485  new CommandAssociateServiceToComponent(aName, subcomp->getName());
2486  if (command->execute())
2487  {
2488  GuiContext::getCurrent()->getInvoc()->add(command);
2489  return true;
2490  }
2491  else delete command;
2492  return false;
2493 }
void SubjectServiceNode::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::SubjectElementaryNode.

Reimplemented in YACS::HMI::SubjectXmlNode, YACS::HMI::SubjectSalomePythonNode, YACS::HMI::SubjectSalomeNode, YACS::HMI::SubjectCppNode, and YACS::HMI::SubjectCORBANode.

Definition at line 2366 of file guiObservers.cxx.

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

Referenced by YACS::HMI::SubjectCORBANode::clean(), YACS::HMI::SubjectCppNode::clean(), YACS::HMI::SubjectSalomeNode::clean(), YACS::HMI::SubjectSalomePythonNode::clean(), and YACS::HMI::SubjectXmlNode::clean().

2367 {
2368  if (_askRegisterUndo)
2369  {
2370  _askRegisterUndo = false;
2372  }
2373  localclean(command);
2375 }
SubjectReference * SubjectServiceNode::getSubjectReference ( )
virtual

Definition at line 2503 of file guiObservers.cxx.

References _subjectReference.

Referenced by YACS::HMI::EditionSalomeNode::changeContainer().

2504 {
2505  return _subjectReference;
2506 }
void SubjectServiceNode::localclean ( Command command = 0)

Definition at line 2377 of file guiObservers.cxx.

References _subjectReference, _subRefComponent, DEBTRACE, YACS::HMI::Subject::erase(), YACS::HMI::Subject::getParent(), and YACS::HMI::SubjectComponent::removeSubServiceFromSet().

Referenced by clean().

2378 {
2379  DEBTRACE("SubjectServiceNode::localClean ");
2380  if (_subRefComponent)
2381  {
2382  SubjectComponent *scomp = dynamic_cast<SubjectComponent*>(_subRefComponent->getParent());
2383  if (scomp)
2384  scomp->removeSubServiceFromSet(this);
2385  }
2386  if (_subjectReference)
2387  {
2388 // update( REMOVE, REFERENCE, _subjectReference );
2390  _subjectReference = 0;
2391  }
2392  if (_subRefComponent)
2393  {
2395  _subRefComponent = 0;
2396  }
2397 }
virtual void YACS::HMI::SubjectServiceNode::removeSubjectReference ( )
inlinevirtual

Definition at line 744 of file guiObservers.hxx.

References _subjectReference.

744 { _subjectReference = 0; };
virtual void YACS::HMI::SubjectServiceNode::removeSubRefComponent ( )
inlinevirtual

Definition at line 743 of file guiObservers.hxx.

References _subRefComponent.

Referenced by YACS::HMI::SubjectComponent::detachService().

743 { _subRefComponent = 0; };
void SubjectServiceNode::setComponent ( )
virtual

When loading scheme from file, get the component associated to the node, if any, and create the corresponding subject.

Definition at line 2427 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectComponent, _serviceNode, _subRefComponent, YACS::HMI::SubjectProc::addSubjectComponent(), YACS::HMI::SubjectProc::addSubjectContainer(), addSubjectReference(), YACS::HMI::SubjectComponent::attachService(), YACS::ENGINE::Container::cloneAlways(), YACS::ENGINE::Proc::componentInstanceMap, YACS::ENGINE::Proc::containerMap, DEBTRACE, YACS::ENGINE::ComponentInstance::getCompoName(), YACS::ENGINE::ServiceNode::getComponent(), YACS::ENGINE::ComponentInstance::getContainer(), YACS::HMI::GuiContext::getCurrent(), YACS::ENGINE::ComponentInstance::getInstanceName(), YACS::ENGINE::Container::getName(), YACS::HMI::GuiContext::getProc(), YACS::HMI::GuiContext::getSubjectProc(), YACS::HMI::SubjectComponent::moveService(), YACS::ENGINE::ComponentInstance::setContainer(), and YASSERT.

2428 {
2429  DEBTRACE("SubjectServiceNode::setComponent");
2431  if (instance)
2432  {
2433  Proc* proc = GuiContext::getCurrent()->getProc();
2434  string compo = instance->getCompoName();
2435  SubjectComponent* subCompo = 0;
2436  if (! GuiContext::getCurrent()->_mapOfSubjectComponent.count(instance))
2437  {
2438  DEBTRACE("SubjectServiceNode::setComponent : create subject for compo = " << compo.c_str());
2439  if(proc->componentInstanceMap.count(instance->getInstanceName())==0)
2440  {
2441  std::cerr << "PROBLEM : ComponentInstance should be registered in proc, add it " << instance->getInstanceName() << std::endl;
2442  proc->componentInstanceMap[instance->getInstanceName()] = instance;
2443  Container* cont=instance->getContainer();
2444  //check if the associated container is consistent with containerMap
2445  if(cont)
2446  if (proc->containerMap.count(cont->getName()) == 0)
2447  {
2448  //container exists but is not in containerMap. Clone it, it's probably the result of copy paste from outside the proc
2449  Container* newcont(cont->cloneAlways());
2450  proc->containerMap[cont->getName()]=newcont;
2451  instance->setContainer(newcont);
2452  GuiContext::getCurrent()->getSubjectProc()->addSubjectContainer(newcont, newcont->getName());
2453  }
2454  else
2455  {
2456  if(cont != proc->containerMap[cont->getName()])
2457  {
2458  //the associated container is not the same as the one in containerMap: use the containerMap one
2459  instance->setContainer(proc->containerMap[cont->getName()]);
2460  }
2461  }
2462  }
2463  subCompo = GuiContext::getCurrent()->getSubjectProc()->addSubjectComponent(instance);
2464  }
2465  else
2466  {
2467  DEBTRACE("SubjectServiceNode::setComponent : get already created subject for compo = " <<compo.c_str());
2468  subCompo = GuiContext::getCurrent()->_mapOfSubjectComponent[instance];
2469  }
2470  YASSERT(subCompo);
2471  addSubjectReference(subCompo);
2472  if (_subRefComponent)
2473  subCompo->moveService(_subRefComponent);
2474  else
2475  _subRefComponent = subCompo->attachService(this);
2476  }
2477 }
void SubjectServiceNode::setComponentFromCatalog ( YACS::ENGINE::Catalog catalog,
std::string  compo,
std::string  service 
)
virtual

When cloning a service node from a catalog, create the component associated to the node, if not already existing, and create the corresponding subject.

Definition at line 2404 of file guiObservers.cxx.

References YACS::HMI::SubjectNode::_node, YACS::HMI::Invocator::add(), CommandAddComponentFromCatalog, DEBTRACE, YACS::HMI::Command::execute(), YACS::ENGINE::ComposedNode::getChildName(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), and YACS::HMI::GuiContext::getProc().

2407 {
2408  DEBTRACE("SubjectServiceNode::setComponentFromCatalog " << compo);
2409 
2410  Proc* proc = GuiContext::getCurrent()->getProc();
2411  string position = proc->getChildName(_node);
2413  new CommandAddComponentFromCatalog(catalog,
2414  position,
2415  compo,
2416  service);
2417  if (command->execute())
2418  GuiContext::getCurrent()->getInvoc()->add(command);
2419  else delete command;
2420  return;
2421 }

Friends And Related Function Documentation

friend class CommandAddComponentFromCatalog
friend

Definition at line 734 of file guiObservers.hxx.

Referenced by setComponentFromCatalog().

Definition at line 733 of file guiObservers.hxx.

Referenced by associateToComponent().

Member Data Documentation

YACS::ENGINE::ServiceNode* YACS::HMI::SubjectServiceNode::_serviceNode
protected
SubjectReference* YACS::HMI::SubjectServiceNode::_subjectReference
protected

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