d6c5fc45c741b2ebcedb0cfb9827f10b11f2f9ee
[occt.git] / src / Dynamic / Dynamic_CompositMethod.cxx
1 // Created on: 1994-08-26
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 // CRD : 15/04/97 : Passage WOK++ : Remplacement de TYPE par STANDARD_TYPE
18
19 #include <Dynamic_CompositMethod.ixx>
20
21
22 //=======================================================================
23 //function : Dynamic_CompositMethod
24 //purpose  : 
25 //=======================================================================
26
27 Dynamic_CompositMethod::Dynamic_CompositMethod(const Standard_CString aname)
28 : Dynamic_MethodDefinition(aname)
29 {
30   thesequenceofmethods = new Dynamic_SequenceOfMethods();
31 }
32
33 //=======================================================================
34 //function : Method
35 //purpose  : 
36 //=======================================================================
37
38 void Dynamic_CompositMethod::Method(const Handle(Dynamic_Method)& amethod)
39 {
40   if(amethod->IsKind(STANDARD_TYPE(Dynamic_MethodDefinition)))
41     cout<<"bad argument type"<<endl;
42   else
43     thesequenceofmethods->Append(amethod);
44 }
45
46 //=======================================================================
47 //function : NumberOfMethods
48 //purpose  : 
49 //=======================================================================
50
51 Standard_Integer Dynamic_CompositMethod::NumberOfMethods() const
52 {
53   return thesequenceofmethods->Length();
54 }
55
56 //=======================================================================
57 //function : Method
58 //purpose  : 
59 //=======================================================================
60
61 Handle(Dynamic_Method) Dynamic_CompositMethod::Method(const Standard_Integer anindex) const
62 {
63   return thesequenceofmethods->Value(anindex);
64 }
65
66 //=======================================================================
67 //function : Dump
68 //purpose  : 
69 //=======================================================================
70
71 void Dynamic_CompositMethod::Dump(Standard_OStream& astream) const
72 {
73   astream << "CompositMethod : " << endl;
74   Dynamic_MethodDefinition::Dump(astream);
75   astream << "Dump of Methods Instances : " << endl;
76   for (Standard_Integer i=1; i<= thesequenceofmethods->Length(); i++) {
77     astream << "Method No : " << i << endl;
78     thesequenceofmethods->Value(i)->Dump(astream);
79     astream << endl;
80   }
81 }