| 1 | // File: RWStepBasic_RWAction.cxx |
| 2 | // Created: Fri Nov 26 16:26:28 1999 |
| 3 | // Author: Andrey BETENEV |
| 4 | // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.0 |
| 5 | // Copyright: Matra Datavision 1999 |
| 6 | |
| 7 | #include <RWStepBasic_RWAction.ixx> |
| 8 | |
| 9 | //======================================================================= |
| 10 | //function : RWStepBasic_RWAction |
| 11 | //purpose : |
| 12 | //======================================================================= |
| 13 | |
| 14 | RWStepBasic_RWAction::RWStepBasic_RWAction () |
| 15 | { |
| 16 | } |
| 17 | |
| 18 | //======================================================================= |
| 19 | //function : ReadStep |
| 20 | //purpose : |
| 21 | //======================================================================= |
| 22 | |
| 23 | void RWStepBasic_RWAction::ReadStep (const Handle(StepData_StepReaderData)& data, |
| 24 | const Standard_Integer num, |
| 25 | Handle(Interface_Check)& ach, |
| 26 | const Handle(StepBasic_Action) &ent) const |
| 27 | { |
| 28 | // Check number of parameters |
| 29 | if ( ! data->CheckNbParams(num,3,ach,"action") ) return; |
| 30 | |
| 31 | // Own fields of Action |
| 32 | |
| 33 | Handle(TCollection_HAsciiString) aName; |
| 34 | data->ReadString (num, 1, "name", ach, aName); |
| 35 | |
| 36 | Handle(TCollection_HAsciiString) aDescription; |
| 37 | Standard_Boolean hasDescription = Standard_True; |
| 38 | if ( data->IsParamDefined (num,2) ) { |
| 39 | data->ReadString (num, 2, "description", ach, aDescription); |
| 40 | } |
| 41 | else { |
| 42 | hasDescription = Standard_False; |
| 43 | } |
| 44 | |
| 45 | Handle(StepBasic_ActionMethod) aChosenMethod; |
| 46 | data->ReadEntity (num, 3, "chosen_method", ach, STANDARD_TYPE(StepBasic_ActionMethod), aChosenMethod); |
| 47 | |
| 48 | // Initialize entity |
| 49 | ent->Init(aName, |
| 50 | hasDescription, |
| 51 | aDescription, |
| 52 | aChosenMethod); |
| 53 | } |
| 54 | |
| 55 | //======================================================================= |
| 56 | //function : WriteStep |
| 57 | //purpose : |
| 58 | //======================================================================= |
| 59 | |
| 60 | void RWStepBasic_RWAction::WriteStep (StepData_StepWriter& SW, |
| 61 | const Handle(StepBasic_Action) &ent) const |
| 62 | { |
| 63 | |
| 64 | // Own fields of Action |
| 65 | |
| 66 | SW.Send (ent->Name()); |
| 67 | |
| 68 | if ( ent->HasDescription() ) { |
| 69 | SW.Send (ent->Description()); |
| 70 | } |
| 71 | else SW.SendUndef(); |
| 72 | |
| 73 | SW.Send (ent->ChosenMethod()); |
| 74 | } |
| 75 | |
| 76 | //======================================================================= |
| 77 | //function : Share |
| 78 | //purpose : |
| 79 | //======================================================================= |
| 80 | |
| 81 | void RWStepBasic_RWAction::Share (const Handle(StepBasic_Action) &ent, |
| 82 | Interface_EntityIterator& iter) const |
| 83 | { |
| 84 | |
| 85 | // Own fields of Action |
| 86 | |
| 87 | iter.AddItem (ent->ChosenMethod()); |
| 88 | } |