Version: 8.3.0
YACS::HMI::SubjectProc Class Reference

#include <guiObservers.hxx>

Inheritance diagram for YACS::HMI::SubjectProc:
Collaboration diagram for YACS::HMI::SubjectProc:

Public Member Functions

 SubjectProc (YACS::ENGINE::Proc *proc, Subject *parent)
 
virtual ~SubjectProc ()
 
void loadProc ()
 
void loadComponents ()
 
void loadContainers ()
 
void loadTypes ()
 Load types for a SubjectProc. More...
 
virtual SubjectComponentaddComponent (std::string compoName, std::string containerName="")
 
virtual SubjectContainerBaseaddContainer (std::string name, std::string ref="")
 
virtual SubjectContainerBaseaddHPContainer (std::string name, std::string ref="")
 
virtual bool addDataType (YACS::ENGINE::Catalog *catalog, std::string typeName)
 
SubjectComponentaddSubjectComponent (YACS::ENGINE::ComponentInstance *compo)
 
SubjectContainerBaseaddSubjectContainer (YACS::ENGINE::Container *cont, std::string name="")
 
SubjectDataTypeaddComSubjectDataType (YACS::ENGINE::TypeCode *type, std::string alias)
 
SubjectDataTypeaddSubjectDataType (YACS::ENGINE::TypeCode *type, std::string alias)
 
void removeSubjectDataType (std::string typeName)
 
void removeSubjectContainer (SubjectContainerBase *scont)
 
virtual void clean (Command *command=0)
 
void localclean (Command *command=0)
 
void addPostErase (Subject *sub)
 
void cleanPostErase ()
 
virtual TypeOfElem getType ()
 
- Public Member Functions inherited from YACS::HMI::SubjectBloc
 SubjectBloc (YACS::ENGINE::Bloc *bloc, Subject *parent)
 
virtual ~SubjectBloc ()
 
virtual SubjectNodeaddNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst)
 
virtual void removeNode (SubjectNode *child)
 
virtual void completeChildrenSubjectList (SubjectNode *son)
 
virtual SubjectNodegetChild (YACS::ENGINE::Node *node=0) const
 
virtual void recursiveUpdate (GuiEvent event, int type, Subject *son)
 
virtual void houseKeepingAfterCutPaste (bool isCut, SubjectNode *son)
 
void localclean (Command *command=0)
 
- Public Member Functions inherited from YACS::HMI::SubjectComposedNode
 SubjectComposedNode (YACS::ENGINE::ComposedNode *composedNode, Subject *parent)
 
virtual ~SubjectComposedNode ()
 
virtual void loadChildren ()
 
virtual void loadLinks ()
 
SubjectNodeaddSubjectNode (YACS::ENGINE::Node *node, std::string name="", YACS::ENGINE::Catalog *catalog=0, std::string compo="", std::string type="")
 
SubjectLinkaddSubjectLink (SubjectNode *sno, SubjectDataPort *spo, SubjectNode *sni, SubjectDataPort *spi)
 
SubjectControlLinkaddSubjectControlLink (SubjectNode *sno, SubjectNode *sni)
 
virtual void removeLink (SubjectLink *link)
 
virtual void removeControlLink (SubjectControlLink *link)
 
virtual void removeExternalControlLinks ()
 
virtual bool hasValue ()
 
virtual std::string getValue ()
 
void localclean (Command *command=0)
 
- 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 saveLinks ()
 
virtual void restoreLinks ()
 
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 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 notifyObserver2 (Node *object, const std::string &event, void *something)
 
virtual ~Observer ()
 

Protected Attributes

YACS::ENGINE::Proc_proc
 
std::vector< Subject * > _postEraseList
 
- Protected Attributes inherited from YACS::HMI::SubjectBloc
YACS::ENGINE::Bloc_bloc
 
std::set< SubjectNode * > _children
 
- Protected Attributes inherited from YACS::HMI::SubjectComposedNode
YACS::ENGINE::ComposedNode_composedNode
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::SubjectComposedNode
static SubjectComposedNodegetLowestCommonAncestor (SubjectNode *snode1, SubjectNode *snode2)
 Retrieves the lowest common ancestor of 2 nodes. More...
 
- Protected Member Functions inherited from YACS::HMI::SubjectComposedNode
virtual SubjectNodecreateNode (YACS::ENGINE::Catalog *catalog, std::string compo, std::string type, std::string name, bool newCompoInst, int swCase=0)
 

Detailed Description

Definition at line 506 of file guiObservers.hxx.

Constructor & Destructor Documentation

SubjectProc::SubjectProc ( YACS::ENGINE::Proc proc,
Subject parent 
)

Definition at line 1802 of file guiObservers.cxx.

References _postEraseList.

1803  : SubjectBloc(proc, parent), _proc(proc)
1804 {
1805  _postEraseList.clear();
1806 }
SubjectProc::~SubjectProc ( )
virtual

Definition at line 1808 of file guiObservers.cxx.

References DEBTRACE, and YACS::HMI::SubjectNode::getName().

1809 {
1810  DEBTRACE("SubjectProc::~SubjectProc " << getName());
1811 }

Member Function Documentation

SubjectComponent * SubjectProc::addComponent ( std::string  compoName,
std::string  containerName = "" 
)
virtual

Definition at line 1906 of file guiObservers.cxx.

References YACS::HMI::Invocator::add(), DEBTRACE, YACS::HMI::Command::execute(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), and YACS::HMI::CommandAddComponentInstance::getSubjectComponent().

Referenced by YACS::HMI::GuiEditor::CreateComponentInstance().

1907 {
1908  DEBTRACE("SubjectProc::addComponent " << compoName << " " << containerName);
1909  CommandAddComponentInstance *command = new CommandAddComponentInstance(compoName, containerName);
1910  if (command->execute())
1911  {
1912  GuiContext::getCurrent()->getInvoc()->add(command);
1913  return command->getSubjectComponent();
1914  }
1915  else delete command;
1916  return 0;
1917 }
SubjectDataType * SubjectProc::addComSubjectDataType ( YACS::ENGINE::TypeCode type,
std::string  alias 
)

register a sub command when importing a node from catalog with new data types

Definition at line 1993 of file guiObservers.cxx.

References YACS::HMI::Invocator::add(), addSubjectDataType(), DEBTRACE, YACS::HMI::Command::execute(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getCurrentCatalog(), YACS::HMI::GuiContext::getInvoc(), and YACS::ENGINE::TypeCode::name().

Referenced by YACS::HMI::SubjectNode::addSubjectIDSPort(), YACS::HMI::SubjectNode::addSubjectODSPort(), and YACS::HMI::SubjectNode::addSubjectOutputPort().

1994 {
1995  string typeName = type->name();
1996  DEBTRACE("SubjectProc::addComSubjectDataType " << typeName);
1997  SubjectDataType* son = 0;
1998  if (GuiContext::getCurrent()->isLoading())
1999  son = addSubjectDataType(type,alias); // no sub command registration
2000  else
2001  {
2004  typeName);
2005  if (command->execute())
2006  GuiContext::getCurrent()->getInvoc()->add(command);
2007  else delete command;
2008  }
2009  return son;
2010 }
SubjectContainerBase * SubjectProc::addContainer ( std::string  name,
std::string  ref = "" 
)
virtual

Definition at line 1919 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::Invocator::add(), DEBTRACE, YACS::HMI::Command::execute(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), and YACS::HMI::CommandAddContainerBase::getSubjectContainer().

Referenced by YACS::HMI::SchemaDirContainersItem::addComponentItem(), and YACS::HMI::GuiEditor::CreateContainer().

1920 {
1921  DEBTRACE("SubjectProc::addContainer " << name << " " << ref);
1922  if (! GuiContext::getCurrent()->getProc()->containerMap.count(name))
1923  {
1924  CommandAddContainer *command(new CommandAddContainer(name,ref));
1925  if (command->execute())
1926  {
1927  GuiContext::getCurrent()->getInvoc()->add(command);
1928  return command->getSubjectContainer();
1929  }
1930  else
1931  delete command;
1932  }
1933  else GuiContext::getCurrent()->_lastErrorMessage = "There is already a container with that name";
1934  return 0;
1935 }
bool SubjectProc::addDataType ( YACS::ENGINE::Catalog catalog,
std::string  typeName 
)
virtual

Definition at line 1955 of file guiObservers.cxx.

References YACS::HMI::Invocator::add(), DEBTRACE, YACS::HMI::Command::execute(), YACS::HMI::GuiContext::getCurrent(), and YACS::HMI::GuiContext::getInvoc().

Referenced by YACS::HMI::GuiEditor::AddTypeFromCatalog().

1956 {
1957  DEBTRACE("SubjectProc::addDataType " << typeName);
1958  CommandAddDataTypeFromCatalog *command = new CommandAddDataTypeFromCatalog(catalog, typeName);
1959  if (command->execute())
1960  {
1961  DEBTRACE("new datatype " << typeName);
1962  GuiContext::getCurrent()->getInvoc()->add(command);
1963  return true;
1964  }
1965  else delete command;
1966  return 0;
1967 }
SubjectContainerBase * SubjectProc::addHPContainer ( std::string  name,
std::string  ref = "" 
)
virtual

Definition at line 1937 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::Invocator::add(), DEBTRACE, YACS::HMI::Command::execute(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getInvoc(), and YACS::HMI::CommandAddContainerBase::getSubjectContainer().

Referenced by YACS::HMI::GuiEditor::CreateHPContainer().

1938 {
1939  DEBTRACE("SubjectProc::addContainer " << name << " " << ref);
1940  if (! GuiContext::getCurrent()->getProc()->containerMap.count(name))
1941  {
1942  CommandAddHPContainer *command(new CommandAddHPContainer(name,ref));
1943  if (command->execute())
1944  {
1945  GuiContext::getCurrent()->getInvoc()->add(command);
1946  return command->getSubjectContainer();
1947  }
1948  else
1949  delete command;
1950  }
1951  else GuiContext::getCurrent()->_lastErrorMessage = "There is already a container with that name";
1952  return 0;
1953 }
void YACS::HMI::SubjectProc::addPostErase ( Subject sub)
inline

Definition at line 527 of file guiObservers.hxx.

References _postEraseList.

Referenced by YACS::HMI::SubjectServiceNode::~SubjectServiceNode().

527 {_postEraseList.push_back(sub); };
SubjectContainerBase * SubjectProc::addSubjectContainer ( YACS::ENGINE::Container cont,
std::string  name = "" 
)

Definition at line 1979 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectContainer, YACS::HMI::ADD, YACS::HMI::CONTAINER, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::SubjectContainerBase::New(), and YACS::HMI::SubjectNode::update().

Referenced by loadContainers(), YACS::HMI::CommandAddContainerBase::localExecute(), YACS::HMI::SubjectServiceNode::setComponent(), and YACS::HMI::SubjectComponent::setContainer().

1980 {
1981  DEBTRACE("SubjectProc::addSubjectContainer " << name);
1983  // In edition mode do not clone containers
1984  // cont->attachOnCloning(); // agy : do not use _attachOnCloning attribute in edition mode. This attribute should be used now at runtime.
1986  update(ADD, CONTAINER, son);
1987  return son;
1988 }
SubjectDataType * SubjectProc::addSubjectDataType ( YACS::ENGINE::TypeCode type,
std::string  alias 
)

Definition at line 2013 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_lastErrorMessage, YACS::HMI::GuiContext::_mapOfSubjectDataType, YACS::HMI::ADD, YACS::ENGINE::TypeCode::clone(), YACS::HMI::DATATYPE, DEBTRACE, YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::TypeCode::name(), YACS::ENGINE::Proc::typeMap, and YACS::HMI::SubjectNode::update().

Referenced by addComSubjectDataType(), YACS::HMI::SubjectNode::addSubjectInputPort(), loadTypes(), and YACS::HMI::CommandAddDataTypeFromCatalog::localExecute().

2014 {
2015  string typeName = type->name();
2016  DEBTRACE("SubjectProc::addSubjectDataType " << typeName);
2017  Proc* proc = GuiContext::getCurrent()->getProc();
2018  SubjectDataType* son = 0;
2019  if (! proc->typeMap.count(typeName))
2020  proc->typeMap[ typeName ] = type->clone();
2021  else
2022  proc->typeMap[ typeName ]->incrRef();
2023  if (! GuiContext::getCurrent()->_mapOfSubjectDataType.count(typeName))
2024  {
2025  son = new SubjectDataType(type, this, alias);
2026  GuiContext::getCurrent()->_mapOfSubjectDataType[typeName] = son;
2027  update(ADD, DATATYPE, son);
2028  }
2029  else
2030  GuiContext::getCurrent()->_lastErrorMessage = "Typecode " + typeName + " was already added in proc";
2031  return son;
2032 }
void SubjectProc::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::SubjectBloc.

Definition at line 1813 of file guiObservers.cxx.

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

Referenced by YACS::HMI::GuiContext::~GuiContext(), and YACS::HMI::QtGuiContext::~QtGuiContext().

1814 {
1815  if (_askRegisterUndo)
1816  {
1817  _askRegisterUndo = false;
1819  }
1820  localclean(command);
1821  SubjectBloc::clean(command);
1822 }
void SubjectProc::cleanPostErase ( )

Definition at line 1829 of file guiObservers.cxx.

References _postEraseList, DEBTRACE, YACS::HMI::Subject::erase(), YACS::HMI::SubjectNode::getName(), and CORBAEngineTest::i.

1830 {
1831  DEBTRACE("SubjectProc::cleanPostErase");
1832  for (int i=0; i<_postEraseList.size(); i++)
1833  {
1834  DEBTRACE("cleanPostErase " << _postEraseList[i]->getName());
1835  erase(_postEraseList[i],0, true); // --- true: do not call recursively erase
1836  }
1837  _postEraseList.clear();
1838 }
virtual TypeOfElem YACS::HMI::SubjectProc::getType ( )
inlinevirtual

Reimplemented from YACS::HMI::SubjectBloc.

Definition at line 529 of file guiObservers.hxx.

References YACS::HMI::SALOMEPROC.

529 {return SALOMEPROC;}
void SubjectProc::loadComponents ( )

loadComponents is used when an existing scheme has been loaded in memory, to create subjects for components stored in the schema file, but are not associated with any service nodes. Note, that if such component is associated to any container, the subject for this container is also created, if it is not exist yet.

Definition at line 1875 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfLastComponentInstance, YACS::HMI::GuiContext::_mapOfSubjectComponent, addSubjectComponent(), YACS::ENGINE::Proc::componentInstanceMap, YACS::HMI::GuiContext::getCurrent(), and YACS::HMI::GuiContext::getProc().

Referenced by loadProc().

1876 {
1877  Proc* aProc = GuiContext::getCurrent()->getProc();
1878  for (map<string, ComponentInstance*>::const_iterator itComp = aProc->componentInstanceMap.begin();
1879  itComp != aProc->componentInstanceMap.end(); ++itComp)
1880  {
1881  GuiContext::getCurrent()->_mapOfLastComponentInstance[itComp->second->getCompoName()]=itComp->second;
1882 
1883  if ( GuiContext::getCurrent()->_mapOfSubjectComponent.find((*itComp).second)
1884  ==
1886  { // engine object for component already exists => add only a subject for it
1887  addSubjectComponent((*itComp).second);
1888  }
1889  }
1890 }
void SubjectProc::loadContainers ( )

loadContainers is used when an existing scheme has been loaded in memory, to create subjects for containers stored in the schema file, but are not associated with components.

Definition at line 1897 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectContainer, addSubjectContainer(), YACS::ENGINE::Proc::containerMap, YACS::HMI::GuiContext::getCurrent(), and YACS::HMI::GuiContext::getProc().

Referenced by loadProc().

1898 {
1899  Proc* aProc = GuiContext::getCurrent()->getProc();
1900  for (map<string, Container*>::const_iterator itCont = aProc->containerMap.begin(); itCont != aProc->containerMap.end(); ++itCont)
1902  // engine object for container already exists => add only a subject for it
1903  addSubjectContainer((*itCont).second,(*itCont).second->getName());
1904 }
void SubjectProc::loadProc ( )
void SubjectProc::loadTypes ( )

Load types for a SubjectProc.

This method loads (on import or on creation) all types of the builtin catalog and all types defined in the Proc

Definition at line 1854 of file guiObservers.cxx.

References _proc, YACS::ENGINE::Catalog::_typeMap, addSubjectDataType(), YACS::ENGINE::Runtime::getBuiltinCatalog(), YACS::ENGINE::getSALOMERuntime(), and YACS::ENGINE::Proc::typeMap.

Referenced by loadProc().

1855 {
1856  Catalog* builtinCatalog = getSALOMERuntime()->getBuiltinCatalog();
1857  std::map<std::string, TypeCode *>::iterator pt;
1858  for(pt=builtinCatalog->_typeMap.begin();pt!=builtinCatalog->_typeMap.end();pt++)
1859  {
1860  addSubjectDataType((*pt).second , (*pt).first);
1861  }
1862  for(pt=_proc->typeMap.begin();pt!=_proc->typeMap.end();pt++)
1863  {
1864  addSubjectDataType((*pt).second , (*pt).first);
1865  }
1866 }
void SubjectProc::localclean ( Command command = 0)

Definition at line 1824 of file guiObservers.cxx.

References DEBTRACE.

Referenced by clean().

1825 {
1826  DEBTRACE("SubjectProc::localClean ");
1827 }
void SubjectProc::removeSubjectContainer ( SubjectContainerBase scont)

Definition at line 2049 of file guiObservers.cxx.

References YACS::HMI::Subject::erase(), YACS::HMI::SubjectContainerBase::getContainer(), YACS::HMI::GuiContext::getCurrent(), and YASSERT.

Referenced by YACS::HMI::CommandAddContainerBase::localReverse().

2050 {
2051  YASSERT(GuiContext::getCurrent()->_mapOfSubjectContainer.count(scont->getContainer()));
2052  erase(scont); // do all the necessary updates
2053 }
void SubjectProc::removeSubjectDataType ( std::string  typeName)

Definition at line 2034 of file guiObservers.cxx.

References YACS::HMI::GuiContext::_mapOfSubjectDataType, DEBTRACE, YACS::HMI::Subject::erase(), YACS::HMI::GuiContext::getCurrent(), YACS::HMI::GuiContext::getProc(), YACS::ENGINE::Proc::typeMap, and YASSERT.

Referenced by YACS::HMI::CommandAddDataTypeFromCatalog::localReverse().

2035 {
2036  Proc* proc = GuiContext::getCurrent()->getProc();
2037  YASSERT(proc->typeMap.count(typeName));
2038  YASSERT(GuiContext::getCurrent()->_mapOfSubjectDataType.count(typeName));
2039  TypeCode* aTypeCode = proc->typeMap[typeName];
2041  unsigned int aRefCnt = aTypeCode->getRefCnt();
2042  DEBTRACE("SubjectProc::removeSubjectDataType: " << typeName << " " << aRefCnt);
2043  GuiContext::getCurrent()->_mapOfSubjectDataType.erase(typeName);
2044  proc->typeMap.erase(typeName);
2045  erase(aSDataType); // do all the necessary updates
2046  aTypeCode->decrRef();
2047 }

Member Data Documentation

std::vector<Subject*> YACS::HMI::SubjectProc::_postEraseList
protected

Definition at line 532 of file guiObservers.hxx.

Referenced by addPostErase(), cleanPostErase(), and SubjectProc().

YACS::ENGINE::Proc* YACS::HMI::SubjectProc::_proc
protected

Definition at line 531 of file guiObservers.hxx.

Referenced by loadTypes().


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