2727#include < sdai.h>
2828#include < STEPcomplex.h>
2929#include < STEPattribute.h>
30- #include < s_HEADER_SCHEMA .h>
30+ #include < SdaiHeaderSchema .h>
3131
3232// STEPundefined contains
3333// void PushPastString (istream& in, std::string &s, ErrorDescriptor *err)
@@ -217,141 +217,12 @@ STEPfile::ReadHeader (istream& in)
217217 cmtStr.clear ();
218218 }
219219
220- if (_fileType == VERSION_OLD) {
221- InstMgr * tmp = HeaderConvertToNew (*im);
222- delete im;
223- im = tmp;
224- }
225220 HeaderVerifyInstances (im);
226221 HeaderMergeInstances (im); // handles delete for im
227222
228223 return _error.severity ();
229224}
230225
231-
232- /* **************************
233- function: HeaderConvertToNew
234- returns: (InstMgr*) List of instances of header section entities
235- which semantically conform to the new version
236- of the exchange file format.
237- parameters: (InstMgr&) List of instances of header section entities
238- which semantically conform to the old version
239- of the exchange file format.
240- description:
241- This function converts the instances of the given InstMgr from the
242- old STEPfile format to the new file format. The InstMgr must
243- contain only instances of header section entities, and those entities
244- must be numbered in a specific way.
245-
246- OLD FORMAT (N279)
247-
248- #1=FILE_IDENTIFICATION
249- #2=FILE_DESCRIPTION
250- #3=IMP_LEVEL
251- #4=CLASSIFICATION
252- #5=MAXSIG
253-
254- side effects: This function allocates memory for an InstMgr using a
255- call to the new operator.
256- It also removes some instances from oldinst.
257- ***************************/
258- InstMgr*
259- STEPfile::HeaderConvertToNew (InstMgr& oldinst)
260- {
261- InstMgr* imtmp = new InstMgr;
262- SCLP23 (Application_instance)* oldse;
263-
264- // FILE_NAME <== (N279)FILE_IDENTIFICATION
265- p21DIS_File_name * fn = 0 ;
266- oldse = oldinst.GetApplication_instance (" N279_File_Identification" );
267- if (oldse == ENTITY_NULL)
268- {
269- cerr << " Warning: STEPfile::HeaderConvertToNew. Unable to get " <<
270- " \' File_Identification\' from header instance manager.\n " ;
271- fn = (p21DIS_File_name *) HeaderDefaultFileName ();
272- }
273- else
274- {
275-
276- s_N279_file_identification * fi;
277- fi = (s_N279_file_identification*) oldse;
278-
279- fn = new p21DIS_File_name;
280-
281- fn->name (const_cast <char *>((fi->file_name ()).c_str ())); // STRING <- STRING
282- fn->time_stamp (const_cast <char *>((fi->date ()).c_str ())); // STRING <- STRING
283- // fn->author(fi->author());
284- // LIST OF STRING <- LIST OF STRING
285- (fn->author ()).ShallowCopy (fi->author ());
286- // LIST OF STRING <- LIST OF STRING
287- (fn->organization ()).ShallowCopy (fi->organization ());
288- fn->preprocessor_version (const_cast <char *>((fi->preprocessor_version ()).c_str ())); // STRING
289- fn->originating_system (const_cast <char *>((fi->originating_system ()).c_str ())); // STRING
290- fn->authorisation (" " ); // STRING
291- fn->STEPfile_id = HeaderId (" File_Name" );
292-
293- oldinst.Delete (fi);
294- }
295-
296- imtmp->Append (fn, completeSE);
297-
298- // FILE_DESCRIPTION <== (N279)FILE_DESCRIPTION & (N279)IMP_LEVEL
299- p21DIS_File_description * fd = new p21DIS_File_description;
300- // Get the (N279) File_Description Instance
301- oldse = oldinst.GetApplication_instance (" N279_File_Description" );
302- s_N279_file_description * ofd = (s_N279_file_description*)oldse;
303- if (oldse != ENTITY_NULL)
304- {
305- // DAVE, is there a new way TODO this?
306- // copy a SCLP23(String) value into a StringAggregate
307- const char * tmpstr = const_cast <char *>((ofd->description ()).c_str ());
308- int l = strlen (tmpstr) + 2 ;
309- char *str = new char [l];
310- str[0 ]=' \' ' ; str[1 ]=' \0 ' ;
311- strncat (str,tmpstr,l);
312- strncat (str," \' " ,l);
313- StringNode * sn = new StringNode (str);
314- fd->description ().AddNode (sn);
315- oldinst.Delete (ofd);
316- delete [] str;
317- }
318- else
319- {
320- StringNode * sn = new StringNode (" " );
321- fd->description ().AddNode (sn);
322- }
323-
324- // Get the (N279) Imp_Level Instance
325- oldse = oldinst.GetApplication_instance (" N279_Imp_Level" );
326- s_N279_imp_level * il = (s_N279_imp_level*)oldse;
327- if (oldse != ENTITY_NULL)
328- {
329- fd->implementation_level (const_cast <char *>((il->implementation_level ()).c_str ()));
330- oldinst.Delete (il);
331- }
332- else
333- {
334- fd->implementation_level (" " );
335- }
336- fd->STEPfile_id = HeaderId (" File_Description" );
337- imtmp->Append (fd, completeSE);
338-
339- // FILE_SCHEMA <== default values
340- // There is no entity for the file_schema in the old version
341- // Therefore, the schema_identifiers list is left empty
342- imtmp->Append (HeaderDefaultFileSchema (), completeSE);
343-
344-
345- // append any extra instances from oldinst onto imtmp
346- for (int n = oldinst.InstanceCount () - 1 ; n>=0 ; --n)
347- {
348- imtmp->Append (oldinst.GetApplication_instance (oldinst.GetMgrNode (n)),completeSE);
349- }
350-
351- return imtmp;
352- }
353-
354-
355226/* **************************
356227Verify the instances read from the header section of an exchange file.
357228If some required instances aren't present, then create them,
@@ -410,33 +281,38 @@ STEPfile::HeaderVerifyInstances(InstMgr* im)
410281SCLP23 (Application_instance)*
411282STEPfile::HeaderDefaultFileName()
412283{
413- p21DIS_File_name * fn = new p21DIS_File_name;
414-
415- fn->name (" " );
416- fn->time_stamp (" " );
417- fn->author ().StrToVal (" " , &_error,
418- fn->attributes [2 ].
419- aDesc -> DomainType (),
420- _headerInstances);
421- fn->organization ().StrToVal (" " , &_error,
422- fn->attributes [3 ].
423- aDesc -> DomainType (),
424- _headerInstances);
425- fn->preprocessor_version (" " );
426- fn->originating_system (" " );
427- fn->authorisation (" " );
284+ SdaiFile_name * fn = new SdaiFile_name;
285+ StringAggregate_ptr tmp = new StringAggregate;
286+
287+ fn->name_ ( " " );
288+ fn->time_stamp_ ( " " );
289+ tmp->StrToVal ( " " , &_error,
290+ fn->attributes [2 ].
291+ aDesc -> DomainType (),
292+ _headerInstances );
293+ fn->author_ ( tmp );
294+
295+ tmp->StrToVal ( " " , &_error,
296+ fn->attributes [3 ].
297+ aDesc -> DomainType (),
298+ _headerInstances );
299+ fn->organization_ ( tmp );
300+
301+ fn->preprocessor_version_ ( " " );
302+ fn->originating_system_ ( " " );
303+ fn->authorization_ ( " " );
428304
429- fn->STEPfile_id = HeaderId ( " File_Name" );
305+ fn->STEPfile_id = HeaderId ( " File_Name" );
430306
431307 return fn;
432308}
433309
434310SCLP23 (Application_instance)*
435311STEPfile::HeaderDefaultFileDescription()
436312{
437- p21DIS_File_description * fd = new p21DIS_File_description ;
313+ SdaiFile_description * fd = new SdaiFile_description ;
438314
439- fd->implementation_level (" " );
315+ fd->implementation_level_ (" " );
440316
441317 fd->STEPfile_id = HeaderId (" File_Description" );
442318
@@ -446,9 +322,9 @@ STEPfile::HeaderDefaultFileDescription()
446322SCLP23 (Application_instance)*
447323STEPfile::HeaderDefaultFileSchema()
448324{
449- p21DIS_File_schema * fs = new p21DIS_File_schema ;
325+ SdaiFile_schema * fs = new SdaiFile_schema ;
450326
451- fs->schema_identifiers (). StrToVal (" " , &_error,
327+ fs->schema_identifiers_ ()-> StrToVal (" " , &_error,
452328 fs->attributes [0 ].
453329 aDesc -> DomainType (),
454330 _headerInstances);
@@ -1806,12 +1682,12 @@ STEPfile::WriteHeaderInstanceFileName (ostream& out)
18061682 {
18071683 // ERROR: no File_Name instance in _headerInstances
18081684 // create a File_Name instance
1809- // (p21DIS_File_name *)se = HeaderDefaultFileName();
1685+ // (SdaiFile_name *)se = HeaderDefaultFileName();
18101686 se = (SCLP23 (Application_instance) *)HeaderDefaultFileName ();
18111687 }
18121688
18131689// set some of the attribute values at time of output
1814- p21DIS_File_name * fn = (p21DIS_File_name *)se;
1690+ SdaiFile_name * fn = (SdaiFile_name *)se;
18151691
18161692/* I'm not sure this is a good idea that Peter did but I'll leave around - DAS
18171693 // write time_stamp (as specified in ISO Standard 8601)
@@ -1825,7 +1701,7 @@ STEPfile::WriteHeaderInstanceFileName (ostream& out)
18251701 strftime (time_buf,26 ," %Y-%m-%dT%H:%M:%S" ,timeptr);
18261702 // s_String s = fn->time_stamp();
18271703 // strncpy((char*)s,time_buf,27);
1828- fn->time_stamp (time_buf);
1704+ fn->time_stamp_ (time_buf);
18291705
18301706// output the values to the file
18311707 WriteHeaderInstance (se, out);
0 commit comments