X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FComponentInstance.hxx;h=6e2aaceb7b6aa84a337e4e5cf4fcba8b106adaf1;hb=c9208a8ef7f32a620d9650908588320ff159a167;hp=4ffc1227353708c8540ca20e9161a14f919cf8ab;hpb=a84e60a749da66dffb73297fa5082b70b9d62f7d;p=modules%2Fyacs.git diff --git a/src/engine/ComponentInstance.hxx b/src/engine/ComponentInstance.hxx index 4ffc12273..6e2aaceb7 100644 --- a/src/engine/ComponentInstance.hxx +++ b/src/engine/ComponentInstance.hxx @@ -1,7 +1,28 @@ +// Copyright (C) 2006-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + #ifndef __COMPONENTINSTANCE_HXX__ #define __COMPONENTINSTANCE_HXX__ +#include "YACSlibEngineExport.hxx" #include "RefCounter.hxx" +#include "PropertyInterface.hxx" #include #include @@ -10,61 +31,54 @@ namespace YACS { namespace ENGINE { - class Container; + class Task; class ServiceNode; + class Container; -/*! \brief Base class for all component instances. - * - * \ingroup Nodes - * - * This is an abstract class that must be specialized in runtime. - * Specialized classes must provide implementation for loading of - * a component (load method) unloading (unload method) and an - * information method (isLoaded) about the state of the component - * - * A component instance is used by one or more ServiceNode to execute - * services of this component instance - * - * \see ServiceNode - */ - class ComponentInstance : public RefCounter + class YACSLIBENGINE_EXPORT ComponentInstance : public PropertyInterface, public RefCounter { protected: virtual ~ComponentInstance(); public: ComponentInstance(const std::string& name); ComponentInstance(const ComponentInstance& other); - const std::string& getName() const { return _name; } - void setContainer(Container *cont); + const std::string& getCompoName() const { return _compoName; } + const std::string& getInstanceName() const { return _instanceName; } + void setName(const std::string& name) { _instanceName = name; }; + virtual void setAnonymous(bool anon) { _anonymous = anon; }; + virtual bool isAnonymous() { return _anonymous; }; + int getNumId() const { return _numId; } + virtual bool setContainer(Container *cont); Container *getContainer() const { return _container; } //! Load the component instance - virtual void load() = 0; + virtual void load(Task *askingNode) = 0; //! Unload the component instance - virtual void unload() = 0; + virtual void unload(Task *askingNode) = 0; //! Indicate if the component instance is loaded (true) or not - virtual bool isLoaded() = 0; + virtual bool isLoaded(Task *askingNode) const = 0; virtual void attachOnCloning() const; virtual void dettachOnCloning() const; bool isAttachedOnCloning() const; -//! For dump in file virtual std::string getFileRepr() const; virtual ServiceNode* createNode(const std::string& name)=0; virtual ComponentInstance *clone() const = 0; -//! Return the component kind -/*! - * A runtime can provide several implementations of a component instance. - * Each implementation has a different kind. A ComponentInstance can be - * associated to a ServiceNode is they have the same kind. - */ + virtual ComponentInstance *cloneAlways() const = 0; virtual std::string getKind() const; + virtual std::string getKindForNode() const; static const char KIND[]; + virtual void shutdown(int level); protected: - //! \b WARNING : _name has a strong semantic. It discriminates ComponentInstance instances each other. - std::string _name; + //! \b WARNING : _compoName identify only the component type. + std::string _compoName; + //! \b WARNING : _InstanceName has a strong semantic. It discriminates ComponentInstance instances each other. + std::string _instanceName; + int _numId; Container *_container; mutable bool _isAttachedOnCloning; protected: static const char NULL_FILE_REPR[]; + static int _total; + bool _anonymous; }; } }