5.1 Overview
The P21FileSplitter class is used to split a STEP Part 21 file into several parts -- each containing the entities in the corresponding working set. The class uses a set of P21WorkingSet objects, with one P21WorkingSet for each of the split files. The rest of the entities in the original file is written into a special "leftover" file.
5.2 P21FileSplitter Constructors
P21FileSplitter( RoseBoolean isa_mode = ROSE_FALSE );
This constructor implementation creates an empty working set object. The isa_mode argument sets the "IS-A" mode for selection -- if it is ROSE_TRUE , the object will consider complex ( AND/OR ) entities that have an IS-A relationship to entities in the working set. A complex entity does not have a specific type, but rather has a set of types. When this argument is ROSE_TRUE the object will take a complex entity if at least one of its types is present in the working set. If this argument is ROSE_FALSE , the object will consider only exact types, thus ignoring complex entities altogether.
P21FileSplitter( STR ws_file_name, RoseBoolean isa_mode = ROSE_FALSE );
This constructor creates an object and fills the working set from the given file. This working set file has a different syntax structure than a working set file used by the P21WorkingSet class -- each entity specification is followed by a semicolon and a split file name into which the entities satisfying this specification should be placed.
P21FileSplitter( SetOfString* ws, RoseBoolean isa_mode=ROSE_FALSE );
This constructor creates an object and fills the working set from the given list of strings. The strings in the set pointed by the ws argument should be specified using the same syntax as described above.
5.3 P21FileSplitter Destructor
~P21FileSplitter();
The destructor cleans the object (calls the reset method) and then destroys the object itself.
5.4 add()
void add( P21WorkingSetPtr* entry, STR fileName );
This method adds a new entry to the set of working sets.
The entry argument is a pointer to a P21WorkingSet object that should be associated with the file name given in the second argument.
5.5 remove()
void remove( int index );
The remove method removes the entry from the set of working sets. The index argument is a zero-based index of a working set.
5.6 isaMode()
RoseBoolean isaMode();
The method returns the "IS A" mode flag.
void isaMode( RoseBoolean isa_mode );
This method sets the "IS A" mode flag.
The "IS-A" mode is used for type selection -- if this mode is set to
ROSE_TRUE
, the object will consider complex (
AND/OR
) entities that have an IS-A relationship to entities in the working set. A complex entity does not have a specific type, but rather has a set of types. When the "IS-A" mode is on the object will take a complex entity if at least one of its types is present in the working set. If the mode is reset
(
ROSE_FALSE
), the object will consider only exact types, thus ignoring complex entities altogether.
5.7 setSafeMode()
void setSafeMode( P21WorkingSet::EMODE safe_mode );
This method is used to set the "safety level" of operation. The safe_mode argument is an enum value defined in the P21WorkingSet class as:
typedef enum { FAST, SAFE, SAFEST } EMODE;
When the safety level is set to FAST , the object is configured for maximum performance but some rare syntax in the Part 21 file may cause the object to behave incorrectly. Examples of such syntax include constructs that look like entity references ( #<number> ) inside character strings and comments within entity definitions. For example:
#10=MY_ENITY(`Name', 12, #40, `Will break #130 here', 99.34);
#20=ANOTHER_ONE(`Untitled', /* Will break here #50 too */ 8, #100, #70);
The entity #10 will cause incorrect operation in the FAST mode, but will be processed correctly in the SAFE and the SAFEST modes. The entity #20 will be processed correctly only in the SAFEST mode.
Note
The default setting is always FAST .
5.8 reset()
void reset();
This method cleans the object by removing all entries from the set of working sets. It also calls the reset method for each of the working sets before removing it.
5.9 setLeftoverName()
void setLeftoverName( STR szName );
This method sets the name of the "leftover" file. This file is a last result of the split operation -- all entities not used by any of the working sets are written to this file. The default name of this file is "leftover.stp".
5.10 split()
void split( STR file_name );
This method performs the splitting. The file_name argument specifies the name of the STEP Part 21 file to split.
Note
This method works only on STEP Part21 files. It will not work on ROSE files.