summaryrefslogtreecommitdiff
path: root/src/RWHeaderSection/RWHeaderSection_GeneralModule.cxx
blob: 3a6dc693caa5079584490068066689c88d08d3c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include <RWHeaderSection_GeneralModule.ixx>

#include <Interface_Macros.hxx>

#include <Interface_GeneralLib.hxx>

#include <Interface_EntityIterator.hxx>

#include <HeaderSection.hxx>

#include <RWHeaderSection.hxx>

#include <Interface_HArray1OfHAsciiString.hxx>
#include <TCollection_HAsciiString.hxx>


#include <HeaderSection_FileName.hxx>
#include <HeaderSection_FileDescription.hxx>
#include <HeaderSection_FileSchema.hxx>

#include <StepData_UndefinedEntity.hxx>
#include <Interface_Macros.hxx>


RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule ()
	{ Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol()); }

void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const
{
  if (CN != 4) return;

  DeclareAndCast(StepData_UndefinedEntity,undf,ent);
  undf->FillShared (iter);

}


void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer CN,
                                              const Handle(Standard_Transient)& ent,
                                              const Interface_ShareTool& shares,
                                              Handle(Interface_Check)& ach) const
{
}


void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
{
//   ajout manuel
  switch (CN) {

    case 1 : {
      Standard_Integer i;
      DeclareAndCast(HeaderSection_FileName,enfr,entfrom);
      DeclareAndCast(HeaderSection_FileName,ento,entto);
      Handle(TCollection_HAsciiString) name =
	new TCollection_HAsciiString (enfr->Name());
      Handle(TCollection_HAsciiString) time =
	new TCollection_HAsciiString (enfr->TimeStamp());
      Standard_Integer nba = enfr->NbAuthor();
      Handle(Interface_HArray1OfHAsciiString) auth =
	new Interface_HArray1OfHAsciiString (1,nba);
      for (i = 1; i <= nba; i ++) auth->SetValue
	(i, new TCollection_HAsciiString (enfr->AuthorValue(i)) );
      Standard_Integer nbo = enfr->NbOrganization();
      Handle(Interface_HArray1OfHAsciiString) orga =
	new Interface_HArray1OfHAsciiString (1,nbo);
      for (i = 1; i <= nbo; i ++) orga->SetValue
	(i, new TCollection_HAsciiString (enfr->OrganizationValue(i)) );
      Handle(TCollection_HAsciiString) prep =
	new TCollection_HAsciiString (enfr->PreprocessorVersion());
      Handle(TCollection_HAsciiString) orig =
	new TCollection_HAsciiString (enfr->OriginatingSystem());
      Handle(TCollection_HAsciiString) autr =
	new TCollection_HAsciiString (enfr->Authorisation());
      ento->Init (name,time,auth,orga,prep,orig,autr);
    }
    break;

    case 2 : {
      Standard_Integer i;
      DeclareAndCast(HeaderSection_FileDescription,enfr,entfrom);
      DeclareAndCast(HeaderSection_FileDescription,ento,entto);
      Standard_Integer nbd = enfr->NbDescription();
      Handle(Interface_HArray1OfHAsciiString) desc =
	new Interface_HArray1OfHAsciiString (1,nbd);
      for (i = 1; i <= nbd; i ++) desc->SetValue
	(i, new TCollection_HAsciiString (enfr->DescriptionValue(i)) );
      Handle(TCollection_HAsciiString) impl =
	new TCollection_HAsciiString (enfr->ImplementationLevel());
      ento->Init (desc,impl);
    }
    break;

    case 3 : {
      Standard_Integer i;
      DeclareAndCast(HeaderSection_FileSchema,enfr,entfrom);
      DeclareAndCast(HeaderSection_FileSchema,ento,entto);
      Standard_Integer nbs = enfr->NbSchemaIdentifiers();
      Handle(Interface_HArray1OfHAsciiString) sche =
	new Interface_HArray1OfHAsciiString (1,nbs);
      for (i = 1; i <= nbs; i ++) sche->SetValue
	(i, new TCollection_HAsciiString (enfr->SchemaIdentifiersValue(i)) );
      ento->Init (sche);
    }
    break;

    case 4 : {
      DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
      DeclareAndCast(StepData_UndefinedEntity,undto,entto);
      undto->GetFromAnother(undfrom,TC);  //  On pourrait rapatrier cela
    }
    break;

    default : break;
  }
}
	// --- Construction of empty class ---

Standard_Boolean RWHeaderSection_GeneralModule::NewVoid
	(const Standard_Integer CN, Handle(Standard_Transient)& ent) const
{
	if (CN == 0) return Standard_False;
	switch (CN) {
	  case 1 : 
	    ent = new HeaderSection_FileName;
	    break;
	  case 2 : 
	    ent = new HeaderSection_FileDescription;
	    break;
	  case 3 : 
	    ent = new HeaderSection_FileSchema;
	    break;
	  case 4 : 
	    ent = new StepData_UndefinedEntity;
	    break;
	  default : return Standard_False;
	}

return Standard_True;
}