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"
37 class YACSLIBENGINE_EXPORT ComponentInstance : public PropertyInterface, public RefCounter
40 virtual ~ComponentInstance();
42 ComponentInstance(const std::string& name);
43 ComponentInstance(const ComponentInstance& other);
44 const std::string& getCompoName() const { return _compoName; }
45 const std::string& getInstanceName() const { return _instanceName; }
46 void setName(const std::string& name) { _instanceName = name; };
47 virtual void setAnonymous(bool anon) { _anonymous = anon; };
48 virtual bool isAnonymous() { return _anonymous; };
49 int getNumId() const { return _numId; }
50 virtual void setContainer(Container *cont);
51 Container *getContainer() const { return _container; }
52 //! Load the component instance
53 virtual void load() = 0;
54 //! Unload the component instance
55 virtual void unload() = 0;
56 //! Indicate if the component instance is loaded (true) or not
57 virtual bool isLoaded() = 0;
58 virtual void attachOnCloning() const;
59 virtual void dettachOnCloning() const;
60 bool isAttachedOnCloning() const;
61 virtual std::string getFileRepr() const;
62 virtual ServiceNode* createNode(const std::string& name)=0;
63 virtual ComponentInstance *clone() const = 0;
64 virtual std::string getKind() const;
65 static const char KIND[];
66 virtual void shutdown(int level);
68 //! \b WARNING : _compoName identify only the component type.
69 std::string _compoName;
70 //! \b WARNING : _InstanceName has a strong semantic. It discriminates ComponentInstance instances each other.
71 std::string _instanceName;
73 Container *_container;
74 mutable bool _isAttachedOnCloning;
76 static const char NULL_FILE_REPR[];