SHAPER  9.12.0
ModelHighAPI_Dumper Class Referenceabstract

Dump engine for the model. More...

Data Structures

class  DumpStorage
 Storage for the dumped data. More...
 
class  DumpStorageBuffer
 
class  DumpStorageGeom
 Process selection attributes to be dumped by geometric properties. More...
 
class  DumpStorageWeak
 Process selection attributes to be dumped by weak naming. More...
 

Public Types

typedef std::shared_ptr< DumpStorageDumpStoragePtr
 

Public Member Functions

 ModelHighAPI_Dumper ()
 Default constructor. More...
 
virtual ~ModelHighAPI_Dumper ()
 Destructor. More...
 
void addCustomStorage (const DumpStoragePtr &theStorage)
 Add custom storage to collect corresponding dump. More...
 
void clearCustomStorage ()
 Clear custom storages list. More...
 
bool process (const std::shared_ptr< ModelAPI_Document > &theDoc, const std::string &theFileName)
 Dump given document into the file. More...
 
void setDumpDir (const std::string &theDumpDir)
 Keep path to the true dumping directory. More...
 
std::string getDumpDir () const
 Return path to the true dumping directory. More...
 
void importModule (const std::string &theModuleName)
 Add module to list of imported modules. More...
 
const std::string & name (const EntityPtr &theEntity, bool theSaveNotDumped=true, bool theUseEntityName=false, bool theSetIsDumped=false)
 Returns name of specified entity. More...
 
const std::string & parentName (const FeaturePtr &theFeature)
 Returns name of parent composite feature for specified entity. More...
 
virtual void dumpParameter (const FeaturePtr &theFeature)=0
 Dump parameter feature only. More...
 
virtual void dumpFeature (const FeaturePtr &theFeature, const bool theForce=false)=0
 Dump given feature. More...
 
virtual void dumpFolder (const FolderPtr &theFolder)=0
 Dump folder. More...
 
void postpone (const EntityPtr &theEntity)
 Set feature postponed until all its dependencies are not dumped. More...
 
void doNotDumpFeature (const FeaturePtr &theFeature)
 Set a feature that should not be dumped anyway. More...
 
void dumpSubFeatureNameAndColor (const std::string theSubFeatureGet, const FeaturePtr &theSubFeature)
 Dump sub-feature name and color, without dumping feature creation. More...
 
virtual std::string attributeGetter (const FeaturePtr &theFeature, const std::string &theAttrName) const =0
 Return name of getter for corresponding attribute. More...
 
virtual std::string featureWrapper (const FeaturePtr &theFeature) const =0
 Return name of wrapper feature. More...
 
ModelHighAPI_Dumperoperator<< (const char theChar)
 Dump character. More...
 
ModelHighAPI_Dumperoperator<< (const char *theString)
 Dump string. More...
 
ModelHighAPI_Dumperoperator<< (const std::string &theString)
 Dump string. More...
 
ModelHighAPI_Dumperoperator<< (const std::wstring &theString)
 Dump wstring. More...
 
ModelHighAPI_Dumperoperator<< (const bool theValue)
 Dump boolean. More...
 
ModelHighAPI_Dumperoperator<< (const int theValue)
 Dump integer. More...
 
ModelHighAPI_Dumperoperator<< (const double theValue)
 Dump real. More...
 
void newline ()
 Print std::endl from Python. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< GeomAPI_Pnt > &thePoint)
 Dump GeomAPI_Pnt in the following form: "GeomAPI_Pnt(X, Y, Z)". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< GeomAPI_Dir > &theDir)
 Dump GeomAPI_Dir "GeomAPI_Dir(X, Y, Z)". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< GeomDataAPI_Dir > &theDir)
 Dump GeomDataAPI_Dir in the following form: "X, Y, Z". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< GeomDataAPI_Point > &thePoint)
 Dump GeomDataAPI_Point in the following form: "X, Y, Z". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< GeomDataAPI_Point2D > &thePoint)
 Dump GeomDataAPI_Point2D in the following form: "X, Y". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< GeomDataAPI_Point2DArray > &thePointArray)
 Dump GeomDataAPI_Point2DArray as a list of 2D points. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeBoolean > &theAttrBool)
 Dump AttributeBoolean. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeInteger > &theAttrInt)
 Dump AttributeInteger. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeIntArray > &theArray)
 Dump AttributeIntArray. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeDouble > &theAttrReal)
 Dump AttributeDouble. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeDoubleArray > &theArray)
 Dump AttributeDoubleArray. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeString > &theAttrStr)
 Dump AttributeString. More...
 
ModelHighAPI_Dumperoperator<< (const FeaturePtr &theEntity)
 Dump name of entity and remember to dump "setName" if the entity has user-defined name. More...
 
ModelHighAPI_Dumperoperator<< (const FolderPtr &theFolder)
 Dump folder. More...
 
ModelHighAPI_Dumperoperator<< (const ResultPtr &theResult)
 Dump result. More...
 
ModelHighAPI_Dumperoperator<< (const std::list< ResultPtr > &theResults)
 Dump a list of results. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_Attribute > &theAttr)
 Dump Attribute. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_Object > &theObject)
 Dump Object. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeRefAttr > &theRefAttr)
 Dump AttributeRefAttr. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeRefAttrList > &theRefAttrList)
 Dump AttributeRefAttrList as follows: "[obj1, obj2, obj3, ...]". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeRefList > &theRefList)
 Dump AttributeRefList as follows: "[obj1, obj2, obj3, ...]". More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeSelection > &theAttrSelect)
 Dump AttributeSelection. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeSelectionList > &theAttrSelList)
 Dump AttributeSelectionList. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeReference > &theReference)
 Dump AttributeReference. More...
 
ModelHighAPI_Dumperoperator<< (const std::shared_ptr< ModelAPI_AttributeStringArray > &theArray)
 Dump AttributeStringArray. More...
 
void clearNotDumped ()
 clear list of not dumped entities More...
 
bool isDumped (const EntityPtr &theEntity) const
 Check the entity is already dumped. More...
 
bool isDumped (const std::shared_ptr< ModelAPI_AttributeRefAttr > &theRefAttr) const
 Check theRefAttr is already dumped. More...
 
bool isDumped (const std::shared_ptr< ModelAPI_AttributeRefList > &theRefList) const
 Check all objects in theRefList are already dumped. More...
 
size_t indexOfFirstNotDumped (const std::shared_ptr< ModelAPI_AttributeRefList > &theRefList) const
 Returns the index of the first object in the list which is not dumped yet. More...
 
virtual void exportVariables () const
 Export variables names to another module (calls exportVariable implemented in python) More...
 
virtual void exportVariable (const std::string &, const std::string &) const
 Export one variable name to another module (implemented in python) More...
 
bool dumpCommentBeforeFeature (const FeaturePtr &theFeature) const
 Returns true if the special comment line to improve the readability should be printed before the feature of the given kind. More...
 

Static Public Member Functions

static void setInstance (ModelHighAPI_Dumper *theDumper)
 Sets instance of a dumper. More...
 
static ModelHighAPI_DumpergetInstance ()
 Returns instance of a dumper. More...
 

Protected Member Functions

void dumpEntitySetName ()
 Dump "setName" command if last entity had user-defined name. More...
 

Protected Attributes

std::set< EntityPtr > myNotDumpedEntities
 list of entities, used by other features but not dumped yet More...
 

Friends

class SketchAPI_Sketch
 
class ModelHighAPI_Folder
 
ModelHighAPI_Dumperoperator<< (ModelHighAPI_Dumper &theDumper, std::basic_ostream< char > &(*theEndl)(std::basic_ostream< char > &))
 Dump std::endl. More...
 

Detailed Description

Dump engine for the model.

The dumper can be customized by the set of storages (DumpStorage), for example to identify dumped selected objects by their geometrical properties. By default, the dump is executed to store original names of the selected shapes.

Constructor & Destructor Documentation

◆ ModelHighAPI_Dumper()

ModelHighAPI_Dumper::ModelHighAPI_Dumper ( )

Default constructor.

◆ ~ModelHighAPI_Dumper()

ModelHighAPI_Dumper::~ModelHighAPI_Dumper ( )
virtual

Destructor.

Member Function Documentation

◆ setInstance()

void ModelHighAPI_Dumper::setInstance ( ModelHighAPI_Dumper theDumper)
static

Sets instance of a dumper.

◆ getInstance()

ModelHighAPI_Dumper * ModelHighAPI_Dumper::getInstance ( )
static

Returns instance of a dumper.

◆ addCustomStorage()

void ModelHighAPI_Dumper::addCustomStorage ( const DumpStoragePtr &  theStorage)

Add custom storage to collect corresponding dump.

◆ clearCustomStorage()

void ModelHighAPI_Dumper::clearCustomStorage ( )

Clear custom storages list.

◆ process()

bool ModelHighAPI_Dumper::process ( const std::shared_ptr< ModelAPI_Document > &  theDoc,
const std::string &  theFileName 
)

Dump given document into the file.

Returns
true, if succeed

◆ setDumpDir()

void ModelHighAPI_Dumper::setDumpDir ( const std::string &  theDumpDir)
inline

Keep path to the true dumping directory.

It is used to store image files or any other external files

Parameters
theDumpDirpath to the true dumping directory

◆ getDumpDir()

std::string ModelHighAPI_Dumper::getDumpDir ( ) const
inline

Return path to the true dumping directory.

◆ importModule()

void ModelHighAPI_Dumper::importModule ( const std::string &  theModuleName)

Add module to list of imported modules.

Parameters
theModuleNamename of the module to be imported

◆ name()

const std::string & ModelHighAPI_Dumper::name ( const EntityPtr &  theEntity,
bool  theSaveNotDumped = true,
bool  theUseEntityName = false,
bool  theSetIsDumped = false 
)

Returns name of specified entity.

Parameters
theEntity[in] named entity
theSaveNotDumped[in] if true, the entity should be stored as not dumped (will be dumped automatically)
theUseEntityName[in] if true, the entity name should be used "as is" without changing default name
Returns
name of the entity

◆ parentName()

const std::string & ModelHighAPI_Dumper::parentName ( const FeaturePtr &  theFeature)

Returns name of parent composite feature for specified entity.

◆ dumpParameter()

virtual void ModelHighAPI_Dumper::dumpParameter ( const FeaturePtr &  theFeature)
pure virtual

Dump parameter feature only.

◆ dumpFeature()

virtual void ModelHighAPI_Dumper::dumpFeature ( const FeaturePtr &  theFeature,
const bool  theForce = false 
)
pure virtual

Dump given feature.

◆ dumpFolder()

virtual void ModelHighAPI_Dumper::dumpFolder ( const FolderPtr &  theFolder)
pure virtual

Dump folder.

◆ postpone()

void ModelHighAPI_Dumper::postpone ( const EntityPtr &  theEntity)

Set feature postponed until all its dependencies are not dumped.

The name of the feature is stored anyway.

◆ doNotDumpFeature()

void ModelHighAPI_Dumper::doNotDumpFeature ( const FeaturePtr &  theFeature)
inline

Set a feature that should not be dumped anyway.

◆ dumpSubFeatureNameAndColor()

void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor ( const std::string  theSubFeatureGet,
const FeaturePtr &  theSubFeature 
)

Dump sub-feature name and color, without dumping feature creation.

Used for features which creates sub-features in their execute method.

Parameters
theSubFeatureGet[in] method for getting sub-feature (e.g. "Feature_1.subFeature(0)")
theSubFeature[in] sub-feature

◆ attributeGetter()

virtual std::string ModelHighAPI_Dumper::attributeGetter ( const FeaturePtr &  theFeature,
const std::string &  theAttrName 
) const
pure virtual

Return name of getter for corresponding attribute.

◆ featureWrapper()

virtual std::string ModelHighAPI_Dumper::featureWrapper ( const FeaturePtr &  theFeature) const
pure virtual

Return name of wrapper feature.

◆ operator<<() [1/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const char  theChar)

Dump character.

◆ operator<<() [2/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const char *  theString)

Dump string.

◆ operator<<() [3/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::string &  theString)

Dump string.

◆ operator<<() [4/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::wstring &  theString)

Dump wstring.

◆ operator<<() [5/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const bool  theValue)

Dump boolean.

◆ operator<<() [6/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const int  theValue)

Dump integer.

◆ operator<<() [7/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const double  theValue)

Dump real.

◆ newline()

void ModelHighAPI_Dumper::newline ( )

Print std::endl from Python.

◆ operator<<() [8/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< GeomAPI_Pnt > &  thePoint)

Dump GeomAPI_Pnt in the following form: "GeomAPI_Pnt(X, Y, Z)".

◆ operator<<() [9/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< GeomAPI_Dir > &  theDir)

Dump GeomAPI_Dir "GeomAPI_Dir(X, Y, Z)".

◆ operator<<() [10/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< GeomDataAPI_Dir > &  theDir)

Dump GeomDataAPI_Dir in the following form: "X, Y, Z".

◆ operator<<() [11/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< GeomDataAPI_Point > &  thePoint)

Dump GeomDataAPI_Point in the following form: "X, Y, Z".

◆ operator<<() [12/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< GeomDataAPI_Point2D > &  thePoint)

Dump GeomDataAPI_Point2D in the following form: "X, Y".

◆ operator<<() [13/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< GeomDataAPI_Point2DArray > &  thePointArray)

Dump GeomDataAPI_Point2DArray as a list of 2D points.

◆ operator<<() [14/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeBoolean > &  theAttrBool)

Dump AttributeBoolean.

◆ operator<<() [15/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeInteger > &  theAttrInt)

Dump AttributeInteger.

◆ operator<<() [16/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeIntArray > &  theArray)

Dump AttributeIntArray.

◆ operator<<() [17/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeDouble > &  theAttrReal)

Dump AttributeDouble.

◆ operator<<() [18/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeDoubleArray > &  theArray)

Dump AttributeDoubleArray.

◆ operator<<() [19/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeString > &  theAttrStr)

Dump AttributeString.

◆ operator<<() [20/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const FeaturePtr &  theEntity)

Dump name of entity and remember to dump "setName" if the entity has user-defined name.

◆ operator<<() [21/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const FolderPtr &  theFolder)

Dump folder.

◆ operator<<() [22/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const ResultPtr &  theResult)

Dump result.

◆ operator<<() [23/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::list< ResultPtr > &  theResults)

Dump a list of results.

◆ operator<<() [24/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_Attribute > &  theAttr)

Dump Attribute.

◆ operator<<() [25/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_Object > &  theObject)

Dump Object.

◆ operator<<() [26/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeRefAttr > &  theRefAttr)

Dump AttributeRefAttr.

◆ operator<<() [27/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeRefAttrList > &  theRefAttrList)

Dump AttributeRefAttrList as follows: "[obj1, obj2, obj3, ...]".

◆ operator<<() [28/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeRefList > &  theRefList)

Dump AttributeRefList as follows: "[obj1, obj2, obj3, ...]".

◆ operator<<() [29/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeSelection > &  theAttrSelect)

Dump AttributeSelection.

◆ operator<<() [30/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeSelectionList > &  theAttrSelList)

Dump AttributeSelectionList.

◆ operator<<() [31/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeReference > &  theReference)

Dump AttributeReference.

◆ operator<<() [32/32]

ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<< ( const std::shared_ptr< ModelAPI_AttributeStringArray > &  theArray)

Dump AttributeStringArray.

◆ clearNotDumped()

void ModelHighAPI_Dumper::clearNotDumped ( )

clear list of not dumped entities

◆ isDumped() [1/3]

bool ModelHighAPI_Dumper::isDumped ( const EntityPtr &  theEntity) const

Check the entity is already dumped.

◆ isDumped() [2/3]

bool ModelHighAPI_Dumper::isDumped ( const std::shared_ptr< ModelAPI_AttributeRefAttr > &  theRefAttr) const

Check theRefAttr is already dumped.

◆ isDumped() [3/3]

bool ModelHighAPI_Dumper::isDumped ( const std::shared_ptr< ModelAPI_AttributeRefList > &  theRefList) const

Check all objects in theRefList are already dumped.

◆ indexOfFirstNotDumped()

size_t ModelHighAPI_Dumper::indexOfFirstNotDumped ( const std::shared_ptr< ModelAPI_AttributeRefList > &  theRefList) const

Returns the index of the first object in the list which is not dumped yet.

◆ exportVariables()

void ModelHighAPI_Dumper::exportVariables ( ) const
virtual

Export variables names to another module (calls exportVariable implemented in python)

◆ exportVariable()

virtual void ModelHighAPI_Dumper::exportVariable ( const std::string &  ,
const std::string &   
) const
inlinevirtual

Export one variable name to another module (implemented in python)

◆ dumpCommentBeforeFeature()

bool ModelHighAPI_Dumper::dumpCommentBeforeFeature ( const FeaturePtr &  theFeature) const

Returns true if the special comment line to improve the readability should be printed before the feature of the given kind.

◆ dumpEntitySetName()

void ModelHighAPI_Dumper::dumpEntitySetName ( )
protected

Dump "setName" command if last entity had user-defined name.

Friends And Related Function Documentation

◆ operator<<

ModelHighAPI_Dumper& operator<< ( ModelHighAPI_Dumper theDumper,
std::basic_ostream< char > &(*)(std::basic_ostream< char > &)  theEndl 
)
friend

Dump std::endl.

Field Documentation

◆ myNotDumpedEntities

std::set<EntityPtr> ModelHighAPI_Dumper::myNotDumpedEntities
protected

list of entities, used by other features but not dumped yet