Salome HOME
Updated copyright comment
[modules/gui.git] / src / OBJECT / SALOME_InteractiveObject.cxx
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 /*!
24   \class SALOME_InteractiveObject SALOME_InteractiveObject.hxx
25   \brief ...
26 */
27
28 #include "SALOME_InteractiveObject.hxx"
29
30 IMPLEMENT_STANDARD_RTTIEXT(SALOME_InteractiveObject, Standard_Transient)
31
32 /*!
33   Default constructor
34 */
35 SALOME_InteractiveObject::SALOME_InteractiveObject():
36   myEntry(""),
37   myName(""),
38   myComponentDataType(""),
39   myReference("")
40 {
41 }
42
43 /*!
44   Constructor
45   \param anEntry - entry of object
46   \param aComponentDataType - component data type name
47   \param aName - name of object
48 */
49 SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry, 
50                                                    const char* aComponentDataType,
51                                                    const char* aName):
52   myEntry(anEntry), 
53   myName(aName), 
54   myComponentDataType(aComponentDataType), 
55   myReference("")
56 {}
57
58 /*!
59   Destructor
60 */
61 SALOME_InteractiveObject::~SALOME_InteractiveObject()
62 {
63 }
64
65 /*!
66   Sets entry
67   \param anEntry - new entry of object
68 */
69 void SALOME_InteractiveObject::setEntry(const char* anEntry)
70 {
71   myEntry = anEntry;
72 }
73
74 /*!
75   \return entry
76 */
77 const char* SALOME_InteractiveObject::getEntry()
78 {
79   return myEntry.c_str();
80 }
81
82 /*!
83   Sets component data type
84   \param aComponentDataType - component data type name
85 */
86 void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType)
87 {
88   myComponentDataType = aComponentDataType; 
89 }
90
91 /*!
92   \return component data type
93 */
94 const char* SALOME_InteractiveObject::getComponentDataType()
95 {
96   return myComponentDataType.c_str();
97 }
98
99 /*!
100   Sets name
101   \param aName - new name of object
102 */
103 void SALOME_InteractiveObject::setName(const char* aName)
104 {
105   myName = aName;
106 }
107
108 /*!
109   \return name
110 */
111 const char* SALOME_InteractiveObject::getName()
112 {
113   return myName.c_str();
114 }
115
116 /*!
117   \return true if entry isn't empty
118 */
119 Standard_Boolean SALOME_InteractiveObject::hasEntry()
120 {
121   return myEntry != "";
122 }
123
124 /*!
125   \return true if objects have same entries
126   \param anIO - other object
127 */
128 Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO )
129 {
130   Standard_Boolean r = Standard_False;
131   if ( anIO->hasEntry() && this->hasEntry() )
132     r = myEntry == anIO->getEntry();
133   return r;
134 }
135
136 /*!
137   \return true if component data types are same
138   \param ComponentDataType - component data type to be checked
139 */
140 Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType)
141 {
142   return myComponentDataType == ComponentDataType;
143 }
144
145 /*!
146   \return true if object has reference
147 */
148 Standard_Boolean SALOME_InteractiveObject::hasReference()
149 {
150   return myReference != "";
151 }
152
153 /*!
154   \return reference
155 */
156 const char* SALOME_InteractiveObject::getReference()
157 {
158   return myReference.c_str();
159 }
160
161 /*!
162   Sets reference
163   \param aReference - new reference
164 */
165 void SALOME_InteractiveObject::setReference(const char* aReference)
166 {
167   myReference = aReference;
168 }
169
170 /*!
171   Compare two objects
172   \param anIO1 - first object to compare
173   \param anIO1 - second object to compare
174 */
175 Standard_Boolean IsEqual(const Handle(SALOME_InteractiveObject)& anIO1,
176                          const Handle(SALOME_InteractiveObject)& anIO2)
177 {
178   return anIO1->isSame( anIO2 );
179 }