1 // File : SALOMEDS_AttributeTarget.cxx
2 // Author : Sergey RUIN
5 #include "SALOMEDS_AttributeTarget.hxx"
7 #include <TColStd_HSequenceOfTransient.hxx>
9 #include "SALOMEDSImpl_SObject.hxx"
10 #include "SALOMEDS_SObject.hxx"
13 SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr)
14 :SALOMEDS_GenericAttribute(theAttr)
17 SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr)
18 :SALOMEDS_GenericAttribute(theAttr)
21 SALOMEDS_AttributeTarget::~SALOMEDS_AttributeTarget()
24 void SALOMEDS_AttributeTarget::Add(const _PTR(SObject)& theObject)
26 SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
28 if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl());
29 else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl());
32 std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get()
34 std::vector<_PTR(SObject)> aVector;
36 SALOMEDSClient_SObject* aSO = NULL;
39 Handle(TColStd_HSequenceOfTransient) aSeq = Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get();
40 aLength = aSeq->Length();
41 for(i=1; i<=aLength; i++) {
42 aSO = new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)));
43 aVector.push_back(_PTR(SObject)(aSO));
47 SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get();
48 aLength = aSeq->length();
49 aSO = new SALOMEDS_SObject(aSeq[i].in());
50 for(i = 0; i<aLength; i++) aVector.push_back(_PTR(SObject)(aSO));
56 void SALOMEDS_AttributeTarget::Remove(const _PTR(SObject)& theObject)
58 SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
60 if(_isLocal) Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl());
61 else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl());