1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __COMPONENTINSTANCE_HXX__
21 #define __COMPONENTINSTANCE_HXX__
23 #include "YACSlibEngineExport.hxx"
24 #include "RefCounter.hxx"
25 #include "PropertyInterface.hxx"
38 class YACSLIBENGINE_EXPORT ComponentInstance : public PropertyInterface, public RefCounter
41 virtual ~ComponentInstance();
43 ComponentInstance(const std::string& name);
44 ComponentInstance(const ComponentInstance& other);
45 const std::string& getCompoName() const { return _compoName; }
46 const std::string& getInstanceName() const { return _instanceName; }
47 void setName(const std::string& name) { _instanceName = name; };
48 virtual void setAnonymous(bool anon) { _anonymous = anon; };
49 virtual bool isAnonymous() { return _anonymous; };
50 int getNumId() const { return _numId; }
51 virtual bool setContainer(Container *cont);
52 Container *getContainer() const { return _container; }
53 //! Load the component instance
54 virtual void load(Task *askingNode) = 0;
55 //! Unload the component instance
56 virtual void unload(Task *askingNode) = 0;
57 //! Indicate if the component instance is loaded (true) or not
58 virtual bool isLoaded(Task *askingNode) const = 0;
59 virtual void attachOnCloning() const;
60 virtual void dettachOnCloning() const;
61 bool isAttachedOnCloning() const;
62 virtual std::string getFileRepr() const;
63 virtual ServiceNode* createNode(const std::string& name)=0;
64 virtual ComponentInstance *clone() const = 0;
65 virtual ComponentInstance *cloneAlways() const = 0;
66 virtual std::string getKind() const;
67 virtual std::string getKindForNode() const;
68 static const char KIND[];
69 virtual void shutdown(int level);
71 //! \b WARNING : _compoName identify only the component type.
72 std::string _compoName;
73 //! \b WARNING : _InstanceName has a strong semantic. It discriminates ComponentInstance instances each other.
74 std::string _instanceName;
76 Container *_container;
77 mutable bool _isAttachedOnCloning;
79 static const char NULL_FILE_REPR[];