mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024885: Getting rid of "TKAdvTools" toolkit
"TKAdvTools" toolkit was deleted. And packages from this toolkit were: - GraphDS -> deleted - GraphTools -> moved to WOK - Dynamic -> deleted - Materials -> deleted - Expr -> moved to TKMath - ExprIntrp -> moved to TKMath - TKAdvTools -> deleted All references of the "TKAdvTools" toolkit were removed
This commit is contained in:
parent
011b361de5
commit
6268cc68d7
@ -7,17 +7,13 @@ p BVH
|
|||||||
p CSLib
|
p CSLib
|
||||||
p Convert
|
p Convert
|
||||||
p Dico
|
p Dico
|
||||||
p Dynamic
|
|
||||||
p ElCLib
|
p ElCLib
|
||||||
p ElSLib
|
p ElSLib
|
||||||
p Expr
|
p Expr
|
||||||
p ExprIntrp
|
p ExprIntrp
|
||||||
p FSD
|
p FSD
|
||||||
p GeomAbs
|
p GeomAbs
|
||||||
p GraphDS
|
|
||||||
p GraphTools
|
|
||||||
p MMgt
|
p MMgt
|
||||||
p Materials
|
|
||||||
p Message
|
p Message
|
||||||
p OSD
|
p OSD
|
||||||
p PLib
|
p PLib
|
||||||
@ -40,7 +36,6 @@ p UnitsAPI
|
|||||||
p gp
|
p gp
|
||||||
p math
|
p math
|
||||||
r OS
|
r OS
|
||||||
t TKAdvTools
|
|
||||||
t TKMath
|
t TKMath
|
||||||
t TKernel
|
t TKernel
|
||||||
p Adaptor2d
|
p Adaptor2d
|
||||||
|
@ -943,7 +943,7 @@ This group allows testing extended data exchange packages.
|
|||||||
| Data Exchange | TKSTEPBase, TKSTEPAttr, TKSTEP209, TKSTEP | step |
|
| Data Exchange | TKSTEPBase, TKSTEPAttr, TKSTEP209, TKSTEP | step |
|
||||||
| Data Exchange | TKSTL, TKVRML | stlvrml |
|
| Data Exchange | TKSTL, TKVRML | stlvrml |
|
||||||
| Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXDEIGES, TKXDESTEP, TKXmlXCAF, TKBinXCAF | xde |
|
| Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXDEIGES, TKXDESTEP, TKXmlXCAF, TKBinXCAF | xde |
|
||||||
| Foundation Classes | TKernel, TKMath, TKAdvTools | fclasses |
|
| Foundation Classes | TKernel, TKMath | fclasses |
|
||||||
| Modeling_algorithms | TKGeomAlgo, TKTopAlgo, TKPrim, TKBO, TKBool, TKHLR, TKFillet, TKOffset, TKFeat, TKXMesh | modalg |
|
| Modeling_algorithms | TKGeomAlgo, TKTopAlgo, TKPrim, TKBO, TKBool, TKHLR, TKFillet, TKOffset, TKFeat, TKXMesh | modalg |
|
||||||
| Modeling Data | TKG2d, TKG3d, TKGeomBase, TKBRep | moddata |
|
| Modeling Data | TKG2d, TKG3d, TKGeomBase, TKBRep | moddata |
|
||||||
| Visualization | TKService, TKV2d, TKV3d, TKOpenGl, TKMeshVS, TKNIS, TKVoxel | vis |
|
| Visualization | TKService, TKV2d, TKV3d, TKOpenGl, TKMeshVS, TKNIS, TKVoxel | vis |
|
||||||
|
@ -1,294 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
package Dynamic
|
|
||||||
|
|
||||||
---Purpose: This package propose a set of abstract persistent
|
|
||||||
-- classes. These classes may be sort in three main
|
|
||||||
-- groups, which are :
|
|
||||||
--
|
|
||||||
-- - fuzzy classes
|
|
||||||
-- - methods
|
|
||||||
-- - dynamic classes
|
|
||||||
--
|
|
||||||
-- And in two complementary groups used by the
|
|
||||||
-- previously described family, which are :
|
|
||||||
--
|
|
||||||
-- - parameter classes
|
|
||||||
-- - variable classes
|
|
||||||
--
|
|
||||||
-- All the main classes are manipulated through two
|
|
||||||
-- steps which are :
|
|
||||||
--
|
|
||||||
-- - the definition which gives the signature of the
|
|
||||||
-- object
|
|
||||||
-- - the instanciation which always references a
|
|
||||||
-- definition
|
|
||||||
--
|
|
||||||
-- This separation has been created to clearly
|
|
||||||
-- separate the definition of an object, a method or
|
|
||||||
-- a class which is the description and the instance
|
|
||||||
-- which is the utilisation with a particular set of
|
|
||||||
-- values. In this case for few instanciations of
|
|
||||||
-- the same object, the definition can be unique.
|
|
||||||
--
|
|
||||||
-- Each family address a particular problem.
|
|
||||||
--
|
|
||||||
-- Dynamic class
|
|
||||||
-- -------------
|
|
||||||
--
|
|
||||||
-- This family of classes offers the possibility to
|
|
||||||
-- define and to manipulate dynamically objets with
|
|
||||||
-- the same specifications as C++ objects.
|
|
||||||
-- Dynamically means without CDL description and
|
|
||||||
-- without compilation and link if all the methods
|
|
||||||
-- attached are interpreted methods.
|
|
||||||
--
|
|
||||||
-- The first thing to do is to define the signature
|
|
||||||
-- of the class, in terms of fields and methods.
|
|
||||||
--
|
|
||||||
-- You can also derive a class from others, add
|
|
||||||
-- fields, and add or redefine methods.
|
|
||||||
--
|
|
||||||
-- Then instances of the class can be created and
|
|
||||||
-- values can be assigned to the fields.
|
|
||||||
--
|
|
||||||
-- It is then possible to execute methods attached to
|
|
||||||
-- the definition of the class. These methods may set
|
|
||||||
-- computed values to other fields, or simply return
|
|
||||||
-- them.
|
|
||||||
--
|
|
||||||
-- A method can be compiled or interpreted.
|
|
||||||
--
|
|
||||||
-- Fuzzy class
|
|
||||||
-- -----------
|
|
||||||
--
|
|
||||||
-- A fuzzy class is a degeneration of a dynamic
|
|
||||||
-- class. Only the fields are specified. These
|
|
||||||
-- classes are useful to describe objects with
|
|
||||||
-- various definitions, and with the number and the
|
|
||||||
-- nature of fields depending of the definition.
|
|
||||||
--
|
|
||||||
-- The definitions of the lights for Photo Realistic
|
|
||||||
-- Renderer is an illutration of the use of the fuzzy
|
|
||||||
-- classes.
|
|
||||||
--
|
|
||||||
-- These lights have the same definitions in terms of
|
|
||||||
-- parameters as the lights used in the LightWorks
|
|
||||||
-- module.
|
|
||||||
--
|
|
||||||
-- For each type of light an exhaustive set of
|
|
||||||
-- parameters is described, and each parameter is
|
|
||||||
-- defined by its name, its type and, if necessary,
|
|
||||||
-- its default value as follows :
|
|
||||||
--
|
|
||||||
-- ambient
|
|
||||||
-- "intensity" Standard_Real 1.0
|
|
||||||
-- "colour" Materials_PColor 1.0 1.0 1.0
|
|
||||||
--
|
|
||||||
-- distant
|
|
||||||
-- "intensity" Standard_Real 1.0
|
|
||||||
-- "colour" Materials_PColor 1.0 1.0 1.0
|
|
||||||
-- "location" PGeom_CartesianPoint 0.0 0.0 1.0
|
|
||||||
-- "to" PGeom_CartesianPoint 0.0 0.0 0.0
|
|
||||||
-- "shadows" Standard_Boolean Standard_False
|
|
||||||
-- "shadow resolution" Standard_Integer 256
|
|
||||||
-- "shadow quality" Standard_Integer 4
|
|
||||||
-- "shadow softness" Standard_Real 1.0
|
|
||||||
--
|
|
||||||
-- eye
|
|
||||||
-- "intensity" Standard_Real 1.0
|
|
||||||
-- "colour" Materials_PColor 1.0 1.0 1.0
|
|
||||||
--
|
|
||||||
-- point
|
|
||||||
-- "intensity" Standard_Real 1.0
|
|
||||||
-- "colour" Materials_PColor 1.0 1.0 1.0
|
|
||||||
-- "location" PGeom_CartesianPoint 0.0 0.0 0.0
|
|
||||||
-- "fall off" LightWorks_LiFallOffType LI_FALL_OFF_CONSTANT
|
|
||||||
-- "shadows" Standard_Boolean Standard_False
|
|
||||||
-- "shadow resolution" Standard_Integer 256
|
|
||||||
-- "shadow quality" Standard_Integer 4
|
|
||||||
-- "shadow softness" Standard_Real 1.0
|
|
||||||
--
|
|
||||||
-- spot
|
|
||||||
-- "intensity" Standard_Real 1.0
|
|
||||||
-- "colour" Materials_PColor 1.0 1.0 1.0
|
|
||||||
-- "location" PGeom_CartesianPoint 0.0 0.0 1.0
|
|
||||||
-- "to" PGeom_CartesianPoint 0.0 0.0 0.0
|
|
||||||
-- "fall off" LightWorks_LiFallOffType LI_FALL_OFF_CONSTANT
|
|
||||||
-- "cone angle" Standard_Real 60.0
|
|
||||||
-- "cone delta angle" Standard_Real 5.0
|
|
||||||
-- "beam distribution" Standard_Real 2.0
|
|
||||||
-- "shadows" Standard_Boolean Standard_False
|
|
||||||
-- "shadow resolution" Standard_Integer 256
|
|
||||||
-- "shadow quality" Standard_Integer 4
|
|
||||||
-- "shadow softness" Standard_Real 1.0
|
|
||||||
--
|
|
||||||
-- All these definitions are described in a file
|
|
||||||
-- which is read at the first creation of a light
|
|
||||||
-- instance to be put in a dictionary.
|
|
||||||
--
|
|
||||||
-- At the creation of an instance, just a reference
|
|
||||||
-- on the definition is set. All the parameter values
|
|
||||||
-- are read in the definition. If now a value of one
|
|
||||||
-- parameter is changed, the modified parameter is
|
|
||||||
-- added to the instance. So only the modified
|
|
||||||
-- parameters are directely attached to the instance.
|
|
||||||
-- This behaviour allows the use of an instance as
|
|
||||||
-- definition, and can be useful to create catalogs
|
|
||||||
-- of standards which can be directly questioned in
|
|
||||||
-- the database.
|
|
||||||
--
|
|
||||||
-- The use of fuzzy classes needs four prerequisites
|
|
||||||
-- which are :
|
|
||||||
--
|
|
||||||
-- - The creation of a file with the exhaustive
|
|
||||||
-- description of all the possible types taken by an
|
|
||||||
-- object and for each type the complete set of
|
|
||||||
-- parameters in terms of name, type, and, if
|
|
||||||
-- necessary, default value.
|
|
||||||
--
|
|
||||||
-- - The inheritance from the class
|
|
||||||
-- FuzzyDefinitionsDictionary and, if necessary, the
|
|
||||||
-- redefinition of the Switch method for the non-
|
|
||||||
-- standard type of parameters described in the file.
|
|
||||||
--
|
|
||||||
-- - The following method :
|
|
||||||
--
|
|
||||||
-- void DictionaryOfDefinitions(Handle(MyPackage_MyDictionary)&);
|
|
||||||
--
|
|
||||||
-- must be writen in the file MyPackage.cxx, because
|
|
||||||
-- this method is automatically called by the
|
|
||||||
-- constructor of FuzzyInstance. This method tests if
|
|
||||||
-- the dictionary has been created yet. If it is
|
|
||||||
-- true the method returns a reference to it,
|
|
||||||
-- otherwise the method creates the dictionary before
|
|
||||||
-- returning the reference.
|
|
||||||
--
|
|
||||||
-- - The instanciation of the FuzzyInstance class
|
|
||||||
-- with the pre-defined dictionary.
|
|
||||||
--
|
|
||||||
-- Method class
|
|
||||||
-- ------------
|
|
||||||
--
|
|
||||||
-- The behaviour of these classes are similar to
|
|
||||||
-- fuzzy classes. Only the semantic is different.
|
|
||||||
-- These classes are for memorized actions or
|
|
||||||
-- constraints, e.g. they are useful to memorized
|
|
||||||
-- persistently the working system of Imagine
|
|
||||||
-- Conception.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
TCollection,
|
|
||||||
MMgt
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
enumeration ModeEnum is
|
|
||||||
IN,
|
|
||||||
OUT,
|
|
||||||
INOUT,
|
|
||||||
INTERNAL,
|
|
||||||
CONSTANT
|
|
||||||
end ModeEnum;
|
|
||||||
|
|
||||||
generic class Node;
|
|
||||||
|
|
||||||
deferred class Parameter;
|
|
||||||
|
|
||||||
class BooleanParameter;
|
|
||||||
|
|
||||||
class IntegerParameter;
|
|
||||||
|
|
||||||
class RealParameter;
|
|
||||||
|
|
||||||
class StringParameter;
|
|
||||||
|
|
||||||
class ObjectParameter;
|
|
||||||
|
|
||||||
class InstanceParameter;
|
|
||||||
|
|
||||||
class ParameterNode instantiates Node from Dynamic(Parameter from Dynamic);
|
|
||||||
|
|
||||||
class Variable;
|
|
||||||
|
|
||||||
class VariableGroup;
|
|
||||||
|
|
||||||
deferred class AbstractVariableInstance;
|
|
||||||
|
|
||||||
class VariableInstance;
|
|
||||||
|
|
||||||
class CompositVariableInstance;
|
|
||||||
|
|
||||||
class VariableNode instantiates Node from Dynamic(Variable from Dynamic);
|
|
||||||
|
|
||||||
deferred class Method;
|
|
||||||
|
|
||||||
deferred class MethodDefinition;
|
|
||||||
|
|
||||||
class CompiledMethod;
|
|
||||||
|
|
||||||
class InterpretedMethod;
|
|
||||||
|
|
||||||
class CompositMethod;
|
|
||||||
|
|
||||||
deferred class MethodDefinitionsDictionary;
|
|
||||||
|
|
||||||
class SeqOfMethods instantiates
|
|
||||||
Sequence from TCollection (Method from Dynamic);
|
|
||||||
class SequenceOfMethods instantiates
|
|
||||||
HSequence from TCollection (Method from Dynamic, SeqOfMethods from Dynamic);
|
|
||||||
|
|
||||||
class SeqOfMethodDefinitions instantiates
|
|
||||||
Sequence from TCollection (MethodDefinition from Dynamic);
|
|
||||||
class SequenceOfMethodDefinitions instantiates
|
|
||||||
HSequence from TCollection (MethodDefinition from Dynamic,
|
|
||||||
SeqOfMethodDefinitions from Dynamic);
|
|
||||||
|
|
||||||
class DynamicClass;
|
|
||||||
|
|
||||||
class DynamicDerivedClass;
|
|
||||||
|
|
||||||
class SeqOfClasses instantiates
|
|
||||||
Sequence from TCollection (DynamicClass from Dynamic);
|
|
||||||
class SequenceOfClasses instantiates
|
|
||||||
HSequence from TCollection (DynamicClass from Dynamic, SeqOfClasses from Dynamic);
|
|
||||||
|
|
||||||
class DynamicInstance;
|
|
||||||
|
|
||||||
deferred class FuzzyClass;
|
|
||||||
|
|
||||||
class FuzzyDefinition;
|
|
||||||
|
|
||||||
class SeqOfFuzzyDefinitions instantiates
|
|
||||||
Sequence from TCollection (FuzzyDefinition from Dynamic);
|
|
||||||
class SequenceOfFuzzyDefinitions instantiates
|
|
||||||
HSequence from TCollection (FuzzyDefinition from Dynamic,
|
|
||||||
SeqOfFuzzyDefinitions from Dynamic);
|
|
||||||
|
|
||||||
deferred class FuzzyDefinitionsDictionary;
|
|
||||||
|
|
||||||
generic class FuzzyInstance;
|
|
||||||
|
|
||||||
Mode(amode : CString from Standard) returns ModeEnum from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
end Dynamic;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
// Created on: 1994-08-31
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// Historique :
|
|
||||||
// CRD : 15/04/97 : Correction warning de compil.
|
|
||||||
// CRD : 03/07/97 : Portage Windows NT.
|
|
||||||
|
|
||||||
|
|
||||||
#include <Dynamic.hxx>
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
#ifdef WNT
|
|
||||||
//#define strcasecmp _stricoll
|
|
||||||
#include <stdio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Mode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_ModeEnum Dynamic::Mode(const Standard_CString amode)
|
|
||||||
{
|
|
||||||
Dynamic_ModeEnum aMode=Dynamic_IN;
|
|
||||||
if (!strcasecmp(amode,"in" )) aMode = Dynamic_IN;
|
|
||||||
else if(!strcasecmp(amode,"out" )) aMode = Dynamic_OUT;
|
|
||||||
else if(!strcasecmp(amode,"inout" )) aMode = Dynamic_INOUT;
|
|
||||||
else if(!strcasecmp(amode,"Internal")) aMode = Dynamic_INTERNAL;
|
|
||||||
else if(!strcasecmp(amode,"constant")) aMode = Dynamic_CONSTANT;
|
|
||||||
return aMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
-- Created on: 1994-09-05
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class AbstractVariableInstance from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class is the header class to define instances
|
|
||||||
-- of variables. There are two kinds of instances,
|
|
||||||
-- These are VariableInstance which addresses only
|
|
||||||
-- one Variable and CompositVariableInstance which is
|
|
||||||
-- able to address more than one variable. This last
|
|
||||||
-- class is useful for methods with a variable number
|
|
||||||
-- of arguments.
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Variable from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize;
|
|
||||||
|
|
||||||
Variable(me : mutable ; avariable : Variable from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: This deferred method must be implemented in the
|
|
||||||
-- derived classes for setting reference(s) to the
|
|
||||||
-- corresponding variable(s) which define the signature
|
|
||||||
-- of the method definition.
|
|
||||||
|
|
||||||
is deferred;
|
|
||||||
|
|
||||||
|
|
||||||
end AbstractVariableInstance;
|
|
@ -1,36 +0,0 @@
|
|||||||
// Created on: 1994-09-05
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_AbstractVariableInstance.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_AbstractVariableInstance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_AbstractVariableInstance::Dynamic_AbstractVariableInstance()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
//void Dynamic_AbstractVariableInstance::Variable(const Handle(Dynamic_Variable)& avariable)
|
|
||||||
void Dynamic_AbstractVariableInstance::Variable(const Handle(Dynamic_Variable)& )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
|||||||
-- Created on: 1994-01-24
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class BooleanParameter from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
Parameter from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class describes a parameter with a boolean
|
|
||||||
-- as value.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
OStream from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates a boolean parameter with <aparameter> as name.
|
|
||||||
|
|
||||||
returns mutable BooleanParameter from Dynamic;
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard;
|
|
||||||
avalue : Boolean from Standard)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates a boolean parameter with <aparameter> and <avalue>
|
|
||||||
-- respectively as name and value.
|
|
||||||
|
|
||||||
returns mutable BooleanParameter from Dynamic;
|
|
||||||
|
|
||||||
Create(aparameter , avalue : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates a boolean parameter with <aparameter> as name
|
|
||||||
-- and <avalue> as value. <avalue> is a CString with two possible
|
|
||||||
-- values which are : "Standard_True" and "Standard_False".
|
|
||||||
|
|
||||||
returns mutable BooleanParameter from Dynamic;
|
|
||||||
|
|
||||||
Value(me) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the boolean value <thevalue>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value (me : mutable ; avalue : Boolean from Standard)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
--- Purpose: Sets the field <thevalue> with the boolean value <avalue>
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thevalue : Boolean from Standard;
|
|
||||||
|
|
||||||
end BooleanParameter;
|
|
@ -1,100 +0,0 @@
|
|||||||
// Created on: 1994-01-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// Historique :
|
|
||||||
// CRD : 03/07/97 : Portage Windows NT.
|
|
||||||
|
|
||||||
|
|
||||||
#include <Dynamic_BooleanParameter.ixx>
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
#ifdef WNT
|
|
||||||
//#define strcasecmp _stricoll
|
|
||||||
#include <stdio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_BooleanParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_BooleanParameter::Dynamic_BooleanParameter
|
|
||||||
(const Standard_CString aparameter)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_BooleanParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_BooleanParameter::Dynamic_BooleanParameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Standard_Boolean avalue)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_BooleanParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_BooleanParameter::Dynamic_BooleanParameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Standard_CString avalue)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
if (!strcasecmp(avalue,"Standard_True")) thevalue = Standard_True;
|
|
||||||
else if(!strcasecmp(avalue,"Standard_False")) thevalue = Standard_False;
|
|
||||||
else cout<<"BooleanParameter ("<<avalue<<") n'existe pas"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_BooleanParameter::Value() const
|
|
||||||
{
|
|
||||||
return thevalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_BooleanParameter::Value(const Standard_Boolean avalue)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_BooleanParameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Dynamic_Parameter::Dump(astream);
|
|
||||||
astream<<" "<<thevalue;
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
-- Created on: 1993-01-28
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class CompiledMethod from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
MethodDefinition from Dynamic
|
|
||||||
---Purpose: A Dynamic_CompiledMethod adds to the definition of the
|
|
||||||
-- Dynamic_Method the C++ mangled name of the function to
|
|
||||||
-- be run. An application using instances of this class
|
|
||||||
-- must bind the C++ name of the method with the true
|
|
||||||
-- address in the executable.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aname : CString from Standard;
|
|
||||||
afunction : CString from Standard) returns mutable CompiledMethod from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates a compiled method with <aname> as user name
|
|
||||||
-- and <afunction> as C++ mangled name.
|
|
||||||
|
|
||||||
Function(me : mutable ; afunction : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Sets the C++ mangled name of the method to the field
|
|
||||||
-- <thefunction>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Function(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the C++ mangled name of the function.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefunction : HAsciiString from TCollection;
|
|
||||||
|
|
||||||
end CompiledMethod;
|
|
@ -1,50 +0,0 @@
|
|||||||
// Created on: 1993-01-28
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_CompiledMethod.ixx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_CompiledMethod
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_CompiledMethod::Dynamic_CompiledMethod(const Standard_CString aname,
|
|
||||||
const Standard_CString afunction)
|
|
||||||
: Dynamic_MethodDefinition(aname)
|
|
||||||
{
|
|
||||||
thefunction = new TCollection_HAsciiString(afunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Function
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_CompiledMethod::Function(const Standard_CString afunction)
|
|
||||||
{
|
|
||||||
thefunction = new TCollection_HAsciiString(afunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Function
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TCollection_AsciiString Dynamic_CompiledMethod::Function() const
|
|
||||||
{
|
|
||||||
return thefunction->String();
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
-- Created on: 1994-08-26
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class CompositMethod from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
MethodDefinition from Dynamic
|
|
||||||
---Purpose: A composite method is defined as a collection of
|
|
||||||
-- method instances. This collection describes a more
|
|
||||||
-- complex program or a network of elementary
|
|
||||||
-- functions. The order of the method instances is
|
|
||||||
-- not significant. It is the references to the
|
|
||||||
-- variables which define the signature of the
|
|
||||||
-- composite method which define the precedence of
|
|
||||||
-- one method in relation with another.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
Method from Dynamic,
|
|
||||||
SequenceOfMethods from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aname : CString from Standard) returns mutable CompositMethod from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates a composit method with <aname> as name.
|
|
||||||
|
|
||||||
Method(me : mutable ; amethod : Method from Dynamic)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Adds <amethod>, which is an elementary or a composit
|
|
||||||
-- method to <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
NumberOfMethods(me) returns Integer from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the number of methods referenced by the
|
|
||||||
-- composit method <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Method(me ; anindex : Integer from Standard) returns any Method from Dynamic
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the method of range <anindex>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thesequenceofmethods : SequenceOfMethods from Dynamic;
|
|
||||||
|
|
||||||
end CompositMethod;
|
|
@ -1,81 +0,0 @@
|
|||||||
// Created on: 1994-08-26
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// CRD : 15/04/97 : Passage WOK++ : Remplacement de TYPE par STANDARD_TYPE
|
|
||||||
|
|
||||||
#include <Dynamic_CompositMethod.ixx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_CompositMethod
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_CompositMethod::Dynamic_CompositMethod(const Standard_CString aname)
|
|
||||||
: Dynamic_MethodDefinition(aname)
|
|
||||||
{
|
|
||||||
thesequenceofmethods = new Dynamic_SequenceOfMethods();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Method
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_CompositMethod::Method(const Handle(Dynamic_Method)& amethod)
|
|
||||||
{
|
|
||||||
if(amethod->IsKind(STANDARD_TYPE(Dynamic_MethodDefinition)))
|
|
||||||
cout<<"bad argument type"<<endl;
|
|
||||||
else
|
|
||||||
thesequenceofmethods->Append(amethod);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NumberOfMethods
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer Dynamic_CompositMethod::NumberOfMethods() const
|
|
||||||
{
|
|
||||||
return thesequenceofmethods->Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Method
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Method) Dynamic_CompositMethod::Method(const Standard_Integer anindex) const
|
|
||||||
{
|
|
||||||
return thesequenceofmethods->Value(anindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_CompositMethod::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
astream << "CompositMethod : " << endl;
|
|
||||||
Dynamic_MethodDefinition::Dump(astream);
|
|
||||||
astream << "Dump of Methods Instances : " << endl;
|
|
||||||
for (Standard_Integer i=1; i<= thesequenceofmethods->Length(); i++) {
|
|
||||||
astream << "Method No : " << i << endl;
|
|
||||||
thesequenceofmethods->Value(i)->Dump(astream);
|
|
||||||
astream << endl;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
-- Created on: 1994-09-05
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class CompositVariableInstance from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
AbstractVariableInstance from Dynamic
|
|
||||||
---Purpose: This class corresponds to the instanciation of a
|
|
||||||
-- variable group. It allows the setting of more than
|
|
||||||
-- one variable in a variable instance. It is useful
|
|
||||||
-- when a method takes a collection of homogeneous
|
|
||||||
-- objects as argument. For example a wire needs
|
|
||||||
-- edges as argument.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Variable from Dynamic,
|
|
||||||
VariableNode from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable CompositVariableInstance from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates a new empty instance of CompositVariable-
|
|
||||||
-- Instance.
|
|
||||||
|
|
||||||
Variable(me : mutable ; avariable : Variable from Dynamic)
|
|
||||||
|
|
||||||
---Purpose: Sets <avariable> into the collection of variable.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
FirstVariableNode(me) returns VariableNode from Dynamic
|
|
||||||
|
|
||||||
---Purpose: Returns the first VariableNode useful to explore the
|
|
||||||
-- list of variables addressed by <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefirstvariablenode : VariableNode from Dynamic;
|
|
||||||
|
|
||||||
end CompositVariableInstance;
|
|
@ -1,47 +0,0 @@
|
|||||||
// Created on: 1994-09-05
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_CompositVariableInstance.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_CompositVariableInstance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_CompositVariableInstance::Dynamic_CompositVariableInstance()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_CompositVariableInstance::Variable(const Handle(Dynamic_Variable)& avariable)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_VariableNode) variablenode = new Dynamic_VariableNode(avariable);
|
|
||||||
variablenode->Next(thefirstvariablenode);
|
|
||||||
thefirstvariablenode = variablenode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FirstVariable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_VariableNode) Dynamic_CompositVariableInstance::FirstVariableNode() const
|
|
||||||
{
|
|
||||||
return thefirstvariablenode;
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class DynamicClass from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
---Purpose: A dynamic class is defined as a sequence of
|
|
||||||
-- parameters and as a sequence of methods. The
|
|
||||||
-- specifications are similar to C++ classes. The
|
|
||||||
-- class has to be defined in terms of fields
|
|
||||||
-- (Parameters) and methods. An instance of the class
|
|
||||||
-- must be made to set the fields and to use the
|
|
||||||
-- functionalities.
|
|
||||||
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
DynamicInstance from Dynamic,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
ParameterNode from Dynamic,
|
|
||||||
Method from Dynamic,
|
|
||||||
SequenceOfMethods from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aname : CString from Standard) returns mutable DynamicClass from Dynamic;
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates a new empty instance of DynamicClass.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : Parameter from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds another parameter <aparameter> to the sequence of
|
|
||||||
-- parameter definitions.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
CompiledMethod(me : mutable ; amethod , anaddress : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds another method to the sequence of methods. It has
|
|
||||||
-- <amethod> as name and <anaddress> as mangled name of
|
|
||||||
-- the corresponding C++ function which must be called.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
InterpretedMethod(me : mutable ; amethod , afile : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds another method to the sequence of methods. It
|
|
||||||
-- has <amethod> as name and <afile> as interpreted file.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Method(me ; amethod : CString from Standard) returns any Method from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns a reference to the method object identified by
|
|
||||||
-- the string <amethod>.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Instance(me) returns mutable DynamicInstance from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns an instance object of this class.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: useful for debugging.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thename : HAsciiString from TCollection;
|
|
||||||
thefirstparameternode : ParameterNode from Dynamic;
|
|
||||||
thesequenceofmethods : SequenceOfMethods from Dynamic;
|
|
||||||
|
|
||||||
end ;
|
|
@ -1,137 +0,0 @@
|
|||||||
// Created on: 1993-01-22
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_DynamicClass.ixx>
|
|
||||||
#include <Dynamic_DynamicInstance.hxx>
|
|
||||||
#include <Dynamic_Parameter.hxx>
|
|
||||||
#include <Dynamic_CompiledMethod.hxx>
|
|
||||||
#include <Dynamic_InterpretedMethod.hxx>
|
|
||||||
#include <Dynamic_SequenceOfMethods.hxx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_DynamicClass
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_DynamicClass::Dynamic_DynamicClass(const Standard_CString aname)
|
|
||||||
{
|
|
||||||
thename = new TCollection_HAsciiString(aname);
|
|
||||||
thesequenceofmethods = new Dynamic_SequenceOfMethods();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicClass::Parameter(const Handle(Dynamic_Parameter)& aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode = new Dynamic_ParameterNode(aparameter);
|
|
||||||
parameternode->Next(thefirstparameternode);
|
|
||||||
thefirstparameternode = parameternode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : CompiledMethod
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicClass::CompiledMethod(const Standard_CString amethod,
|
|
||||||
const Standard_CString anaddress)
|
|
||||||
{
|
|
||||||
TCollection_AsciiString string = thename->String();
|
|
||||||
string = string + "_" + amethod;
|
|
||||||
Handle(Dynamic_CompiledMethod) method = new Dynamic_CompiledMethod(string.ToCString(),anaddress);
|
|
||||||
thesequenceofmethods->Append(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : InterpretedMethod
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicClass::InterpretedMethod(const Standard_CString amethod,
|
|
||||||
const Standard_CString afile)
|
|
||||||
{
|
|
||||||
TCollection_AsciiString string = thename->String();
|
|
||||||
string = string + "_" + amethod;
|
|
||||||
Handle(Dynamic_InterpretedMethod) method =
|
|
||||||
new Dynamic_InterpretedMethod(string.ToCString(),afile);
|
|
||||||
thesequenceofmethods->Append(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Method
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Method) Dynamic_DynamicClass::Method(const Standard_CString amethod) const
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
TCollection_AsciiString methodname(amethod);
|
|
||||||
Handle(Dynamic_Method) method;
|
|
||||||
Handle(Dynamic_Method) nullmethod;
|
|
||||||
Handle(Dynamic_SequenceOfMethods) sequenceofmethods = thesequenceofmethods;
|
|
||||||
|
|
||||||
if(methodname.Search("_") == -1)
|
|
||||||
{
|
|
||||||
methodname = thename->String();
|
|
||||||
methodname = methodname + "_" + amethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(index=1;index<=thesequenceofmethods->Length();index++)
|
|
||||||
{
|
|
||||||
method = thesequenceofmethods->Value(index);
|
|
||||||
if(method->Type() == methodname) return method;
|
|
||||||
}
|
|
||||||
return nullmethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Instance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_DynamicInstance) Dynamic_DynamicClass::Instance() const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_DynamicInstance) instance = new Dynamic_DynamicInstance();
|
|
||||||
Handle(Dynamic_DynamicClass) me(this);
|
|
||||||
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
instance->Parameter(parameternode->Object());
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
instance->Class(me);
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
//void Dynamic_DynamicClass::Dump(Standard_OStream& astream) const
|
|
||||||
void Dynamic_DynamicClass::Dump(Standard_OStream& ) const
|
|
||||||
{}
|
|
@ -1,76 +0,0 @@
|
|||||||
-- Created on: 1993-02-05
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class DynamicDerivedClass from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
DynamicClass from Dynamic
|
|
||||||
|
|
||||||
---Purpose: The object of this class is to allow, as in the
|
|
||||||
-- C++ language, the possibility to define a
|
|
||||||
-- DynamicDerivedClass which inherits from one or
|
|
||||||
-- more DynamicClass.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
Method from Dynamic,
|
|
||||||
DynamicInstance from Dynamic,
|
|
||||||
SequenceOfClasses from Dynamic
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aname : CString from Standard) returns mutable DynamicDerivedClass from Dynamic;
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates a new instance of this class with <aname> as name.
|
|
||||||
|
|
||||||
AddClass(me : mutable ; aclass : any DynamicClass from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds another class <aclass> to the sequence of derived
|
|
||||||
-- classes.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Method(me ; amethod : CString from Standard) returns any Method from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Starting with the name of a method, this redefined
|
|
||||||
-- method searches for the right method object in the
|
|
||||||
-- sequence of methods of the derived class and in all
|
|
||||||
-- the inherited classes.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
Instance(me) returns mutable DynamicInstance from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Defines an instance of this class definition.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thesequenceofclasses : SequenceOfClasses from Dynamic;
|
|
||||||
|
|
||||||
end DynamicDerivedClass;
|
|
@ -1,77 +0,0 @@
|
|||||||
// Created on: 1993-02-05
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_DynamicDerivedClass.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_DynamicDerivedClass
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_DynamicDerivedClass::Dynamic_DynamicDerivedClass(const Standard_CString aname)
|
|
||||||
: Dynamic_DynamicClass(aname)
|
|
||||||
{
|
|
||||||
thesequenceofclasses = new Dynamic_SequenceOfClasses();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddClass
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicDerivedClass::AddClass(const Handle(Dynamic_DynamicClass)& aclass)
|
|
||||||
{
|
|
||||||
thesequenceofclasses->Append(aclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Method
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Method) Dynamic_DynamicDerivedClass::Method
|
|
||||||
(const Standard_CString amethod) const
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
Handle(Dynamic_Method) method = Dynamic_DynamicClass::Method(amethod);
|
|
||||||
|
|
||||||
if(method.IsNull())
|
|
||||||
{
|
|
||||||
for(index=1;index<=thesequenceofclasses->Length();index++)
|
|
||||||
{
|
|
||||||
method = (thesequenceofclasses->Value(index))->Method(amethod);
|
|
||||||
if(!method.IsNull()) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Instance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_DynamicInstance) Dynamic_DynamicDerivedClass::Instance() const
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
Handle(Dynamic_DynamicInstance) instance = Dynamic_DynamicClass::Instance();
|
|
||||||
|
|
||||||
for(index=1;index<=thesequenceofclasses->Length();index++)
|
|
||||||
{
|
|
||||||
((thesequenceofclasses->Value(index))->Instance())->Parameter(instance);
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
@ -1,131 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class DynamicInstance from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
---Purpose: A dynamic instance is a reference to the dynamic
|
|
||||||
-- class and a sequence of parameters which is the
|
|
||||||
-- complete listing of all the parameters of all the
|
|
||||||
-- inherited classes.
|
|
||||||
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
Real from Standard,
|
|
||||||
DynamicClass from Dynamic,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
ParameterNode from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable DynamicInstance from Dynamic;
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Creates an empty instance of this class.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : any Parameter from Dynamic)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Adds <aparameter> to the sequence of parameters of
|
|
||||||
-- <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aninstance : mutable DynamicInstance from Dynamic)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Adds all the parameters of <me>, to the sequence of
|
|
||||||
-- parameters of <aninstance>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aparameter : CString from Standard; avalue : Integer from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Puts the integer value <avalue> into the parameter
|
|
||||||
-- object identified by the string <aparameter>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aparameter : CString from Standard ; avalue : Real from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Puts the real value <avalue> into the parameter
|
|
||||||
-- object identified by the string <aparameter>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aparameter : CString from Standard; avalue : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Puts the string <avalue> into the parameter
|
|
||||||
-- object identified by the string <aparameter>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aparameter : CString from Standard; avalue : any DynamicInstance from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Puts the dynamic instance <avalue> into the parameter
|
|
||||||
-- object identified by the string <aparameter>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aparameter : CString from Standard) returns any Parameter from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Searches and returns the parameter object identified
|
|
||||||
-- by the string <aparameter>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Class(me : mutable ; aclass : any DynamicClass from Dynamic)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Sets the reference of the class.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Execute(me ; amethod : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Calls the method identified by the string <amethod>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thedynamicclass : DynamicClass from Dynamic;
|
|
||||||
thefirstparameternode : ParameterNode from Dynamic;
|
|
||||||
|
|
||||||
end ;
|
|
@ -1,181 +0,0 @@
|
|||||||
// Created on: 1993-01-22
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_DynamicInstance.ixx>
|
|
||||||
#include <Dynamic_Parameter.hxx>
|
|
||||||
#include <Dynamic_IntegerParameter.hxx>
|
|
||||||
#include <Dynamic_RealParameter.hxx>
|
|
||||||
#include <Dynamic_StringParameter.hxx>
|
|
||||||
#include <Dynamic_InstanceParameter.hxx>
|
|
||||||
#include <Dynamic_Method.hxx>
|
|
||||||
#include <Dynamic_CompiledMethod.hxx>
|
|
||||||
#include <Dynamic_InterpretedMethod.hxx>
|
|
||||||
#include <Dynamic_SequenceOfMethods.hxx>
|
|
||||||
#include <Standard_CString.hxx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_DynamicInstance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_DynamicInstance::Dynamic_DynamicInstance()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Parameter
|
|
||||||
(const Handle(Dynamic_DynamicInstance)& aninstance) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
aninstance->Parameter(parameternode->Object());
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Parameter(const Handle(Dynamic_Parameter)& aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode = new Dynamic_ParameterNode(aparameter);
|
|
||||||
parameternode->Next(thefirstparameternode);
|
|
||||||
thefirstparameternode = parameternode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Integer avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_IntegerParameter) parameter =
|
|
||||||
Handle(Dynamic_IntegerParameter)::DownCast(Parameter(aparameter));
|
|
||||||
parameter->Value(avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Real avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_RealParameter) parameter =
|
|
||||||
Handle(Dynamic_RealParameter)::DownCast(Parameter(aparameter));
|
|
||||||
parameter->Value(avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_CString avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_StringParameter) parameter =
|
|
||||||
Handle(Dynamic_StringParameter)::DownCast(Parameter(aparameter));
|
|
||||||
parameter->Value(avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Parameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Handle(Dynamic_DynamicInstance)& avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_InstanceParameter) parameter =
|
|
||||||
Handle(Dynamic_InstanceParameter)::DownCast(Parameter(aparameter));
|
|
||||||
parameter->Value(avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Parameter) Dynamic_DynamicInstance::Parameter
|
|
||||||
(const Standard_CString aparameter) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
TCollection_AsciiString aStr(aparameter);
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aStr) return parameter;
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
return parameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Class
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Class(const Handle(Dynamic_DynamicClass)& aclass)
|
|
||||||
{
|
|
||||||
thedynamicclass = aclass;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Execute
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
//extern source(Standard_Integer argc, char** argv);
|
|
||||||
|
|
||||||
void Dynamic_DynamicInstance::Execute(const Standard_CString amethod) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Method) method = thedynamicclass->Method(amethod);
|
|
||||||
|
|
||||||
if(method->IsKind(STANDARD_TYPE(Dynamic_CompiledMethod)))
|
|
||||||
{
|
|
||||||
Handle(Dynamic_DynamicInstance) me(this) ;
|
|
||||||
Handle(Dynamic_CompiledMethod) method_1 = Handle(Dynamic_CompiledMethod)::DownCast(method);
|
|
||||||
typedef void (*function)(const Handle(Dynamic_DynamicInstance)&);
|
|
||||||
|
|
||||||
// ((function)((*(Handle(Dynamic_CompiledMethod)*)&method)->Function().ToCString()))(me);
|
|
||||||
((function)(method_1->Function().ToCString()))(me);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Standard_Integer argc = 2;
|
|
||||||
char* argv[2];
|
|
||||||
argv[0] = "source";
|
|
||||||
argv[1] = (*(Handle(Dynamic_InterpretedMethod)*)&method)->Function();
|
|
||||||
source(argc,argv);*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,212 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class FuzzyClass from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose: This class is the root class to dynamically define
|
|
||||||
-- objects of a given type but with various
|
|
||||||
-- definitions. This root class contains a parameter
|
|
||||||
-- list which describes in the definition context all
|
|
||||||
-- the useful information and in the instance context
|
|
||||||
-- only the redefined values. This class is deferred
|
|
||||||
-- because no instance has to be created.
|
|
||||||
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
Real from Standard,
|
|
||||||
Boolean from Standard,
|
|
||||||
OStream from Standard,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
ParameterNode from Dynamic,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize;
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Creates a FuzzyClass.
|
|
||||||
|
|
||||||
Type(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: This deferred method must returns the type of the
|
|
||||||
-- object. If the instance is of the type FuzzyDefinition
|
|
||||||
-- the method simply returns the field <thetype>. If the
|
|
||||||
-- instance is of the type FuzzyInstance the method calls
|
|
||||||
-- the Type method on the true definition.
|
|
||||||
|
|
||||||
is deferred;
|
|
||||||
|
|
||||||
FirstParameter(me) returns ParameterNode from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the head of the list of parameters. For the
|
|
||||||
-- FuzzyDefinition class this method returns the head of
|
|
||||||
-- the exaustive list of parameters defining the object
|
|
||||||
-- and for the FuzzyInstance it just returns the head of
|
|
||||||
-- the overloaded values.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me ; aparameter : CString from Standard) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns true if there is a parameter with <aparameter>
|
|
||||||
-- as name, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : any Parameter from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds another parameter <aparameter> to the sequence of
|
|
||||||
-- parameters.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; avalue : Boolean from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the boolean value <avalue>.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; avalue : Integer from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the integer value <avalue>.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; avalue : Real from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the real value <avalue>.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; astring : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the string <astring>.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; anobject : any Transient)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the object value <anobject>.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard;
|
|
||||||
avalue : out Boolean from Standard) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding boolean value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard;
|
|
||||||
avalue : out Integer from Standard)
|
|
||||||
returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding integer value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard;
|
|
||||||
avalue : out Real)
|
|
||||||
returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding real value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard; avalue : out AsciiString from TCollection)
|
|
||||||
returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding string in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard; avalue : out any Transient)
|
|
||||||
returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding object value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefirstparameternode : ParameterNode from Dynamic;
|
|
||||||
|
|
||||||
end FuzzyClass;
|
|
@ -1,360 +0,0 @@
|
|||||||
// Created on: 1993-01-22
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_FuzzyClass.ixx>
|
|
||||||
#include <Dynamic_Parameter.hxx>
|
|
||||||
#include <Dynamic_BooleanParameter.hxx>
|
|
||||||
#include <Dynamic_IntegerParameter.hxx>
|
|
||||||
#include <Dynamic_RealParameter.hxx>
|
|
||||||
#include <Dynamic_StringParameter.hxx>
|
|
||||||
#include <Dynamic_ObjectParameter.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_FuzzyClass
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_FuzzyClass::Dynamic_FuzzyClass()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FirstParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_ParameterNode) Dynamic_FuzzyClass::FirstParameter() const
|
|
||||||
{
|
|
||||||
return thefirstparameternode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyClass::Parameter(const Standard_CString aparameter) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_ParameterNode) definition = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!definition.IsNull())
|
|
||||||
{
|
|
||||||
parameter = definition->Object();
|
|
||||||
if(parameter->Name() == aparameter) return Standard_True;
|
|
||||||
definition = definition->Next();
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyClass::Parameter(const Handle(Dynamic_Parameter)& aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode = new Dynamic_ParameterNode(aparameter);
|
|
||||||
parameternode->Next(thefirstparameternode);
|
|
||||||
thefirstparameternode = parameternode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyClass::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Boolean avalue)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_BooleanParameter) booleanparameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_BooleanParameter)::DownCast(parameter)->Value(avalue);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
booleanparameter = new Dynamic_BooleanParameter(aparameter,avalue);
|
|
||||||
Parameter(booleanparameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyClass::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Integer avalue)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_IntegerParameter) integerparameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_IntegerParameter)::DownCast(parameter)->Value(avalue);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
integerparameter = new Dynamic_IntegerParameter(aparameter,avalue);
|
|
||||||
Parameter(integerparameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyClass::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Real avalue)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_RealParameter) realparameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_RealParameter)::DownCast(parameter)->Value(avalue);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
realparameter = new Dynamic_RealParameter(aparameter,avalue);
|
|
||||||
Parameter(realparameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyClass::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_CString astring)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_StringParameter) stringparameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_StringParameter)::DownCast(parameter)->Value(astring);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
stringparameter = new Dynamic_StringParameter(aparameter,astring);
|
|
||||||
Parameter(stringparameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyClass::Parameter(const Standard_CString aparameter,
|
|
||||||
const Handle(Standard_Transient)& anobject)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
Handle(Dynamic_ObjectParameter) objectparameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ObjectParameter)::DownCast(parameter)->Value(anobject);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
objectparameter = new Dynamic_ObjectParameter(aparameter,anobject);
|
|
||||||
Parameter(objectparameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyClass::Value(const Standard_CString aparameter,
|
|
||||||
Standard_Boolean& avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
avalue = (*(Handle(Dynamic_BooleanParameter)*)¶meter)->Value();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyClass::Value(const Standard_CString aparameter,
|
|
||||||
Standard_Integer& avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
avalue = (*(Handle(Dynamic_IntegerParameter)*)¶meter)->Value();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyClass::Value(const Standard_CString aparameter,
|
|
||||||
Standard_Real& avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
avalue = (*(Handle(Dynamic_RealParameter)*)¶meter)->Value();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyClass::Value(const Standard_CString aparameter,
|
|
||||||
TCollection_AsciiString& avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
avalue = (*(Handle(Dynamic_StringParameter)*)¶meter)->Value();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyClass::Value(const Standard_CString aparameter,
|
|
||||||
Handle(Standard_Transient)& anobject) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
parameternode = thefirstparameternode;
|
|
||||||
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
parameter = parameternode->Object();
|
|
||||||
if(parameter->Name() == aparameter)
|
|
||||||
{
|
|
||||||
anobject = (*(Handle(Dynamic_ObjectParameter)*)¶meter)->Value();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
//void Dynamic_FuzzyClass::Dump(Standard_OStream& astream) const
|
|
||||||
void Dynamic_FuzzyClass::Dump(Standard_OStream& ) const
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class FuzzyDefinition from Dynamic
|
|
||||||
inherits
|
|
||||||
|
|
||||||
FuzzyClass from Dynamic
|
|
||||||
|
|
||||||
---Purpose: It is the class useful for setting a particular
|
|
||||||
-- definition of an object. This definition is
|
|
||||||
-- caracterized by a collection of parameters. Each
|
|
||||||
-- parameter is identified by its name, the type of
|
|
||||||
-- its referenced value and if necessary a default
|
|
||||||
-- value.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aname : CString from Standard) returns mutable FuzzyDefinition from Dynamic;
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates a FuzzyDefinition with <aname> as type.
|
|
||||||
|
|
||||||
Type(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the type of object.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thename : HAsciiString from TCollection;
|
|
||||||
|
|
||||||
end FuzzyDefinition;
|
|
@ -1,48 +0,0 @@
|
|||||||
// Created on: 1993-01-22
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_FuzzyDefinition.ixx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_FuzzyDefinition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_FuzzyDefinition::Dynamic_FuzzyDefinition(const Standard_CString aname)
|
|
||||||
{
|
|
||||||
thename = new TCollection_HAsciiString(aname);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Type
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TCollection_AsciiString Dynamic_FuzzyDefinition::Type() const
|
|
||||||
{
|
|
||||||
return thename->String();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
//void Dynamic_FuzzyDefinition::Dump(Standard_OStream& astream) const
|
|
||||||
void Dynamic_FuzzyDefinition::Dump(Standard_OStream& ) const
|
|
||||||
{}
|
|
@ -1,128 +0,0 @@
|
|||||||
-- Created on: 1992-06-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class FuzzyDefinitionsDictionary from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose: This class groups in a dictionary all of the
|
|
||||||
-- various definitions of an object. It also allows
|
|
||||||
-- the sharing of the same definition by more than
|
|
||||||
-- one FuzzyInstance to preserve a global coherence
|
|
||||||
-- and also to manage the memory. To use this class
|
|
||||||
-- an inheritance is necessary with perhaps the
|
|
||||||
-- overload of the Switch method if the parameter
|
|
||||||
-- types are not of the type BooleanParameter,
|
|
||||||
-- IntegerParameter, RealParameter and
|
|
||||||
-- StringParameter.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
Boolean from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
SequenceOfFuzzyDefinitions from Dynamic,
|
|
||||||
FuzzyClass from Dynamic
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize;
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Deferred constructor of the class.
|
|
||||||
|
|
||||||
Creates(me : mutable ; afilename : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Starting with a file named <afilename>, fills the
|
|
||||||
-- dictionary with all the wishes definitions.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Switch(me ; aname , atype , avalue : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: This virtual method allows the user to add recognition
|
|
||||||
-- of its own parameters when reading the file to fill
|
|
||||||
-- the dictionary.
|
|
||||||
|
|
||||||
returns Parameter from Dynamic
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
Definition(me ; atype : CString from Standard
|
|
||||||
; adefinition : out FuzzyClass from Dynamic) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns from the dictionary in the out variable
|
|
||||||
-- <adefinition> a reference to the right instance of the
|
|
||||||
-- definition identified by its type <atype>. The method
|
|
||||||
-- returns true if the definition exist, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
UpToDate(me) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns true if there has been no modification of the
|
|
||||||
-- file fuzzyclasses.dat since the creation of the
|
|
||||||
-- dictionary object, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
NumberOfDefinitions(me) returns Integer from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the number of definitions stored in the
|
|
||||||
-- dictionary.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Definition(me ; anindex : Integer from Standard) returns any FuzzyClass from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns a reference on the definition identified by
|
|
||||||
-- the index <anidex>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefilename : HAsciiString from TCollection;
|
|
||||||
thetime : Time from Standard;
|
|
||||||
thesequenceoffuzzydefinitions : SequenceOfFuzzyDefinitions from Dynamic;
|
|
||||||
|
|
||||||
end FuzzyDefinitionsDictionary;
|
|
@ -1,266 +0,0 @@
|
|||||||
// Created on: 1992-06-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// CRD : 03/07/97 : Porting Windows NT.
|
|
||||||
|
|
||||||
#include <Standard_Stream.hxx>
|
|
||||||
|
|
||||||
#include <Dynamic_FuzzyDefinitionsDictionary.ixx>
|
|
||||||
#include <Dynamic_FuzzyDefinition.hxx>
|
|
||||||
#include <Dynamic_BooleanParameter.hxx>
|
|
||||||
#include <Dynamic_IntegerParameter.hxx>
|
|
||||||
#include <Dynamic_RealParameter.hxx>
|
|
||||||
#include <Dynamic_StringParameter.hxx>
|
|
||||||
#include <Dynamic_ObjectParameter.hxx>
|
|
||||||
#include <Dynamic_InstanceParameter.hxx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
# include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (HAVE_SYS_STAT_H) || defined (WNT)
|
|
||||||
# include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WNT
|
|
||||||
//#define strcasecmp _stricoll
|
|
||||||
#define stat _stat
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_FuzzyDefinitionsDictionary
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_FuzzyDefinitionsDictionary::Dynamic_FuzzyDefinitionsDictionary()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Creates
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyDefinitionsDictionary::Creates(const Standard_CString afilename)
|
|
||||||
{
|
|
||||||
Standard_Integer fr,i,begin,end,endline;
|
|
||||||
char line[256];
|
|
||||||
char name[81];
|
|
||||||
char type[81];
|
|
||||||
char value[81],value1[81],value2[81],value3[81];
|
|
||||||
Handle(Dynamic_FuzzyDefinition) fuzzydefinition;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
ifstream file(afilename);
|
|
||||||
if(!file)
|
|
||||||
{
|
|
||||||
cout<<"unable to open "<<afilename<<" for input"<<endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thefilename = new TCollection_HAsciiString(afilename);
|
|
||||||
|
|
||||||
if(!stat(afilename,&buf)) thetime = buf.st_ctime;
|
|
||||||
|
|
||||||
thesequenceoffuzzydefinitions = new Dynamic_SequenceOfFuzzyDefinitions();
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
memset(line,0,sizeof(line));
|
|
||||||
|
|
||||||
file.getline(line,255);
|
|
||||||
if(!file)break;
|
|
||||||
|
|
||||||
i = 254;
|
|
||||||
while( i >= 0 && ( line[i] == ' ' || !line[i]))line[i--] = 0;
|
|
||||||
fr = i+1;
|
|
||||||
if(fr <= 1)continue;
|
|
||||||
|
|
||||||
if(line[0] != ' ')
|
|
||||||
{
|
|
||||||
fuzzydefinition = new Dynamic_FuzzyDefinition(line);
|
|
||||||
thesequenceoffuzzydefinitions->Append(fuzzydefinition);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
begin = end = 0;
|
|
||||||
for(i=0; i<fr; i++)
|
|
||||||
{
|
|
||||||
if(line[i] == '"')
|
|
||||||
{
|
|
||||||
if(begin)
|
|
||||||
{
|
|
||||||
end = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
begin = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(name,0,sizeof(name));
|
|
||||||
|
|
||||||
endline = 0;
|
|
||||||
for(i=begin+1; i<=end-1; i++)name[endline++] = line[i];
|
|
||||||
|
|
||||||
memset(type,0,sizeof(type));
|
|
||||||
memset(value,0,sizeof(value));
|
|
||||||
memset(value1,0,sizeof(value1));
|
|
||||||
memset(value2,0,sizeof(value2));
|
|
||||||
memset(value3,0,sizeof(value3));
|
|
||||||
|
|
||||||
fr = sscanf(&line[end+1],"%80s%80c",type,value);
|
|
||||||
if(fr == -1) continue;
|
|
||||||
|
|
||||||
begin = 0;
|
|
||||||
for(i=0; i<80; i++)
|
|
||||||
{
|
|
||||||
if(value[i] != ' ')
|
|
||||||
{
|
|
||||||
begin = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(i=begin; i<80; i++) value[i-begin] = value[i];
|
|
||||||
for(i=80-begin; i<80; i++) value[i] = 0;
|
|
||||||
|
|
||||||
if (!strcasecmp(type,"Standard_Boolean"))
|
|
||||||
fuzzydefinition->Parameter(new Dynamic_BooleanParameter(name,value));
|
|
||||||
|
|
||||||
else if(!strcasecmp(type,"Standard_Integer"))
|
|
||||||
fuzzydefinition->Parameter(new Dynamic_IntegerParameter(name,atoi(value)));
|
|
||||||
|
|
||||||
else if(!strcasecmp(type,"Standard_Real"))
|
|
||||||
fuzzydefinition->Parameter(new Dynamic_RealParameter(name,Atof(value)));
|
|
||||||
|
|
||||||
else if(!strcasecmp(type,"Standard_CString"))
|
|
||||||
fuzzydefinition->Parameter(new Dynamic_StringParameter(name,value));
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parameter = Switch(name,type,value);
|
|
||||||
if(!parameter.IsNull())fuzzydefinition->Parameter(parameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Definition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyDefinitionsDictionary::Definition
|
|
||||||
(const Standard_CString atype,
|
|
||||||
Handle(Dynamic_FuzzyClass)& adefinition) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_FuzzyClass) definition;
|
|
||||||
|
|
||||||
for(Standard_Integer index=1; index<=thesequenceoffuzzydefinitions->Length(); index++)
|
|
||||||
{
|
|
||||||
definition = thesequenceoffuzzydefinitions->Value(index);
|
|
||||||
if(definition->Type() == atype)
|
|
||||||
{
|
|
||||||
adefinition = definition;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Switch
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Parameter) Dynamic_FuzzyDefinitionsDictionary::Switch(
|
|
||||||
const Standard_CString aname,
|
|
||||||
const Standard_CString atype,
|
|
||||||
const Standard_CString avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ObjectParameter) objectparameter;
|
|
||||||
cout<<"Parameter "<<aname<<" of type "<<atype<<" with "<<avalue<<" does not exist."<<endl;
|
|
||||||
return objectparameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : UpToDate
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyDefinitionsDictionary::UpToDate() const
|
|
||||||
{
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
TCollection_AsciiString string = thefilename->String();
|
|
||||||
if(!stat(string.ToCString(),&buf))
|
|
||||||
{
|
|
||||||
if(thetime == buf.st_ctime) return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NumberOfDefinitions
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer Dynamic_FuzzyDefinitionsDictionary::NumberOfDefinitions() const
|
|
||||||
{
|
|
||||||
return thesequenceoffuzzydefinitions->Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Definition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_FuzzyClass) Dynamic_FuzzyDefinitionsDictionary::Definition
|
|
||||||
(const Standard_Integer anindex) const
|
|
||||||
{
|
|
||||||
return thesequenceoffuzzydefinitions->Value(anindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyDefinitionsDictionary::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
astream<<" DICTIONARY : /n";
|
|
||||||
for(index=1;index<=thesequenceoffuzzydefinitions->Length();index++)
|
|
||||||
thesequenceoffuzzydefinitions->Value(index)->Dump(astream);
|
|
||||||
}
|
|
@ -1,119 +0,0 @@
|
|||||||
-- Created on: 1993-12-23
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class FuzzyInstance from Dynamic (Dictionary as Transient)
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
FuzzyClass from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class describes the facilities available to
|
|
||||||
-- manipulate fuzzy objects. It is a generic class
|
|
||||||
-- because the creation of a FuzzyInstance requests a
|
|
||||||
-- specific dictionary of definitions.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
Real from Standard,
|
|
||||||
Boolean from Standard,
|
|
||||||
OStream from Standard,
|
|
||||||
FuzzyDefinition from Dynamic,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(atype : CString from Standard) returns mutable FuzzyInstance from Dynamic;
|
|
||||||
--- Purpose: Creates a FuzzyInstance object of the type
|
|
||||||
-- <atype>. If <atype> is not defined in the dictionary, the
|
|
||||||
-- object created will have no definition.
|
|
||||||
|
|
||||||
Create(afuzzyinstance : FuzzyInstance from Dynamic) returns mutable FuzzyInstance from Dynamic;
|
|
||||||
--- Purpose: Creates a FuzzyInstance with as definition the fuzzy
|
|
||||||
-- instance <afuzzyinstance>.
|
|
||||||
|
|
||||||
Type(me) returns AsciiString from TCollection is redefined;
|
|
||||||
---Purpose: Returns the type of object read in the definition.
|
|
||||||
|
|
||||||
Definition(me) returns FuzzyClass from Dynamic is static;
|
|
||||||
---Purpose: Returns a reference to the definition of the
|
|
||||||
-- FuzzyInstance.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; avalue : Boolean from Standard) is redefined;
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the boolean value <avalue>.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; avalue : Integer from Standard) is redefined;
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the integer value <avalue>.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard ; avalue : Real from Standard) is redefined;
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the real value <avalue>.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard; astring : CString from Standard) is redefined;
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the string <astring>.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : CString from Standard ; anobject : any Transient) is redefined;
|
|
||||||
---Purpose: Adds to the instance <me> the parameter <aparameter>
|
|
||||||
-- with the object value <anobject>.
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard ; avalue : out Boolean from Standard)
|
|
||||||
returns Boolean from Standard is redefined;
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding boolean value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard ; avalue : out Integer from Standard)
|
|
||||||
returns Boolean from Standard is redefined;
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding integer value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard ; avalue : out Real from Standard)
|
|
||||||
returns Boolean from Standard is redefined;
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding real value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard ; avalue : out AsciiString from TCollection)
|
|
||||||
returns Boolean from Standard is redefined;
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding string in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
Value(me ; aparameter : CString from Standard ; avalue : out any Transient)
|
|
||||||
returns Boolean from Standard is redefined;
|
|
||||||
---Purpose: Returns True, if there is a parameter <aparameter>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding object value in the output argument
|
|
||||||
-- <avalue>, False otherwise.
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard) is redefined;
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thedefinition : FuzzyClass from Dynamic;
|
|
||||||
|
|
||||||
end FuzzyInstance;
|
|
@ -1,241 +0,0 @@
|
|||||||
// Created on: 1993-12-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// CRD : 15/04/97 : Passage WOK++ : Remplacement de TYPE par STANDARD_TYPE
|
|
||||||
|
|
||||||
|
|
||||||
#include <Dynamic_FuzzyDefinition.hxx>
|
|
||||||
#include <Dynamic_SequenceOfFuzzyDefinitions.hxx>
|
|
||||||
#include <Dynamic_Parameter.hxx>
|
|
||||||
#include <Dynamic_ParameterNode.hxx>
|
|
||||||
#include <Dynamic_BooleanParameter.hxx>
|
|
||||||
#include <Dynamic_IntegerParameter.hxx>
|
|
||||||
#include <Dynamic_RealParameter.hxx>
|
|
||||||
#include <Dynamic_StringParameter.hxx>
|
|
||||||
#include <Dynamic_ObjectParameter.hxx>
|
|
||||||
|
|
||||||
void DictionaryOfDefinitions(Handle(Dictionary)&);
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_FuzzyInstance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_FuzzyInstance::Dynamic_FuzzyInstance(const Standard_CString atype)
|
|
||||||
{
|
|
||||||
Handle(Dictionary) dictionary;
|
|
||||||
DictionaryOfDefinitions(dictionary);
|
|
||||||
|
|
||||||
if(dictionary->Definition(atype,thedefinition)) return;
|
|
||||||
else cout<<atype<<" n'existe pas dans le dictionnaire."<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_FuzzyInstance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_FuzzyInstance::Dynamic_FuzzyInstance(const Handle(Dynamic_FuzzyInstance)& afuzzyinstance)
|
|
||||||
{
|
|
||||||
thedefinition = afuzzyinstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Type
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TCollection_AsciiString Dynamic_FuzzyInstance::Type() const
|
|
||||||
{
|
|
||||||
return Definition()->Type();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Definition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_FuzzyClass) Dynamic_FuzzyInstance::Definition() const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_FuzzyInstance) definition;
|
|
||||||
|
|
||||||
if(thedefinition->IsKind(STANDARD_TYPE(Dynamic_FuzzyDefinition)))
|
|
||||||
{
|
|
||||||
return thedefinition;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
definition = *(Handle(Dynamic_FuzzyInstance)*)&thedefinition;
|
|
||||||
return definition->Definition();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Boolean avalue)
|
|
||||||
{
|
|
||||||
if(Definition()->Parameter(aparameter))
|
|
||||||
Dynamic_FuzzyClass::Parameter(aparameter,avalue);
|
|
||||||
//else
|
|
||||||
// cout<<"Pas de parametre du nom de : "<< aparameter<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Integer avalue)
|
|
||||||
{
|
|
||||||
if(Definition()->Parameter(aparameter))
|
|
||||||
Dynamic_FuzzyClass::Parameter(aparameter,avalue);
|
|
||||||
//else
|
|
||||||
// cout<<"Pas de parametre du nom de : "<< aparameter<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_Real avalue)
|
|
||||||
{
|
|
||||||
if(Definition()->Parameter(aparameter))
|
|
||||||
Dynamic_FuzzyClass::Parameter(aparameter,avalue);
|
|
||||||
//else
|
|
||||||
//cout<<"Pas de parametre du nom de : "<< aparameter<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Standard_CString astring)
|
|
||||||
{
|
|
||||||
if(Definition()->Parameter(aparameter))
|
|
||||||
Dynamic_FuzzyClass::Parameter(aparameter,astring);
|
|
||||||
//else
|
|
||||||
// cout<<"Pas de parametre du nom de : "<< aparameter<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyInstance::Parameter(const Standard_CString aparameter,
|
|
||||||
const Handle(Standard_Transient)& anobject)
|
|
||||||
{
|
|
||||||
if(Definition()->Parameter(aparameter))
|
|
||||||
Dynamic_FuzzyClass::Parameter(aparameter,anobject);
|
|
||||||
//else
|
|
||||||
//cout<<"Pas de parametre du nom de : "<< aparameter<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyInstance::Value(const Standard_CString aparameter,
|
|
||||||
Standard_Boolean& avalue) const
|
|
||||||
{
|
|
||||||
if(Dynamic_FuzzyClass::Value(aparameter,avalue))
|
|
||||||
return Standard_True;
|
|
||||||
else
|
|
||||||
return thedefinition->Value(aparameter,avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyInstance::Value(const Standard_CString aparameter,
|
|
||||||
Standard_Integer& avalue) const
|
|
||||||
{
|
|
||||||
if(Dynamic_FuzzyClass::Value(aparameter,avalue))
|
|
||||||
return Standard_True;
|
|
||||||
else
|
|
||||||
return thedefinition->Value(aparameter,avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyInstance::Value(const Standard_CString aparameter,
|
|
||||||
Standard_Real& avalue) const
|
|
||||||
{
|
|
||||||
if(Dynamic_FuzzyClass::Value(aparameter,avalue))
|
|
||||||
return Standard_True;
|
|
||||||
else
|
|
||||||
return thedefinition->Value(aparameter,avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyInstance::Value(const Standard_CString aparameter,
|
|
||||||
TCollection_AsciiString& avalue) const
|
|
||||||
{
|
|
||||||
if(Dynamic_FuzzyClass::Value(aparameter,avalue))
|
|
||||||
return Standard_True;
|
|
||||||
else
|
|
||||||
return thedefinition->Value(aparameter,avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_FuzzyInstance::Value(const Standard_CString aparameter,
|
|
||||||
Handle(Standard_Transient)& anobject) const
|
|
||||||
{
|
|
||||||
if(Dynamic_FuzzyClass::Value(aparameter,anobject))
|
|
||||||
return Standard_True;
|
|
||||||
else
|
|
||||||
return thedefinition->Value(aparameter,anobject);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_FuzzyInstance::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ParameterNode) parameternode = FirstParameter();
|
|
||||||
while(!parameternode.IsNull())
|
|
||||||
{
|
|
||||||
astream<<" ";
|
|
||||||
parameternode->Object()->Dump(astream);
|
|
||||||
astream<<"\n";
|
|
||||||
parameternode = parameternode->Next();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
-- Created on: 1993-02-03
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class InstanceParameter from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Parameter from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class describes a parameter with a dynamic
|
|
||||||
-- fuzzy instance as value.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
OStream from Standard,
|
|
||||||
DynamicInstance from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates an InstanceParameter with <aparameter> as
|
|
||||||
-- identifier.
|
|
||||||
|
|
||||||
returns mutable InstanceParameter from Dynamic;
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard; avalue : DynamicInstance from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates an InstanceParameter with <aparameter> as
|
|
||||||
-- identifier and <avalue> as initial value.
|
|
||||||
|
|
||||||
returns mutable InstanceParameter from Dynamic;
|
|
||||||
|
|
||||||
Value(me) returns DynamicInstance from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns <thevalue>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value(me : mutable ; avalue : DynamicInstance from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Sets <avalue> to <thevalue>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thevalue : DynamicInstance from Dynamic;
|
|
||||||
|
|
||||||
end InstanceParameter;
|
|
@ -1,70 +0,0 @@
|
|||||||
// Created on: 1993-02-03
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_InstanceParameter.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_InstanceParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_InstanceParameter::Dynamic_InstanceParameter
|
|
||||||
(const Standard_CString aparameter) : Dynamic_Parameter(aparameter)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_InstanceParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_InstanceParameter::Dynamic_InstanceParameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Handle(Dynamic_DynamicInstance)& avalue)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_DynamicInstance) Dynamic_InstanceParameter::Value() const
|
|
||||||
{
|
|
||||||
return thevalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_InstanceParameter::Value
|
|
||||||
(const Handle(Dynamic_DynamicInstance)& avalue)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_InstanceParameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Dynamic_Parameter::Dump(astream);
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
-- Created on: 1993-02-03
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class IntegerParameter from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Parameter from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class describes a parameter with an integer
|
|
||||||
-- as its value.
|
|
||||||
|
|
||||||
uses
|
|
||||||
CString from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
OStream from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates an IntegerParameter with <aparameter> as
|
|
||||||
-- identifier.
|
|
||||||
|
|
||||||
returns mutable IntegerParameter from Dynamic;
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard ; avalue : Integer from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates an IntegerParameter with <aparameter> as
|
|
||||||
-- identifier and <avalue> as initial value.
|
|
||||||
|
|
||||||
returns mutable IntegerParameter from Dynamic;
|
|
||||||
|
|
||||||
Value(me) returns Integer from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the integer value <thevalue>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value (me : mutable ; avalue : Integer from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
--- Purpose: Sets the field <thevalue> with the integer value <avalue>
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thevalue : Integer from Standard;
|
|
||||||
|
|
||||||
end IntegerParameter;
|
|
@ -1,71 +0,0 @@
|
|||||||
// Created on: 1993-02-03
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_IntegerParameter.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_IntegerParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_IntegerParameter::Dynamic_IntegerParameter
|
|
||||||
(const Standard_CString aparameter)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_IntegerParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_IntegerParameter::Dynamic_IntegerParameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Standard_Integer avalue)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer Dynamic_IntegerParameter::Value() const
|
|
||||||
{
|
|
||||||
return thevalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_IntegerParameter::Value(const Standard_Integer avalue)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_IntegerParameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Dynamic_Parameter::Dump(astream);
|
|
||||||
astream<<" "<<thevalue;
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
-- Created on: 1993-01-28
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class InterpretedMethod from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
MethodDefinition from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class derived from Method, describes an
|
|
||||||
-- interpreted method. The additional field is the
|
|
||||||
-- name of the file to be interpreted.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aname , afile : CString from Standard) returns mutable InterpretedMethod from Dynamic;
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates a new InterpretedMethod with <aname> as name
|
|
||||||
-- and <afile> as file name to be interpreted.
|
|
||||||
|
|
||||||
Function(me : mutable ; afile : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Sets the the name of the file to be interpreted to
|
|
||||||
-- <afile>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Function(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the name of the file to be interpreted.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefunction : HAsciiString from TCollection;
|
|
||||||
|
|
||||||
end InterpretedMethod;
|
|
@ -1,50 +0,0 @@
|
|||||||
// Created on: 1993-01-28
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_InterpretedMethod.ixx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_InterpretedMethod
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_InterpretedMethod::Dynamic_InterpretedMethod(const Standard_CString aname,
|
|
||||||
const Standard_CString afile)
|
|
||||||
: Dynamic_MethodDefinition(aname)
|
|
||||||
{
|
|
||||||
thefunction = new TCollection_HAsciiString(afile);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Function
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_InterpretedMethod::Function(const Standard_CString afile)
|
|
||||||
{
|
|
||||||
thefunction = new TCollection_HAsciiString(afile);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Function
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TCollection_AsciiString Dynamic_InterpretedMethod::Function() const
|
|
||||||
{
|
|
||||||
return thefunction->String();
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class Method from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose: This class is a root class available for the
|
|
||||||
-- definition of methods and also for using them
|
|
||||||
-- throughout method instances. The logical name of
|
|
||||||
-- the method and the signature as a collection of
|
|
||||||
-- variables is stored in it.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
Boolean from Standard,
|
|
||||||
OStream from Standard,
|
|
||||||
ModeEnum from Dynamic,
|
|
||||||
Variable from Dynamic,
|
|
||||||
VariableNode from Dynamic,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize;
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: It is the constructor of this deferred class
|
|
||||||
|
|
||||||
Type(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the type of object which is the name of the
|
|
||||||
-- function definition.
|
|
||||||
|
|
||||||
is deferred;
|
|
||||||
|
|
||||||
FirstVariableNode(me) returns VariableNode from Dynamic
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the first variable node of the Method which
|
|
||||||
-- contains a variable.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Variable(me ; avariable : CString from Standard) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns true if there is a variable with <avariable>
|
|
||||||
-- as name, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Variable(me : mutable ; avariable : Variable from Dynamic)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Adds another variable <avariable> to the sequence of
|
|
||||||
-- variable definitions.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value(me ; aname : CString from Standard
|
|
||||||
; aparameter : out any Parameter from Dynamic
|
|
||||||
; amode : out ModeEnum from Dynamic) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a variable <avariable>
|
|
||||||
-- previously stored in the instance <me> and there is
|
|
||||||
-- the corresponding parameter value in the output
|
|
||||||
-- argument <aparameter>, False otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value(me ; aname : CString from Standard
|
|
||||||
; avariable : out any Variable from Dynamic) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns True, if there is a variable named <aname>
|
|
||||||
-- previously stored in the instance of <me> and returns
|
|
||||||
-- the corresponding variable in the output argument
|
|
||||||
-- <avariable>, False otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefirstvariablenode : VariableNode from Dynamic;
|
|
||||||
|
|
||||||
end Method;
|
|
@ -1,140 +0,0 @@
|
|||||||
// Created on: 1993-01-22
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_Method.ixx>
|
|
||||||
#include <Dynamic_Variable.hxx>
|
|
||||||
#include <Dynamic_Parameter.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_Method
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_Method::Dynamic_Method()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FirstVariableNode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_VariableNode) Dynamic_Method::FirstVariableNode() const
|
|
||||||
{
|
|
||||||
return thefirstvariablenode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_Method::Variable(const Standard_CString avariable) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Variable) variable;
|
|
||||||
Handle(Dynamic_VariableNode) definition = thefirstvariablenode;
|
|
||||||
|
|
||||||
while(!definition.IsNull())
|
|
||||||
{
|
|
||||||
variable = definition->Object();
|
|
||||||
if(variable->Parameter()->Name() == avariable) return Standard_True;
|
|
||||||
definition = definition->Next();
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Method::Variable(const Handle(Dynamic_Variable)& avariable)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_VariableNode) variablenode = new Dynamic_VariableNode(avariable);
|
|
||||||
if(!thefirstvariablenode.IsNull()) variablenode->Next(thefirstvariablenode);
|
|
||||||
thefirstvariablenode = variablenode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_Method::Value(const Standard_CString aname,
|
|
||||||
Handle(Dynamic_Parameter)& aparameter,
|
|
||||||
Dynamic_ModeEnum& amode) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Variable) variable;
|
|
||||||
|
|
||||||
if(Value(aname,variable))
|
|
||||||
{
|
|
||||||
amode = variable->Mode();
|
|
||||||
aparameter = variable->Parameter();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_Method::Value(const Standard_CString aname,
|
|
||||||
Handle(Dynamic_Variable)& avariable) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_VariableNode) variablenode;
|
|
||||||
Handle(Dynamic_Variable) variable;
|
|
||||||
|
|
||||||
variablenode = thefirstvariablenode;
|
|
||||||
|
|
||||||
while(!variablenode.IsNull())
|
|
||||||
{
|
|
||||||
variable = variablenode->Object();
|
|
||||||
if(variable->Parameter()->Name() == aname)
|
|
||||||
{
|
|
||||||
avariable = variable;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
variablenode = variablenode->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Method::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Variable) variable;
|
|
||||||
Handle(Dynamic_VariableNode) definition = thefirstvariablenode;
|
|
||||||
|
|
||||||
while(!definition.IsNull())
|
|
||||||
{
|
|
||||||
variable = definition->Object();
|
|
||||||
variable->Dump(astream);
|
|
||||||
astream<<" ; "<<endl;
|
|
||||||
definition = definition->Next();
|
|
||||||
}
|
|
||||||
astream<<endl;
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
-- Created on: 1993-01-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class MethodDefinition from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Method from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This inherited class is for describing the
|
|
||||||
-- definition of a method. This definition is
|
|
||||||
-- composed by its name which is readable by the type
|
|
||||||
-- function and a collection of variables which
|
|
||||||
-- defines the signature of the method definition in
|
|
||||||
-- term of arguments passed to the function and also
|
|
||||||
-- the useful internal or constant variables if the
|
|
||||||
-- function is a composite method. This class is also
|
|
||||||
-- a deferred class and can not be used directly
|
|
||||||
-- because it is necessary to specify if the method
|
|
||||||
-- is compiled, interpreted or composite.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
OStream from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
AsciiString from TCollection,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
ModeEnum from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize(aname : CString from Standard);
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Creates a MethodDefinition with <aname> as type.
|
|
||||||
|
|
||||||
Type(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the name of the method definition.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
AddVariable(me : mutable ; aparameter : Parameter from Dynamic ;
|
|
||||||
amode : ModeEnum from Dynamic ;
|
|
||||||
agroup : Boolean = Standard_False)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Adds a new variable created from the parameter
|
|
||||||
-- <aparameter>, which defines the name of the variable
|
|
||||||
-- its type and if necessary its default value, the mode
|
|
||||||
-- <amode> which precise if it is an in, out, inout,
|
|
||||||
-- internal or constant variable and the flag <agroup>
|
|
||||||
-- for accepting a set of homogeneous variables. with
|
|
||||||
-- the parameter value <aparameter>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thename : HAsciiString from TCollection;
|
|
||||||
|
|
||||||
end MethodDefinition;
|
|
@ -1,86 +0,0 @@
|
|||||||
// Created on: 1994-08-25
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_MethodDefinition.ixx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
#include <Dynamic_VariableNode.hxx>
|
|
||||||
#include <Dynamic_Variable.hxx>
|
|
||||||
#include <Dynamic_VariableGroup.hxx>
|
|
||||||
#include <Dynamic_Parameter.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_MethodDefinition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_MethodDefinition::Dynamic_MethodDefinition(const Standard_CString aname)
|
|
||||||
{
|
|
||||||
thename = new TCollection_HAsciiString(aname);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Type
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TCollection_AsciiString Dynamic_MethodDefinition::Type() const
|
|
||||||
{
|
|
||||||
return thename->String();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddVariable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_MethodDefinition::AddVariable(const Handle(Dynamic_Parameter)& aparameter,
|
|
||||||
const Dynamic_ModeEnum amode,
|
|
||||||
const Standard_Boolean agroup)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_VariableNode) variablenode;
|
|
||||||
Handle(Dynamic_Variable) variable;
|
|
||||||
|
|
||||||
variablenode = FirstVariableNode();
|
|
||||||
while(!variablenode.IsNull())
|
|
||||||
{
|
|
||||||
variable = variablenode->Object();
|
|
||||||
if(variable->Parameter()->Name() == aparameter->Name())
|
|
||||||
{
|
|
||||||
variable->Mode(amode);
|
|
||||||
variable->Parameter(aparameter);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
variablenode = variablenode->Next();
|
|
||||||
}
|
|
||||||
if(agroup) variable = new Dynamic_VariableGroup();
|
|
||||||
else variable = new Dynamic_Variable();
|
|
||||||
variable->Mode(amode);
|
|
||||||
variable->Parameter(aparameter);
|
|
||||||
Dynamic_Method::Variable(variable);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_MethodDefinition::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
TCollection_AsciiString string = thename->String();
|
|
||||||
astream<<"Method Definition : "<<string<<endl;
|
|
||||||
Dynamic_Method::Dump(astream);
|
|
||||||
}
|
|
@ -1,136 +0,0 @@
|
|||||||
-- Created on: 1992-06-22
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class MethodDefinitionsDictionary from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Transient
|
|
||||||
|
|
||||||
---Purpose: This class groups in a dictionary of all the
|
|
||||||
-- various definitions of methods. It also allows the
|
|
||||||
-- share of the same definition by more than one
|
|
||||||
-- MethodInstance to preserve a global coherence and
|
|
||||||
-- also to manage the memory. To use this class an
|
|
||||||
-- inheritance is necessary with perhaps the overload
|
|
||||||
-- of the Switch method if the parameter types are
|
|
||||||
-- not of the type BooleanParameter,
|
|
||||||
-- IntegerParameter, RealParameter and
|
|
||||||
-- StringParameter.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
CString from Standard,
|
|
||||||
OStream from Standard,
|
|
||||||
Boolean from Standard,
|
|
||||||
Integer from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
SequenceOfMethodDefinitions from Dynamic,
|
|
||||||
Method from Dynamic
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize;
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Deferred constructor of the class.
|
|
||||||
|
|
||||||
Creates(me : mutable ; afilename : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Starting with a file named <afilename>, fills the
|
|
||||||
-- dictionary with all the wishes definitions.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Definition(me : mutable ; adefinition : Method from Dynamic) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: This method sets the new definition <adefinition> in
|
|
||||||
-- the dictionary. It returns true if the operation is
|
|
||||||
-- successful, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Switch(me ; aname , atype , avalue : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: This virtual method allows the user to add recognition
|
|
||||||
-- of its own parameters when reading the file to fill
|
|
||||||
-- the dictionary.
|
|
||||||
|
|
||||||
returns Parameter from Dynamic;
|
|
||||||
|
|
||||||
Definition(me ; atype : CString from Standard
|
|
||||||
; adefinition : out Method from Dynamic) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns from the dictionary in the out variable
|
|
||||||
-- <adefinition> a reference to the right instance of the
|
|
||||||
-- definition identified by its type <atype>. The method
|
|
||||||
-- returns true if the definition exist, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
UpToDate(me) returns Boolean from Standard
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns true if there has been no modification of the
|
|
||||||
-- file method-definitions.dat since the creation of the
|
|
||||||
-- dictionary object, false otherwise.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
NumberOfDefinitions(me) returns Integer from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the number of definitions stored in the
|
|
||||||
-- dictionary.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Definition(me ; anindex : Integer from Standard) returns any Method from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns a reference on the definition identified by
|
|
||||||
-- the index <anidex>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thefilename : HAsciiString from TCollection;
|
|
||||||
thetime : Time from Standard;
|
|
||||||
thesequenceofmethoddefinitions : SequenceOfMethodDefinitions from Dynamic;
|
|
||||||
|
|
||||||
end MethodDefinitionsDictionary;
|
|
@ -1,298 +0,0 @@
|
|||||||
// Created on: 1992-06-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// Historique :
|
|
||||||
// CRD : 15/04/97 : Passage WOK++ : Replace TYPE by STANDARD_TYPE
|
|
||||||
// CRD : 03/07/97 : Porting Windows NT.
|
|
||||||
|
|
||||||
#include <Standard_Stream.hxx>
|
|
||||||
|
|
||||||
#include <Dynamic_MethodDefinitionsDictionary.ixx>
|
|
||||||
#include <Dynamic.hxx>
|
|
||||||
#include <Dynamic_CompiledMethod.hxx>
|
|
||||||
#include <Dynamic_BooleanParameter.hxx>
|
|
||||||
#include <Dynamic_IntegerParameter.hxx>
|
|
||||||
#include <Dynamic_RealParameter.hxx>
|
|
||||||
#include <Dynamic_StringParameter.hxx>
|
|
||||||
#include <Dynamic_ObjectParameter.hxx>
|
|
||||||
#include <Dynamic_InstanceParameter.hxx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
# include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (HAVE_SYS_STAT_H) || defined (WNT)
|
|
||||||
# include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
#ifdef WNT
|
|
||||||
#define stat _stat
|
|
||||||
//#define strcasecmp _stricoll
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_MethodDefinitionsDictionary
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_MethodDefinitionsDictionary::Dynamic_MethodDefinitionsDictionary()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Creates
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_MethodDefinitionsDictionary::Creates(const Standard_CString afilename)
|
|
||||||
{
|
|
||||||
Standard_Boolean group;
|
|
||||||
Standard_Integer fr,i,begin,end,endline;
|
|
||||||
char line[256];
|
|
||||||
char name[81];
|
|
||||||
char mode[81];
|
|
||||||
char type[81];
|
|
||||||
char value[81],value1[81],value2[81],value3[81];
|
|
||||||
Handle(Dynamic_CompiledMethod) methoddefinition;
|
|
||||||
Handle(Dynamic_Parameter) parameter;
|
|
||||||
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
ifstream file(afilename);
|
|
||||||
if(!file)
|
|
||||||
{
|
|
||||||
cout<<"unable to open "<<afilename<<" for input"<<endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thefilename = new TCollection_HAsciiString(afilename);
|
|
||||||
|
|
||||||
if(!stat(afilename,&buf)) thetime = buf.st_ctime;
|
|
||||||
|
|
||||||
thesequenceofmethoddefinitions = new Dynamic_SequenceOfMethodDefinitions();
|
|
||||||
|
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
memset(line,0,sizeof(line));
|
|
||||||
|
|
||||||
file.getline(line,255);
|
|
||||||
if(!file)break;
|
|
||||||
|
|
||||||
i = 254;
|
|
||||||
while( i >= 0 && ( line[i] == ' ' || !line[i]))line[i--] = 0;
|
|
||||||
fr = i+1;
|
|
||||||
if(fr <= 1)continue;
|
|
||||||
|
|
||||||
if(line[0] != ' ')
|
|
||||||
{
|
|
||||||
methoddefinition = new Dynamic_CompiledMethod(line,line);
|
|
||||||
thesequenceofmethoddefinitions->Append(methoddefinition);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
begin = end = 0;
|
|
||||||
for(i=0; i<fr; i++)
|
|
||||||
{
|
|
||||||
if(line[i] == '"')
|
|
||||||
{
|
|
||||||
if(begin)
|
|
||||||
{
|
|
||||||
end = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
begin = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(name,0,sizeof(name));
|
|
||||||
|
|
||||||
endline = 0;
|
|
||||||
for(i=begin+1; i<=end-1; i++)name[endline++] = line[i];
|
|
||||||
|
|
||||||
memset(mode, 0x00,sizeof(mode));
|
|
||||||
memset(type, 0x00,sizeof(type));
|
|
||||||
memset(value, 0x00,sizeof(value));
|
|
||||||
memset(value1,0x00,sizeof(value1));
|
|
||||||
memset(value2,0x00,sizeof(value2));
|
|
||||||
memset(value3,0x00,sizeof(value3));
|
|
||||||
|
|
||||||
fr = sscanf(&line[end+1],"%80s%80s%80c",mode,type,value);
|
|
||||||
if(fr == -1) continue;
|
|
||||||
|
|
||||||
group = Standard_False;
|
|
||||||
if(type[0] == '[')
|
|
||||||
{
|
|
||||||
group = Standard_True;
|
|
||||||
for(i=1; i<80; i++)type[i-1] = type[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
begin = 0;
|
|
||||||
for(i=0; i<80; i++)
|
|
||||||
{
|
|
||||||
if(value[i] != ' ')
|
|
||||||
{
|
|
||||||
begin = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(i=begin; i<80; i++) value[i-begin] = value[i];
|
|
||||||
for(i=80-begin; i<80; i++) value[i] = 0;
|
|
||||||
|
|
||||||
if (!strcasecmp(type,"Standard_Boolean"))
|
|
||||||
methoddefinition->AddVariable(new Dynamic_BooleanParameter(name,value),Dynamic::Mode(mode),group);
|
|
||||||
|
|
||||||
else if(!strcasecmp(type,"Standard_Integer"))
|
|
||||||
methoddefinition->AddVariable(new Dynamic_IntegerParameter(name,atoi(value)),Dynamic::Mode(mode),group);
|
|
||||||
|
|
||||||
else if(!strcasecmp(type,"Standard_Real"))
|
|
||||||
methoddefinition->AddVariable(new Dynamic_RealParameter(name,Atof(value)),Dynamic::Mode(mode),group);
|
|
||||||
|
|
||||||
else if(!strcasecmp(type,"Standard_CString"))
|
|
||||||
methoddefinition->AddVariable(new Dynamic_StringParameter(name,value),Dynamic::Mode(mode),group);
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parameter = Switch(name,type,value);
|
|
||||||
if(!parameter.IsNull())methoddefinition->AddVariable(parameter,Dynamic::Mode(mode),group);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Definition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_MethodDefinitionsDictionary::Definition(const Handle(Dynamic_Method)& adefinition)
|
|
||||||
{
|
|
||||||
Handle(Dynamic_MethodDefinition) methoddefinition;
|
|
||||||
if(adefinition->IsKind(STANDARD_TYPE(Dynamic_MethodDefinition)))
|
|
||||||
{
|
|
||||||
methoddefinition = *(Handle(Dynamic_MethodDefinition)*)&adefinition;
|
|
||||||
thesequenceofmethoddefinitions->Append(methoddefinition);
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<<"the definition is not a method definition"<<endl;
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Definition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_MethodDefinitionsDictionary::Definition
|
|
||||||
(const Standard_CString atype,
|
|
||||||
Handle(Dynamic_Method)& adefinition) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_Method) definition;
|
|
||||||
|
|
||||||
for(Standard_Integer index=1; index<=thesequenceofmethoddefinitions->Length(); index++)
|
|
||||||
{
|
|
||||||
definition = thesequenceofmethoddefinitions->Value(index);
|
|
||||||
if(definition->Type() == atype)
|
|
||||||
{
|
|
||||||
adefinition = definition;
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Switch
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Parameter) Dynamic_MethodDefinitionsDictionary::Switch(
|
|
||||||
const Standard_CString aname,
|
|
||||||
const Standard_CString atype,
|
|
||||||
const Standard_CString avalue) const
|
|
||||||
{
|
|
||||||
Handle(Dynamic_ObjectParameter) objectparameter;
|
|
||||||
cout<<"Parameter "<<aname<<" of type "<<atype<<" with "<<avalue<<" does not exist."<<endl;
|
|
||||||
return objectparameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : UpToDate
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean Dynamic_MethodDefinitionsDictionary::UpToDate() const
|
|
||||||
{
|
|
||||||
struct stat buf;
|
|
||||||
|
|
||||||
TCollection_AsciiString string = thefilename->String();
|
|
||||||
if(!stat(string.ToCString(),&buf))
|
|
||||||
{
|
|
||||||
if(thetime == buf.st_ctime) return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NumberOfDefinitions
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer Dynamic_MethodDefinitionsDictionary::NumberOfDefinitions() const
|
|
||||||
{
|
|
||||||
return thesequenceofmethoddefinitions->Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Definition
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Method) Dynamic_MethodDefinitionsDictionary::Definition
|
|
||||||
(const Standard_Integer anindex) const
|
|
||||||
{
|
|
||||||
return thesequenceofmethoddefinitions->Value(anindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_MethodDefinitionsDictionary::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
astream<<" DICTIONARY : \n\n";
|
|
||||||
for(index=1;index<=thesequenceofmethoddefinitions->Length();index++)
|
|
||||||
thesequenceofmethoddefinitions->Value(index)->Dump(astream);
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
-- Created on: 1994-09-19
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class Node from Dynamic (Item as Transient)
|
|
||||||
|
|
||||||
---Purpose: This generic class is a light way to store a
|
|
||||||
-- persistent homogeneous collection of objects
|
|
||||||
-- inside another persistent object.
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable Node from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns an empty instance of this class.
|
|
||||||
|
|
||||||
Create(anitem : any Item) returns mutable Node from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns an instance of this class initialized with
|
|
||||||
-- <anitem> as object.
|
|
||||||
|
|
||||||
Object(me : mutable ; anitem : any Item)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Sets to <me> the object <anitem>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Object(me) returns any Item
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the object into <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Next(me : mutable ; anode : Node from Dynamic)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Links to <me> the node <anode>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Next(me) returns any Node from Dynamic
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the node linked to <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thenextnode : Node from Dynamic;
|
|
||||||
theitem : Item;
|
|
||||||
|
|
||||||
end Node;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
// Created on: 1994-09-19
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_Node
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_Node::Dynamic_Node()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_Node
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_Node::Dynamic_Node(const Handle(Item)& anitem)
|
|
||||||
{
|
|
||||||
theitem = anitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Object
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Node::Object(const Handle(Item)& anitem)
|
|
||||||
{
|
|
||||||
theitem = anitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Object
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Item) Dynamic_Node::Object() const
|
|
||||||
{
|
|
||||||
return theitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Node::Next(const Handle(Dynamic_Node)& anode)
|
|
||||||
{
|
|
||||||
thenextnode = anode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Node) Dynamic_Node::Next() const
|
|
||||||
{
|
|
||||||
return thenextnode;
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
-- Created on: 1993-12-24
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class ObjectParameter from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Parameter from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This inherited class from Parameter describes all
|
|
||||||
-- the parameters, which are characterized by an
|
|
||||||
-- object value.
|
|
||||||
|
|
||||||
|
|
||||||
uses
|
|
||||||
OStream from Standard,
|
|
||||||
CString from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard) returns mutable ObjectParameter from Dynamic;
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates an ObjectParameter with <aparameter> as name.
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard; anobject : any Transient)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: With the name of the Parameter <aparameter> and the
|
|
||||||
-- object <anobject>, creates an instance of
|
|
||||||
-- ObjectParameter.
|
|
||||||
|
|
||||||
returns mutable ObjectParameter from Dynamic;
|
|
||||||
|
|
||||||
Value(me) returns any Transient
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the value of the parameter which is an object.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value (me : mutable ; anobject : Transient)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
--- Purpose: Sets the object <anobject> in <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
theobject : Transient;
|
|
||||||
|
|
||||||
end ObjectParameter;
|
|
@ -1,70 +0,0 @@
|
|||||||
// Created on: 1993-12-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_ObjectParameter.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_ObjectParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_ObjectParameter::Dynamic_ObjectParameter
|
|
||||||
(const Standard_CString aparameter)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_ObjectParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_ObjectParameter::Dynamic_ObjectParameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Handle(Standard_Transient)& anobject)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
theobject = anobject;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Standard_Transient) Dynamic_ObjectParameter::Value() const
|
|
||||||
{
|
|
||||||
return theobject;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_ObjectParameter::Value(const Handle(Standard_Transient)& anobject)
|
|
||||||
{
|
|
||||||
theobject = anobject;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_ObjectParameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Dynamic_Parameter::Dump(astream);
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
-- Created on: 1993-01-28
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
deferred class Parameter from Dynamic
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: A parameter is defined as the association of a
|
|
||||||
-- name and a value. For easy use, inherited classes
|
|
||||||
-- have been created to manipulate values by their
|
|
||||||
-- C++ type. This class is the root class of all the
|
|
||||||
-- derived parameter classes. Only the identifier of
|
|
||||||
-- the parameter is stored in it. The associated
|
|
||||||
-- value is stored in the inherited classes where it
|
|
||||||
-- is more easy to overload the methods manipulating
|
|
||||||
-- the value. No instance of this class must be
|
|
||||||
-- created. It is for this reason that this class is
|
|
||||||
-- deferred.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Initialize(aname : CString from Standard) ;
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Initializer of this class taking in argument the name
|
|
||||||
-- of the parameter <aname>.
|
|
||||||
|
|
||||||
Name(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns in an AsciiString the name of the parameter.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is virtual;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
theparametername : HAsciiString from TCollection;
|
|
||||||
|
|
||||||
end Parameter;
|
|
@ -1,47 +0,0 @@
|
|||||||
// Created on: 1993-01-28
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_Parameter.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_Parameter::Dynamic_Parameter(const Standard_CString aname)
|
|
||||||
{
|
|
||||||
theparametername = new TCollection_HAsciiString(aname);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Name
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
TCollection_AsciiString Dynamic_Parameter::Name() const
|
|
||||||
{
|
|
||||||
return theparametername->String();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Parameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
TCollection_AsciiString string = theparametername->String();
|
|
||||||
astream << string.ToCString();
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
-- Created on: 1993-02-03
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class RealParameter from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Parameter from Dynamic
|
|
||||||
---Purpose: This inherited class from Parameter describes all
|
|
||||||
-- the parameters, which are characterized by a real
|
|
||||||
-- value.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
Real from Standard
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard )
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates a RealParameter with <aparameter> as name.
|
|
||||||
|
|
||||||
returns mutable RealParameter from Dynamic;
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard ; avalue : Real from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: With the name of the Parameter <aparameter> and the
|
|
||||||
-- real <avalue>, creates an instance of RealParameter.
|
|
||||||
|
|
||||||
returns mutable RealParameter from Dynamic;
|
|
||||||
|
|
||||||
Value(me) returns Real from Standard
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the value of the parameter which is a real.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value (me : mutable ; avalue : Real from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
--- Purpose: Sets the real <avalue> in <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thevalue : Real from Standard;
|
|
||||||
|
|
||||||
end RealParameter;
|
|
@ -1,72 +0,0 @@
|
|||||||
// Created on: 1993-02-03
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_RealParameter.ixx>
|
|
||||||
#include <TCollection_HAsciiString.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_RealParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_RealParameter::Dynamic_RealParameter
|
|
||||||
(const Standard_CString aparameter)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_RealParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_RealParameter::Dynamic_RealParameter
|
|
||||||
(const Standard_CString aparameter,
|
|
||||||
const Standard_Real avalue)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Real Dynamic_RealParameter::Value() const
|
|
||||||
{
|
|
||||||
return thevalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_RealParameter::Value(const Standard_Real avalue)
|
|
||||||
{
|
|
||||||
thevalue = avalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_RealParameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Dynamic_Parameter::Dump(astream);
|
|
||||||
astream<<" : "<<thevalue;
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
-- Created on: 1993-02-03
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class StringParameter from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Parameter from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: This inherited class from Parameter describes all
|
|
||||||
-- the parameters, which are characterized by a
|
|
||||||
-- string value.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
CString from Standard,
|
|
||||||
HAsciiString from TCollection,
|
|
||||||
AsciiString from TCollection
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard )
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Creates a StringParameter with <aparameter> as name.
|
|
||||||
|
|
||||||
returns mutable StringParameter from Dynamic;
|
|
||||||
|
|
||||||
Create(aparameter : CString from Standard ; astring : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: With the name of the Parameter <aparameter> and the
|
|
||||||
-- string <astring>, creates an instance of
|
|
||||||
-- StringParameter.
|
|
||||||
|
|
||||||
returns mutable StringParameter from Dynamic;
|
|
||||||
|
|
||||||
Value(me) returns AsciiString from TCollection
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the value of the parameter which is an
|
|
||||||
-- AsciiString.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Value (me : mutable ; avalue : CString from Standard)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
--- Purpose: Sets the string <avalue> in <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me ; astream : in out OStream from Standard)
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thestring : HAsciiString from TCollection;
|
|
||||||
|
|
||||||
end StringParameter;
|
|
@ -1,72 +0,0 @@
|
|||||||
// Created on: 1993-02-03
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_StringParameter.ixx>
|
|
||||||
#include <TCollection_HAsciiString.hxx>
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_StringParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_StringParameter::Dynamic_StringParameter(const Standard_CString aparameter)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_StringParameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_StringParameter::Dynamic_StringParameter(const Standard_CString aparameter,
|
|
||||||
const Standard_CString avalue)
|
|
||||||
: Dynamic_Parameter(aparameter)
|
|
||||||
{
|
|
||||||
thestring = new TCollection_HAsciiString(avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
TCollection_AsciiString Dynamic_StringParameter::Value() const
|
|
||||||
{
|
|
||||||
return thestring->String();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_StringParameter::Value(const Standard_CString avalue)
|
|
||||||
{
|
|
||||||
thestring = new TCollection_HAsciiString(avalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_StringParameter::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
Dynamic_Parameter::Dump(astream);
|
|
||||||
TCollection_AsciiString string = thestring->String();
|
|
||||||
astream<<" "<<string.ToCString();
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
-- Created on: 1994-08-24
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class Variable from Dynamic
|
|
||||||
inherits
|
|
||||||
|
|
||||||
TShared from MMgt
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: This class is the root class for describing
|
|
||||||
-- variables. A variable is useful to specify the
|
|
||||||
-- signature of a method in terms of arguments and if
|
|
||||||
-- necessary variables and/or constants needed inside
|
|
||||||
-- a function. This set of information defines a
|
|
||||||
-- scope for these variables. This class is directly
|
|
||||||
-- used by the MethodDefinition class. From this
|
|
||||||
-- class is derived the instances of variables which
|
|
||||||
-- are used by the classes under the MethodInstance
|
|
||||||
-- class. A variable is composed by :
|
|
||||||
--
|
|
||||||
-- * an identifier for giving it a name,
|
|
||||||
-- * a type of expected value,
|
|
||||||
-- * possibly a default value,
|
|
||||||
-- * a mode which explains if the variable is :
|
|
||||||
--
|
|
||||||
-- - an input and/or output argument to the method,
|
|
||||||
-- - an internal or constant variable used in the
|
|
||||||
-- body of the method.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
OStream from Standard,
|
|
||||||
Parameter from Dynamic,
|
|
||||||
ModeEnum from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable Variable from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates and returns an empty instance of this class.
|
|
||||||
|
|
||||||
Parameter(me : mutable ; aparameter : Parameter from Dynamic)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Sets the parameter <aparameter> in <me>. This
|
|
||||||
-- parameter gives the name, the type of value, and if
|
|
||||||
-- necessary the default value of the variable.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Parameter(me) returns any Parameter from Dynamic
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the parameter stored in <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Mode(me : mutable ; amode : ModeEnum from Dynamic)
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Sets the mode to the variable. the mode is to take in
|
|
||||||
-- the enumeration IN, OUT, INOUT, INTERNAL, CONSTANT,
|
|
||||||
-- which describes the type of the variable.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Mode(me) returns ModeEnum from Dynamic
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Returns the mode of the variable.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
Dump(me; astream : in out OStream from Standard);
|
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
---Purpose: Useful for debugging.
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
theparameter : Parameter from Dynamic;
|
|
||||||
themode : ModeEnum from Dynamic;
|
|
||||||
|
|
||||||
end Variable;
|
|
@ -1,76 +0,0 @@
|
|||||||
// Created on: 1994-08-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_Variable.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_Variable::Dynamic_Variable()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Variable::Parameter(const Handle(Dynamic_Parameter)& aparameter)
|
|
||||||
{
|
|
||||||
theparameter = aparameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Parameter
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Parameter) Dynamic_Variable::Parameter() const
|
|
||||||
{
|
|
||||||
return theparameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Mode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Variable::Mode(const Dynamic_ModeEnum amode)
|
|
||||||
{
|
|
||||||
themode = amode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Mode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_ModeEnum Dynamic_Variable::Mode() const
|
|
||||||
{
|
|
||||||
return themode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dump
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_Variable::Dump(Standard_OStream& astream) const
|
|
||||||
{
|
|
||||||
theparameter->Dump(astream);
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
-- Created on: 1994-08-24
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class VariableGroup from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
Variable from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This inherited class from variable is for
|
|
||||||
-- specifing that the variable does not accept only
|
|
||||||
-- one value but a collection of homogeneous
|
|
||||||
-- values. This class is for describing the signature
|
|
||||||
-- of the method definition. When an instance of this
|
|
||||||
-- kind of method is done, it is a
|
|
||||||
-- CompositVariableInstance which is used.
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable VariableGroup from Dynamic;
|
|
||||||
|
|
||||||
---Level: Advanced
|
|
||||||
|
|
||||||
---Purpose: Creates and Returns a new instance of this class.
|
|
||||||
|
|
||||||
|
|
||||||
end VariableGroup;
|
|
@ -1,26 +0,0 @@
|
|||||||
// Created on: 1994-08-24
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_VariableGroup.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_VariableGroup
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_VariableGroup::Dynamic_VariableGroup() : Dynamic_Variable()
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
-- Created on: 1994-09-05
|
|
||||||
-- Created by: Gilles DEBARBOUILLE
|
|
||||||
-- Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class VariableInstance from Dynamic
|
|
||||||
|
|
||||||
inherits
|
|
||||||
|
|
||||||
AbstractVariableInstance from Dynamic
|
|
||||||
|
|
||||||
---Purpose: This class is set in the fields of the
|
|
||||||
-- MethodInstance class. When a MethodInstance is
|
|
||||||
-- done each variable of the definition must be
|
|
||||||
-- defined in the instance by a VariableInstance with
|
|
||||||
-- the same name as in the definition. If the method
|
|
||||||
-- instance is directly used by an application the
|
|
||||||
-- user value is directly set into the
|
|
||||||
-- VariableInstance. If now the MethodInstance enters
|
|
||||||
-- in the definition of a CompositMethod It is
|
|
||||||
-- necessary to define the correspondance between the
|
|
||||||
-- variables of the CompositMethod definition and the
|
|
||||||
-- use throughout the MethodInstance.
|
|
||||||
|
|
||||||
uses
|
|
||||||
|
|
||||||
Variable from Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable VariableInstance from Dynamic;
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns a new empty instance of this class.
|
|
||||||
|
|
||||||
Variable(me : mutable ; avariable : Variable from Dynamic)
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Sets the variable <avariable> into the
|
|
||||||
-- VariableInstance <me>.
|
|
||||||
|
|
||||||
is redefined;
|
|
||||||
|
|
||||||
Variable(me) returns Variable from Dynamic
|
|
||||||
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
---Purpose: Returns the variable contained into the
|
|
||||||
-- VariableInstance <me>.
|
|
||||||
|
|
||||||
is static;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
thevariable : Variable from Dynamic;
|
|
||||||
|
|
||||||
end VariableInstance;
|
|
@ -1,45 +0,0 @@
|
|||||||
// Created on: 1994-09-05
|
|
||||||
// Created by: Gilles DEBARBOUILLE
|
|
||||||
// Copyright (c) 1994-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Dynamic_VariableInstance.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Dynamic_VariableInstance
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Dynamic_VariableInstance::Dynamic_VariableInstance() : Dynamic_AbstractVariableInstance()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void Dynamic_VariableInstance::Variable(const Handle(Dynamic_Variable)& avariable)
|
|
||||||
{
|
|
||||||
thevariable = avariable;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Variable
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(Dynamic_Variable) Dynamic_VariableInstance::Variable() const
|
|
||||||
{
|
|
||||||
return thevariable;
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
-- Created on: 1993-08-06
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
package GraphDS
|
|
||||||
|
|
||||||
---Purpose: This package <GraphDS> provides generic classes to
|
|
||||||
-- describe transient graph data structure.
|
|
||||||
|
|
||||||
uses Standard,
|
|
||||||
MMgt,
|
|
||||||
TCollection,
|
|
||||||
TColStd
|
|
||||||
|
|
||||||
is
|
|
||||||
enumeration EntityRole is
|
|
||||||
OnlyInput,
|
|
||||||
OnlyOutput,
|
|
||||||
InputAndOutput
|
|
||||||
end EntityRole;
|
|
||||||
|
|
||||||
enumeration RelationRole is
|
|
||||||
OnlyFront,
|
|
||||||
OnlyBack,
|
|
||||||
FrontAndBack
|
|
||||||
end RelationRole;
|
|
||||||
|
|
||||||
class EntityRoleMap instantiates DataMap from TCollection
|
|
||||||
(Transient from Standard,
|
|
||||||
EntityRole from GraphDS,
|
|
||||||
MapTransientHasher from TColStd);
|
|
||||||
|
|
||||||
generic class DirectedGraph,
|
|
||||||
Vertex,
|
|
||||||
Edge,
|
|
||||||
VerticesIterator,
|
|
||||||
EdgesIterator;
|
|
||||||
|
|
||||||
|
|
||||||
generic class RelationGraph,
|
|
||||||
Entity,
|
|
||||||
Relation,
|
|
||||||
EntitiesIterator,
|
|
||||||
IncidentEntitiesIterator,
|
|
||||||
RelationsIterator,
|
|
||||||
IncidentRelationsIterator;
|
|
||||||
|
|
||||||
end GraphDS;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,386 +0,0 @@
|
|||||||
-- Created on: 1991-04-24
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class DirectedGraph from GraphDS
|
|
||||||
(GraphDS_Item as any ;
|
|
||||||
GraphDS_Attribute as any)
|
|
||||||
|
|
||||||
---Purpose: This class describes a structure which contains a
|
|
||||||
-- list of Vertices and a list of Edges. The vertex
|
|
||||||
-- (also called a Node), is the basic element of the
|
|
||||||
-- graph, it contains an Item. Each edge (also called
|
|
||||||
-- an Arc) defines an oriented link between two
|
|
||||||
-- vertices. it contains an Attribute. In the scheme
|
|
||||||
-- A->B, vertex A is called the SOURCE of the link, B
|
|
||||||
-- its DESTINATION, and B is ADJACENT to A. If there is
|
|
||||||
-- no edge which destinates to a vertex, this vertex is
|
|
||||||
-- a ROOT of the graph. If there is no edge which
|
|
||||||
-- originates from a vertex, this vertex is a LEAF of
|
|
||||||
-- the graph.
|
|
||||||
-- Keywords: SOURCE vertex, DESTINATION Vertex, ROOT vertex, LEAF
|
|
||||||
-- vertex, ADJACENT vertex. Depth-first search, breadth
|
|
||||||
-- first Search.
|
|
||||||
-- References: Software Components with ADA (The Benjamin/Cummings
|
|
||||||
-- Company, Inc. 1986).
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
DomainError from Standard
|
|
||||||
|
|
||||||
|
|
||||||
class Vertex inherits TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose: nested public class vertex (composed of an
|
|
||||||
-- associated Item).
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create (value : GraphDS_Item)
|
|
||||||
returns mutable Vertex from GraphDS;
|
|
||||||
--is private;
|
|
||||||
|
|
||||||
GetItem (me)
|
|
||||||
returns any GraphDS_Item;
|
|
||||||
---Purpose: returns item associated to <me>.
|
|
||||||
---C++: return const &
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
SetItem (me : mutable; value : GraphDS_Item);
|
|
||||||
---Purpose: Associates a new item to <me>.
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
Contains (me; E : Edge)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsFront (me; E : Edge)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsBack (me; E : Edge)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsRoot (me; ignoreselfloop : Boolean from Standard = Standard_True)
|
|
||||||
---Purpose: Returns TRUE if NbBackEdges = 0.
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsLeaf (me; ignoreselfloop : Boolean from Standard = Standard_True)
|
|
||||||
---Purpose: Returns TRUE if NbFrontEdges = 0.
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
AddEdge (me : mutable; E : Edge)
|
|
||||||
returns Boolean from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
RemoveEdge (me : mutable; anEdge : Edge)
|
|
||||||
raises NoSuchObject from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
GetEdges (me)
|
|
||||||
returns MapOfTransient from TColStd
|
|
||||||
---C++: return const&
|
|
||||||
---Purpose: Returns <myEdges> field for Iterator;
|
|
||||||
---Level: Internal
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myItem : GraphDS_Item;
|
|
||||||
myEdges : MapOfTransient from TColStd;
|
|
||||||
|
|
||||||
friends
|
|
||||||
class DirectedGraph from GraphDS,
|
|
||||||
class Edge from GraphDS,
|
|
||||||
class VerticesIterator from GraphDS,
|
|
||||||
class EdgesIterator from GraphDS
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
class Edge inherits TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose: Nested public class Edge (composed of an
|
|
||||||
-- associated attribute) An Edge is an oriented link
|
|
||||||
-- between two vertices.
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard ,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
is
|
|
||||||
|
|
||||||
Create (source,destination : Vertex; value : GraphDS_Attribute)
|
|
||||||
returns mutable Edge;
|
|
||||||
--is private;
|
|
||||||
|
|
||||||
GetAttribute (me)
|
|
||||||
---Purpose: returns attribute associated to <me>.
|
|
||||||
---C++: return const &
|
|
||||||
---Level: Internal
|
|
||||||
returns any GraphDS_Attribute;
|
|
||||||
|
|
||||||
SetAttribute (me : mutable; Value : GraphDS_Attribute);
|
|
||||||
---Purpose: To associate a new attribute to <me>.
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
Contains (me; V : Vertex)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Source (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Purpose: Returns the vertex which originates from <me>.
|
|
||||||
---Level: Internal
|
|
||||||
returns mutable Vertex;
|
|
||||||
|
|
||||||
Destination (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Purpose: Returns the vertex which destinates to <me>.
|
|
||||||
---Level: Internal
|
|
||||||
returns mutable Vertex;
|
|
||||||
|
|
||||||
Reverse (me : mutable);
|
|
||||||
---Purpose: Reverse the orientation of <me>. the source
|
|
||||||
-- vertex becomes the destination vertex. And
|
|
||||||
-- the destination the source.
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
IsLoop (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose: Returns True if the source and destination vertices
|
|
||||||
-- are equal.
|
|
||||||
---Level: Internal
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myAttribute : GraphDS_Attribute;
|
|
||||||
mySource : Vertex from GraphDS;
|
|
||||||
myDestination : Vertex from GraphDS;
|
|
||||||
|
|
||||||
friends
|
|
||||||
class DirectedGraph from GraphDS,
|
|
||||||
class Vertex from GraphDS,
|
|
||||||
class VerticesIterator from GraphDS,
|
|
||||||
class EdgesIterator from GraphDS
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
class VerticesIterator
|
|
||||||
|
|
||||||
---Purpose: basic tool to iterate on vertices.
|
|
||||||
-- 1 - vertices member of a DirectedGraph.
|
|
||||||
-- 2 - adjacent vertices of a given one.
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd,
|
|
||||||
MapIteratorOfMapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns VerticesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : DirectedGraph from GraphDS)
|
|
||||||
returns VerticesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : DirectedGraph from GraphDS;
|
|
||||||
V : Vertex from GraphDS)
|
|
||||||
returns VerticesIterator from GraphDS;
|
|
||||||
|
|
||||||
Initialize (me : in out; G : DirectedGraph from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Initialize (me : in out; G : DirectedGraph from GraphDS;
|
|
||||||
V : Vertex from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Level: Public
|
|
||||||
returns Vertex
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myMap : MapOfTransient from TColStd;
|
|
||||||
myVertices : MapIteratorOfMapOfTransient from TColStd;
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
class EdgesIterator
|
|
||||||
|
|
||||||
---Purpose: basic tool to iterate on edges :
|
|
||||||
-- 1 - edges member of a DirectedGraph.
|
|
||||||
-- 2 - edges referenced by a given vertex.
|
|
||||||
|
|
||||||
uses MapIteratorOfMapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard ,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns EdgesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : DirectedGraph from GraphDS)
|
|
||||||
returns EdgesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : DirectedGraph from GraphDS;
|
|
||||||
V : Vertex from GraphDS)
|
|
||||||
returns EdgesIterator from GraphDS;
|
|
||||||
|
|
||||||
Initialize (me : in out; G : DirectedGraph from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Initialize (me : in out; G : DirectedGraph from GraphDS;
|
|
||||||
V : Vertex from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Level: Public
|
|
||||||
returns Edge
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myEdges : MapIteratorOfMapOfTransient from TColStd;
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns DirectedGraph from GraphDS;
|
|
||||||
---Purpose: Create an empty Directed Graph.
|
|
||||||
|
|
||||||
IsEmpty (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
NbVertices (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
NbEdges (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Clear (me : in out);
|
|
||||||
---Purpose: removes all edges and vertices of <me>.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Contains (me; E : Edge)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Contains (me; V : Vertex)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
IsRoot (me; V : Vertex; ignoreselfloop : Boolean from Standard = Standard_True)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
IsLeaf (me; V : Vertex; ignoreselfloop : Boolean from Standard = Standard_True)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Add (me : in out; value : GraphDS_Item)
|
|
||||||
---Purpose: Creates a vertex, with a given Item <value>, and
|
|
||||||
-- Adds it to <me>. Of course this new Vertex
|
|
||||||
-- (returned by the method) is a "root" and "leaf"
|
|
||||||
-- vertex of <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns mutable Vertex;
|
|
||||||
|
|
||||||
Remove (me : in out; V : Vertex)
|
|
||||||
---Purpose: Removes <V> from <me>. <NoSuchObject> is raised
|
|
||||||
-- if <V> is not member of <me>. <DomainError> is
|
|
||||||
-- raised if <V> is used by at least one edge of <me>
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
DomainError from Standard;
|
|
||||||
|
|
||||||
Add (me : in out; source : mutable Vertex;
|
|
||||||
destination : mutable Vertex;
|
|
||||||
value : GraphDS_Attribute)
|
|
||||||
---Purpose: Creates an Edge, with a given Attribute <value>,
|
|
||||||
-- from <source> to <destination>, and Adds it to
|
|
||||||
-- <me>. This new edge is returned by the method.
|
|
||||||
-- <NoSuchObject> is raised if <source> and/or
|
|
||||||
-- <destination> are not members of <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns mutable Edge
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Remove (me : in out; E : Edge)
|
|
||||||
---Purpose: Removes <E> from <me>. <NoSuchObject> is raised if
|
|
||||||
-- <E> is not member of <me>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myVertices : MapOfTransient from TColStd;
|
|
||||||
myEdges : MapOfTransient from TColStd;
|
|
||||||
|
|
||||||
friends
|
|
||||||
class VerticesIterator from GraphDS,
|
|
||||||
class EdgesIterator from GraphDS
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,185 +0,0 @@
|
|||||||
// Created on: 1993-03-16
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <Standard_DomainError.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_DirectedGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_DirectedGraph::GraphDS_DirectedGraph ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphDS_DirectedGraph::NbVertices () const
|
|
||||||
{
|
|
||||||
return myVertices.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbEdges
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphDS_DirectedGraph::NbEdges () const
|
|
||||||
{
|
|
||||||
return myEdges.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsEmpty
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_DirectedGraph::IsEmpty () const
|
|
||||||
{
|
|
||||||
return (myVertices.IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Clear
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_DirectedGraph::Clear ()
|
|
||||||
{
|
|
||||||
myVertices.Clear();
|
|
||||||
myEdges.Clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_DirectedGraph::Contains
|
|
||||||
(const Handle(GraphDS_Vertex)& V) const
|
|
||||||
{
|
|
||||||
return myVertices.Contains(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsRoot
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_DirectedGraph::IsRoot
|
|
||||||
(const Handle(GraphDS_Vertex)& V,
|
|
||||||
const Standard_Boolean ignoreselfloop) const
|
|
||||||
{
|
|
||||||
return V->IsRoot(ignoreselfloop);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsLeaf
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_DirectedGraph::IsLeaf
|
|
||||||
(const Handle(GraphDS_Vertex)& V,
|
|
||||||
const Standard_Boolean ignoreselfloop) const
|
|
||||||
{
|
|
||||||
return V->IsLeaf(ignoreselfloop);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_DirectedGraph::Contains
|
|
||||||
(const Handle(GraphDS_Edge)& E) const
|
|
||||||
{
|
|
||||||
return myEdges.Contains(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Add
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(GraphDS_Vertex) GraphDS_DirectedGraph::Add
|
|
||||||
(const GraphDS_Item& value)
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Vertex) V = new GraphDS_Vertex (value);
|
|
||||||
myVertices.Add(V);
|
|
||||||
return V;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Remove
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_DirectedGraph::Remove (const Handle(GraphDS_Vertex)& V)
|
|
||||||
{
|
|
||||||
if (!V->GetEdges().IsEmpty()) Standard_DomainError::Raise();
|
|
||||||
myVertices.Remove(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Add
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(GraphDS_Edge) GraphDS_DirectedGraph::Add
|
|
||||||
(const Handle(GraphDS_Vertex)& source,
|
|
||||||
const Handle(GraphDS_Vertex)& destination,
|
|
||||||
const GraphDS_Attribute& A)
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Edge) E = new GraphDS_Edge (source,destination,A);
|
|
||||||
source->AddEdge (E);
|
|
||||||
destination->AddEdge(E);
|
|
||||||
myEdges.Add(E);
|
|
||||||
return E;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Remove
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_DirectedGraph::Remove (const Handle(GraphDS_Edge)& E)
|
|
||||||
{
|
|
||||||
E->Source()->RemoveEdge(E);
|
|
||||||
E->Destination()->RemoveEdge(E);
|
|
||||||
myEdges.Remove(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,120 +0,0 @@
|
|||||||
// Created on: 1993-03-16
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_Edge
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_Edge::GraphDS_Edge
|
|
||||||
(const Handle(GraphDS_Vertex)& source,
|
|
||||||
const Handle(GraphDS_Vertex)& destination,
|
|
||||||
const GraphDS_Attribute& value) : myAttribute (value)
|
|
||||||
{
|
|
||||||
mySource = source;
|
|
||||||
myDestination = destination;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetAttribute
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphDS_Attribute& GraphDS_Edge::GetAttribute () const
|
|
||||||
{
|
|
||||||
return myAttribute;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetAttribute
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Edge::SetAttribute (const GraphDS_Attribute& Value)
|
|
||||||
{
|
|
||||||
myAttribute = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Edge::Contains (const Handle(GraphDS_Vertex)& V) const
|
|
||||||
{
|
|
||||||
return (mySource == V || myDestination == V);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Source
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Vertex)& GraphDS_Edge::Source () const
|
|
||||||
{
|
|
||||||
return mySource;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Destination
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Vertex)& GraphDS_Edge::Destination () const
|
|
||||||
{
|
|
||||||
return myDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reverse
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Edge::Reverse ()
|
|
||||||
{
|
|
||||||
Handle (GraphDS_Vertex) temp = myDestination;
|
|
||||||
myDestination = mySource;
|
|
||||||
mySource = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsLoop
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Edge::IsLoop () const
|
|
||||||
{
|
|
||||||
return (myDestination == mySource);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
|||||||
// Created on: 1993-03-16
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EdgesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EdgesIterator::GraphDS_EdgesIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EdgesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EdgesIterator::GraphDS_EdgesIterator
|
|
||||||
(const GraphDS_DirectedGraph& G)
|
|
||||||
{
|
|
||||||
Initialize (G);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EdgesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EdgesIterator::GraphDS_EdgesIterator
|
|
||||||
(const GraphDS_DirectedGraph& G,
|
|
||||||
const Handle(GraphDS_Vertex)& V)
|
|
||||||
{
|
|
||||||
Initialize (G,V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EdgesIterator::Initialize
|
|
||||||
(const GraphDS_DirectedGraph& G)
|
|
||||||
{
|
|
||||||
myEdges.Initialize(G.myEdges);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EdgesIterator::Initialize
|
|
||||||
(const GraphDS_DirectedGraph&,
|
|
||||||
const Handle(GraphDS_Vertex)& V)
|
|
||||||
{
|
|
||||||
myEdges.Initialize(V->GetEdges());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_EdgesIterator::More () const
|
|
||||||
{
|
|
||||||
return myEdges.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EdgesIterator::Next ()
|
|
||||||
{
|
|
||||||
myEdges.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Edge)& GraphDS_EdgesIterator::Value () const
|
|
||||||
{
|
|
||||||
return *((Handle(GraphDS_Edge)*)& myEdges.Key());
|
|
||||||
//return Handle(GraphDS_Edge)::DownCast(myEdges.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,165 +0,0 @@
|
|||||||
// Created on: 1991-09-10
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EntitiesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EntitiesIterator::GraphDS_EntitiesIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EntitiesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EntitiesIterator::GraphDS_EntitiesIterator
|
|
||||||
(const GraphDS_RelationGraph& G)
|
|
||||||
{
|
|
||||||
Initialize (G);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EntitiesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EntitiesIterator::GraphDS_EntitiesIterator
|
|
||||||
(const GraphDS_RelationGraph& G,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
Initialize (G,E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_EntitiesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EntitiesIterator::GraphDS_EntitiesIterator
|
|
||||||
(const GraphDS_RelationGraph& G,
|
|
||||||
const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
Initialize (G,R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EntitiesIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph& G)
|
|
||||||
{
|
|
||||||
myEntities.Initialize(G.myEntities);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose : adjacent entities search
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EntitiesIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph&,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
myMap.Clear();
|
|
||||||
|
|
||||||
Handle(GraphDS_Relation) REL;
|
|
||||||
GraphDS_DataMapIteratorOfEntityRoleMap itv;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient itr;
|
|
||||||
|
|
||||||
for (itr.Initialize(E->GetRelations());itr.More();itr.Next()) {
|
|
||||||
REL = Handle(GraphDS_Relation)::DownCast(itr.Key());
|
|
||||||
if (REL->IsInput(E)) {
|
|
||||||
for (itv.Initialize(REL->GetEntities());itv.More();itv.Next()) {
|
|
||||||
if (itv.Value() != GraphDS_OnlyInput) {
|
|
||||||
myMap.Add(itv.Key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myEntities.Initialize(myMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EntitiesIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph&,
|
|
||||||
const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
myMap.Clear();
|
|
||||||
GraphDS_DataMapIteratorOfEntityRoleMap itv;
|
|
||||||
for (itv.Initialize(R->GetEntities());itv.More();itv.Next()) {
|
|
||||||
myMap.Add(itv.Key());
|
|
||||||
}
|
|
||||||
myEntities.Initialize(myMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_EntitiesIterator::More () const
|
|
||||||
{
|
|
||||||
return myEntities.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_EntitiesIterator::Next ()
|
|
||||||
{
|
|
||||||
myEntities.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Entity)& GraphDS_EntitiesIterator::Value () const
|
|
||||||
{
|
|
||||||
return *((Handle(GraphDS_Entity)*)& myEntities.Key());
|
|
||||||
//return Handle(GraphDS_Entity)::DownCast(myEntities.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
|||||||
// Created on: 1991-09-10
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
# include <Standard_NoSuchObject.hxx>
|
|
||||||
# include <Standard_DomainError.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_Entity
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_Entity::GraphDS_Entity
|
|
||||||
(const GraphDS_Item& item) : myItem(item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetItem
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphDS_Item& GraphDS_Entity::GetItem() const
|
|
||||||
{
|
|
||||||
return myItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Entity::Contains
|
|
||||||
(const Handle(GraphDS_Relation)& R) const
|
|
||||||
{
|
|
||||||
return myRelations.Contains(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Add
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Entity::Add (const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
myRelations.Add(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Remove
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Entity::Remove (const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
myRelations.Remove(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : HasRelation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Entity::HasRelation () const
|
|
||||||
{
|
|
||||||
return !myRelations.IsEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetRole
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationRole GraphDS_Entity::GetRole
|
|
||||||
(const Handle(GraphDS_Relation)& R) const
|
|
||||||
{
|
|
||||||
GraphDS_RelationRole RR;
|
|
||||||
Handle(GraphDS_Entity) me = this;
|
|
||||||
GraphDS_EntityRole ER = R->GetRole(me);
|
|
||||||
switch(ER) {
|
|
||||||
case GraphDS_OnlyInput:
|
|
||||||
RR = GraphDS_OnlyFront;
|
|
||||||
break;
|
|
||||||
case GraphDS_OnlyOutput:
|
|
||||||
RR = GraphDS_OnlyBack;
|
|
||||||
break;
|
|
||||||
case GraphDS_InputAndOutput:
|
|
||||||
RR = GraphDS_FrontAndBack;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return RR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsFront
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Entity::IsFront
|
|
||||||
(const Handle(GraphDS_Relation)& R) const
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Entity) me = this;
|
|
||||||
return R->IsInput(me);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsBack
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Entity::IsBack
|
|
||||||
(const Handle(GraphDS_Relation)& R) const
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Entity) me = this;
|
|
||||||
return R->IsOutput(me);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetRelations
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const TColStd_MapOfTransient& GraphDS_Entity::GetRelations() const
|
|
||||||
{
|
|
||||||
return myRelations;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,326 +0,0 @@
|
|||||||
// Created on: 1991-10-15
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Create
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_IncidentEntitiesIterator::GraphDS_IncidentEntitiesIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Create
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_IncidentEntitiesIterator::GraphDS_IncidentEntitiesIterator
|
|
||||||
(const GraphDS_RelationGraph& G,
|
|
||||||
const Handle(GraphDS_Entity)& V)
|
|
||||||
{
|
|
||||||
Initialize (G,V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_IncidentEntitiesIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph&,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
myMap.Clear();
|
|
||||||
|
|
||||||
Handle(GraphDS_Relation) REL;
|
|
||||||
GraphDS_DataMapIteratorOfEntityRoleMap itv;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient itr;
|
|
||||||
|
|
||||||
for (itr.Initialize(E->GetRelations());itr.More();itr.Next()) {
|
|
||||||
REL = Handle(GraphDS_Relation)::DownCast(itr.Key());
|
|
||||||
if (REL->IsOutput(E)) {
|
|
||||||
for (itv.Initialize(REL->GetEntities());itv.More();itv.Next()) {
|
|
||||||
if (itv.Value() != GraphDS_OnlyOutput) {
|
|
||||||
myMap.Add(itv.Key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myEntities.Initialize(myMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_IncidentEntitiesIterator::More () const
|
|
||||||
{
|
|
||||||
return myEntities.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_IncidentEntitiesIterator::Next ()
|
|
||||||
{
|
|
||||||
myEntities.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Entity)& GraphDS_IncidentEntitiesIterator::Value () const
|
|
||||||
{
|
|
||||||
return *((Handle(GraphDS_Entity)*)& myEntities.Key());
|
|
||||||
// return Handle(GraphDS_Entity)::DownCast(myEntities.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
|||||||
// Created on: 1991-09-10
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_IncidentRelationsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_IncidentRelationsIterator::GraphDS_IncidentRelationsIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_IncidentRelationsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_IncidentRelationsIterator::GraphDS_IncidentRelationsIterator
|
|
||||||
(const GraphDS_RelationGraph& G,
|
|
||||||
const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
Initialize (G,R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_IncidentRelationsIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph&,
|
|
||||||
const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
|
|
||||||
myMap.Clear();
|
|
||||||
|
|
||||||
Handle(GraphDS_Entity) ENT;
|
|
||||||
Handle(GraphDS_Relation) REL;
|
|
||||||
GraphDS_DataMapIteratorOfEntityRoleMap itv;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient itr;
|
|
||||||
|
|
||||||
for (itv.Initialize(R->GetEntities());itv.More();itv.Next()) {
|
|
||||||
ENT = Handle(GraphDS_Entity)::DownCast(itv.Key());
|
|
||||||
if (itv.Value() != GraphDS_OnlyOutput) {
|
|
||||||
for (itr.Initialize(ENT->GetRelations()); itr.More(); itr.Next()) {
|
|
||||||
REL = Handle(GraphDS_Relation)::DownCast(itr.Key());
|
|
||||||
if (REL->IsOutput(ENT)) myMap.Add(REL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myRelations.Initialize(myMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_IncidentRelationsIterator::More () const
|
|
||||||
{
|
|
||||||
return myRelations.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_IncidentRelationsIterator::Next ()
|
|
||||||
{
|
|
||||||
myRelations.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Relation)& GraphDS_IncidentRelationsIterator::Value () const
|
|
||||||
{
|
|
||||||
return *((Handle(GraphDS_Relation)*)& myRelations.Key());
|
|
||||||
//return Handle(GraphDS_Relation)::DownCast(myRelations.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,209 +0,0 @@
|
|||||||
// Created on: 1991-10-11
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
# include <Standard_NoSuchObject.hxx>
|
|
||||||
# include <Standard_DomainError.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_Relation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_Relation::GraphDS_Relation
|
|
||||||
(const GraphDS_Attribute& att) : myAttribute(att)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetAttribute
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphDS_Attribute& GraphDS_Relation::GetAttribute () const
|
|
||||||
{
|
|
||||||
return myAttribute;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Relation::Contains
|
|
||||||
(const Handle(GraphDS_Entity)& E) const
|
|
||||||
{
|
|
||||||
return myEntities.IsBound(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsEmpty
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Relation::IsEmpty () const
|
|
||||||
{
|
|
||||||
return myEntities.IsEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Add
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Relation::Add
|
|
||||||
(const Handle(GraphDS_Entity)& E, const GraphDS_EntityRole R)
|
|
||||||
{
|
|
||||||
myEntities.Bind(E,R);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetRole
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Relation::SetRole
|
|
||||||
(const Handle(GraphDS_Entity)& E, const GraphDS_EntityRole R)
|
|
||||||
{
|
|
||||||
myEntities(E) = R;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Remove
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Relation::Remove (const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
myEntities.UnBind(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetRole
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_EntityRole GraphDS_Relation::GetRole
|
|
||||||
(const Handle(GraphDS_Entity)& E) const
|
|
||||||
{
|
|
||||||
return myEntities(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsInput
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Relation::IsInput
|
|
||||||
(const Handle(GraphDS_Entity)& E) const
|
|
||||||
{
|
|
||||||
return (myEntities(E) != GraphDS_OnlyOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsOutput
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Relation::IsOutput
|
|
||||||
(const Handle(GraphDS_Entity)& E) const
|
|
||||||
{
|
|
||||||
return (myEntities(E) != GraphDS_OnlyInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetEntities
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphDS_EntityRoleMap& GraphDS_Relation::GetEntities() const
|
|
||||||
{
|
|
||||||
return myEntities;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,523 +0,0 @@
|
|||||||
-- Created on: 1991-09-06
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class RelationGraph from GraphDS
|
|
||||||
(GraphDS_Item as any;
|
|
||||||
GraphDS_Attribute as any)
|
|
||||||
|
|
||||||
---Purpose: This generic class describe a network (or graph) of
|
|
||||||
-- Relations between Entities. an Item can be associated
|
|
||||||
-- to the Entity and respectively an Attribute to the
|
|
||||||
-- Relation. This class can be compared to the
|
|
||||||
-- DirectedGraph of this package. But here the Relation
|
|
||||||
-- (compared to the Edge) can describe links between more
|
|
||||||
-- than two Entities. Each link can be described as
|
|
||||||
-- oriented or not. Nested classes permit to edit and
|
|
||||||
-- visit that structure. Interface of visiting tools are
|
|
||||||
-- done as iterators.
|
|
||||||
|
|
||||||
|
|
||||||
uses TShared from MMgt,
|
|
||||||
MapOfTransient from TColStd,
|
|
||||||
EntityRole from GraphDS
|
|
||||||
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
NoMoreObject from Standard,
|
|
||||||
DomainError from Standard
|
|
||||||
|
|
||||||
class Entity from GraphDS inherits TShared from MMgt
|
|
||||||
|
|
||||||
uses RelationRole from GraphDS,
|
|
||||||
MapOfTransient from TColStd
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create (value : GraphDS_Item)
|
|
||||||
returns mutable Entity from GraphDS;
|
|
||||||
|
|
||||||
GetItem (me)
|
|
||||||
---Level: Internal
|
|
||||||
---C++ : return const&
|
|
||||||
returns any GraphDS_Item;
|
|
||||||
|
|
||||||
Contains (me; R : Relation from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
HasRelation (me)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
GetRole (me; R : Relation from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns RelationRole from GraphDS;
|
|
||||||
|
|
||||||
IsFront (me; R : Relation from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsBack (me; R : Relation from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Add (me : mutable; R : Relation from GraphDS)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
Remove (me : mutable; R : Relation from GraphDS)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
GetRelations (me)
|
|
||||||
---C++: return const&
|
|
||||||
returns MapOfTransient from TColStd
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myItem : GraphDS_Item;
|
|
||||||
myRelations : MapOfTransient from TColStd;
|
|
||||||
|
|
||||||
friends
|
|
||||||
|
|
||||||
class RelationGraph from GraphDS,
|
|
||||||
class EntitiesIterator from GraphDS,
|
|
||||||
class IncidentEntitiesIterator from GraphDS,
|
|
||||||
class RelationsIterator from GraphDS,
|
|
||||||
class IncidentRelationsIterator from GraphDS
|
|
||||||
|
|
||||||
end Entity from GraphDS;
|
|
||||||
|
|
||||||
|
|
||||||
class Relation inherits TShared from MMgt
|
|
||||||
|
|
||||||
uses EntityRole from GraphDS,
|
|
||||||
EntityRoleMap from GraphDS
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create (value : GraphDS_Attribute)
|
|
||||||
returns mutable Relation;
|
|
||||||
|
|
||||||
GetAttribute (me)
|
|
||||||
---Level: Internal
|
|
||||||
---C++: return const&
|
|
||||||
returns any GraphDS_Attribute;
|
|
||||||
|
|
||||||
Contains (me; E : Entity from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsEmpty (me)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
GetRole (me; E : Entity from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns EntityRole from GraphDS;
|
|
||||||
|
|
||||||
IsInput (me; E : Entity from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
IsOutput (me; E : Entity from GraphDS)
|
|
||||||
---Level: Internal
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Remove (me : mutable; E : Entity from GraphDS)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
Add (me : mutable; E : Entity from GraphDS;
|
|
||||||
R : EntityRole from GraphDS)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
SetRole (me : mutable; E : Entity from GraphDS;
|
|
||||||
R : EntityRole from GraphDS)
|
|
||||||
is private;
|
|
||||||
|
|
||||||
GetEntities (me)
|
|
||||||
---C++: return const&
|
|
||||||
returns EntityRoleMap from GraphDS
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myAttribute : GraphDS_Attribute;
|
|
||||||
myEntities : EntityRoleMap from GraphDS;
|
|
||||||
|
|
||||||
friends
|
|
||||||
|
|
||||||
class RelationGraph from GraphDS,
|
|
||||||
class EntitiesIterator from GraphDS,
|
|
||||||
class IncidentEntitiesIterator from GraphDS,
|
|
||||||
class RelationsIterator from GraphDS,
|
|
||||||
class IncidentRelationsIterator from GraphDS
|
|
||||||
|
|
||||||
end Relation;
|
|
||||||
|
|
||||||
|
|
||||||
class EntitiesIterator from GraphDS
|
|
||||||
|
|
||||||
---Purpose: Public nested class which defines an iterator to
|
|
||||||
-- visit each Entity member of a given RelationGraph.
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd,
|
|
||||||
MapIteratorOfMapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns EntitiesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS)
|
|
||||||
returns EntitiesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS;
|
|
||||||
E : Entity from GraphDS)
|
|
||||||
returns EntitiesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS;
|
|
||||||
E : Relation from GraphDS)
|
|
||||||
returns EntitiesIterator from GraphDS;
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS;
|
|
||||||
E : Entity from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS;
|
|
||||||
R : Relation from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Level: Public
|
|
||||||
returns Entity from GraphDS
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myMap : MapOfTransient from TColStd;
|
|
||||||
myEntities : MapIteratorOfMapOfTransient from TColStd;
|
|
||||||
|
|
||||||
end EntitiesIterator;
|
|
||||||
|
|
||||||
|
|
||||||
class RelationsIterator from GraphDS
|
|
||||||
|
|
||||||
---Purpose: Public nested class which defines an iterator to
|
|
||||||
-- visit each Relation member of a given
|
|
||||||
-- RelationGraph.
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd,
|
|
||||||
MapIteratorOfMapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns RelationsIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS)
|
|
||||||
returns RelationsIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS;
|
|
||||||
R : Relation from GraphDS)
|
|
||||||
returns RelationsIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS;
|
|
||||||
E : Entity from GraphDS)
|
|
||||||
returns RelationsIterator from GraphDS;
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS;
|
|
||||||
R : Relation from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS;
|
|
||||||
E : Entity from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
---C++: return const&
|
|
||||||
returns Relation from GraphDS
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myMap : MapOfTransient from TColStd;
|
|
||||||
myRelations : MapIteratorOfMapOfTransient from TColStd;
|
|
||||||
|
|
||||||
end RelationsIterator;
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentEntitiesIterator from GraphDS
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd,
|
|
||||||
MapIteratorOfMapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns IncidentEntitiesIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS;
|
|
||||||
E : Entity from GraphDS)
|
|
||||||
returns IncidentEntitiesIterator from GraphDS;
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS;
|
|
||||||
E : Entity from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Level: Public
|
|
||||||
returns Entity from GraphDS
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myMap : MapOfTransient from TColStd;
|
|
||||||
myEntities : MapIteratorOfMapOfTransient from TColStd;
|
|
||||||
|
|
||||||
end IncidentEntitiesIterator;
|
|
||||||
|
|
||||||
|
|
||||||
class IncidentRelationsIterator from GraphDS
|
|
||||||
|
|
||||||
uses MapOfTransient from TColStd,
|
|
||||||
MapIteratorOfMapOfTransient from TColStd
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
is
|
|
||||||
Create
|
|
||||||
returns IncidentRelationsIterator from GraphDS;
|
|
||||||
|
|
||||||
Create (G : RelationGraph from GraphDS;
|
|
||||||
R : Relation from GraphDS)
|
|
||||||
returns IncidentRelationsIterator from GraphDS;
|
|
||||||
|
|
||||||
Initialize (me : in out; G : RelationGraph from GraphDS;
|
|
||||||
R : Relation from GraphDS);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
---C++: return const&
|
|
||||||
---Level: Public
|
|
||||||
returns Relation from GraphDS
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myMap : MapOfTransient from TColStd;
|
|
||||||
myRelations : MapIteratorOfMapOfTransient from TColStd;
|
|
||||||
|
|
||||||
end IncidentRelationsIterator;
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns RelationGraph from GraphDS;
|
|
||||||
---Purpose: Creates an empty relation graph.
|
|
||||||
|
|
||||||
Create (other : RelationGraph from GraphDS)
|
|
||||||
returns RelationGraph from GraphDS;
|
|
||||||
|
|
||||||
IsEmpty (me)
|
|
||||||
---Purpose: tests if <me> contains any Entity.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Clear (me : in out);
|
|
||||||
---Purpose: Removes all the Entities and all the relations of
|
|
||||||
-- <me>.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Contains (me; E : Entity from GraphDS)
|
|
||||||
---Purpose: tests if <me> contains <E>.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Contains (me; R : Relation from GraphDS)
|
|
||||||
---Purpose: tests if <me> contains <rel>.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
NbEntities (me)
|
|
||||||
---Purpose: returns the number of Entity of me.
|
|
||||||
---Level: Public
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
NbRelations (me)
|
|
||||||
---Purpose: returns the number of Relations of <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
IsInRelation (me; E : Entity from GraphDS)
|
|
||||||
---Purpose: To Know if <E> is in relation (as input,output
|
|
||||||
-- or both as well) with others Entities of <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
IsInput (me; E : Entity from GraphDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
---Purpose: returns True if <E>
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
IsOutput (me; E : Entity from GraphDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
---Purpose: returns True if <E> is at least output of one of
|
|
||||||
-- its relation.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
IsDependent (me; E : Entity from GraphDS)
|
|
||||||
returns Boolean from Standard
|
|
||||||
---Purpose: returns True if <E> is not input of one of its
|
|
||||||
-- relation.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
AddEntity (me : in out; value : GraphDS_Item)
|
|
||||||
---Purpose: Creates an adds a new Entity (which contains item)
|
|
||||||
-- to <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns Entity from GraphDS;
|
|
||||||
|
|
||||||
RemoveEntity (me : in out; E : Entity from GraphDS)
|
|
||||||
---Purpose: Removes a Entity <E> of <me>. Be carefull than an
|
|
||||||
-- exception is raised if <E> is still member of any
|
|
||||||
-- relation of <me>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
DomainError from Standard;
|
|
||||||
|
|
||||||
AddRelation (me : in out; value : GraphDS_Attribute)
|
|
||||||
---Purpose: Creates an adds a new Relation (which contains
|
|
||||||
-- attribute) to <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns Relation from GraphDS;
|
|
||||||
|
|
||||||
RemoveRelation (me : in out; R : Relation from GraphDS)
|
|
||||||
---Purpose: Removes a relation <R> of <me>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
---Purpose: relation editing function
|
|
||||||
|
|
||||||
IsEmpty (me; R : Relation)
|
|
||||||
---Purpose: returns TRUE if noone entity is member of <R>.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Add (me : in out; R : Relation; E : Entity)
|
|
||||||
---Purpose: add an InputAndOutput entity <E> to <R>
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
AddInput (me : in out; R : Relation; E : Entity)
|
|
||||||
---Purpose: add OnlyInput entity <E> to <R>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
AddOutput (me : in out; R : Relation; E : Entity)
|
|
||||||
---Purpose: add an OnlyOutput entity <E> to <R>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Add (me : in out; R : Relation;
|
|
||||||
E : Entity;
|
|
||||||
role : EntityRole from GraphDS)
|
|
||||||
---Purpose: add an entity <E> to <R> with role <role>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
SetRole (me : in out; R : Relation;
|
|
||||||
E : Entity;
|
|
||||||
role : EntityRole from GraphDS)
|
|
||||||
---Purpose: set a new role <role> for the entity <E> member of <R>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Remove (me : in out; R : Relation; E : Entity)
|
|
||||||
---Purpose: remove the entity <E> member of <R>.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myEntities : MapOfTransient from TColStd;
|
|
||||||
myRelations : MapOfTransient from TColStd;
|
|
||||||
|
|
||||||
friends
|
|
||||||
|
|
||||||
class EntitiesIterator from GraphDS,
|
|
||||||
class RelationsIterator from GraphDS
|
|
||||||
|
|
||||||
end RelationGraph;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,325 +0,0 @@
|
|||||||
// Created on: 1991-09-09
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <Standard_DomainError.hxx>
|
|
||||||
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
|
|
||||||
#include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_RelationGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationGraph::GraphDS_RelationGraph ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_RelationGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationGraph::GraphDS_RelationGraph
|
|
||||||
(const GraphDS_RelationGraph& other)
|
|
||||||
{
|
|
||||||
myEntities = other.myEntities;
|
|
||||||
myRelations = other.myRelations;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsEmpty
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::IsEmpty () const
|
|
||||||
{
|
|
||||||
return myEntities.Extent() ==0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Clear
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationGraph::Clear ()
|
|
||||||
{
|
|
||||||
myEntities.Clear();
|
|
||||||
myRelations.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::Contains
|
|
||||||
(const Handle(GraphDS_Entity)& V) const
|
|
||||||
{
|
|
||||||
return myEntities.Contains(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsInRelation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::IsInRelation
|
|
||||||
(const Handle(GraphDS_Entity)& V) const
|
|
||||||
{
|
|
||||||
return (V->HasRelation());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsInput
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::IsInput
|
|
||||||
(const Handle(GraphDS_Entity)& V) const
|
|
||||||
{
|
|
||||||
return !IsDependent(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsOutput
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::IsOutput
|
|
||||||
(const Handle(GraphDS_Entity)& V) const
|
|
||||||
{
|
|
||||||
if (V->GetRelations().IsEmpty()) return Standard_True;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient it (V->GetRelations());
|
|
||||||
for (;it.More();it.Next()) {
|
|
||||||
if (Handle(GraphDS_Relation)::DownCast(it.Key())->IsOutput(V)) return Standard_True;
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsDependent
|
|
||||||
//purpose : il est seulement sortie d'une au moins de ses relations
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::IsDependent
|
|
||||||
(const Handle(GraphDS_Entity)& E) const
|
|
||||||
{
|
|
||||||
if (E->GetRelations().IsEmpty()) return Standard_False;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient it (E->GetRelations());
|
|
||||||
for (;it.More();it.Next()) {
|
|
||||||
if (Handle(GraphDS_Relation)::DownCast(it.Key())->IsOutput(E)) {
|
|
||||||
if (!Handle(GraphDS_Relation)::DownCast(it.Key())->IsInput(E))return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::Contains
|
|
||||||
(const Handle(GraphDS_Relation)& R) const
|
|
||||||
{
|
|
||||||
return (myRelations.Contains(R));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbEntities
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphDS_RelationGraph::NbEntities() const
|
|
||||||
{
|
|
||||||
return myEntities.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbRelations
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphDS_RelationGraph::NbRelations() const
|
|
||||||
{
|
|
||||||
return myRelations.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddEntity
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(GraphDS_Entity) GraphDS_RelationGraph::AddEntity
|
|
||||||
(const GraphDS_Item& item)
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Entity) entity = new GraphDS_Entity(item);
|
|
||||||
myEntities.Add(entity);
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : RemoveEntity
|
|
||||||
//purpose : Removes an Entity of the relation graph
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationGraph::RemoveEntity
|
|
||||||
(const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
if (E->HasRelation()) Standard_DomainError::Raise();
|
|
||||||
myEntities.Remove(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddRelation
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Handle(GraphDS_Relation) GraphDS_RelationGraph::AddRelation
|
|
||||||
(const GraphDS_Attribute& att)
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Relation) newrel = new GraphDS_Relation(att);
|
|
||||||
myRelations.Add(newrel);
|
|
||||||
return newrel;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsEmpty
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationGraph::IsEmpty
|
|
||||||
(const Handle(GraphDS_Relation)& R) const
|
|
||||||
{
|
|
||||||
return R->IsEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Add
|
|
||||||
//purpose : InputAndOutput
|
|
||||||
//=======================================================================
|
|
||||||
void GraphDS_RelationGraph::Add
|
|
||||||
(const Handle(GraphDS_Relation)& R,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
Add (R,E,GraphDS_InputAndOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddInput
|
|
||||||
//purpose : OnlyInput
|
|
||||||
//=======================================================================
|
|
||||||
void GraphDS_RelationGraph::AddInput
|
|
||||||
(const Handle(GraphDS_Relation)& R,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
Add (R,E,GraphDS_OnlyInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddOutput
|
|
||||||
//purpose : OnlyOutput
|
|
||||||
//=======================================================================
|
|
||||||
void GraphDS_RelationGraph::AddOutput
|
|
||||||
(const Handle(GraphDS_Relation)& R,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
Add (R,E,GraphDS_OnlyOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Add
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphDS_RelationGraph::Add
|
|
||||||
(const Handle(GraphDS_Relation)& R,
|
|
||||||
const Handle(GraphDS_Entity)& E,
|
|
||||||
const GraphDS_EntityRole role)
|
|
||||||
{
|
|
||||||
R->Add(E,role);
|
|
||||||
E->Add(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetRole
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphDS_RelationGraph::SetRole
|
|
||||||
(const Handle(GraphDS_Relation)& R,
|
|
||||||
const Handle(GraphDS_Entity)& E,
|
|
||||||
const GraphDS_EntityRole role)
|
|
||||||
{
|
|
||||||
R->SetRole(E,role);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Remove
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphDS_RelationGraph::Remove
|
|
||||||
(const Handle(GraphDS_Relation)& R,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
R->Remove(E);
|
|
||||||
E->Remove(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : RemoveRelation
|
|
||||||
//purpose : Removes a relation of the relation graph
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationGraph::RemoveRelation
|
|
||||||
(const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Entity) ENT;
|
|
||||||
GraphDS_DataMapIteratorOfEntityRoleMap it;
|
|
||||||
for (it.Initialize(R->GetEntities());it.More();it.Next()) {
|
|
||||||
ENT = Handle(GraphDS_Entity)::DownCast(it.Key());
|
|
||||||
ENT->Remove(R);
|
|
||||||
}
|
|
||||||
myRelations.Remove(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
|||||||
// Created on: 1991-09-10
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_RelationsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationsIterator::GraphDS_RelationsIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_RelationsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationsIterator::GraphDS_RelationsIterator
|
|
||||||
(const GraphDS_RelationGraph& G)
|
|
||||||
{
|
|
||||||
Initialize (G);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_RelationsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationsIterator::GraphDS_RelationsIterator
|
|
||||||
(const GraphDS_RelationGraph& G,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
Initialize(G,E);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_RelationsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_RelationsIterator::GraphDS_RelationsIterator
|
|
||||||
(const GraphDS_RelationGraph& G,
|
|
||||||
const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
Initialize(G,R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationsIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph& G)
|
|
||||||
{
|
|
||||||
myRelations.Initialize(G.myRelations);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationsIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph&,
|
|
||||||
const Handle(GraphDS_Entity)& E)
|
|
||||||
{
|
|
||||||
myRelations.Initialize(E->GetRelations());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationsIterator::Initialize
|
|
||||||
(const GraphDS_RelationGraph&,
|
|
||||||
const Handle(GraphDS_Relation)& R)
|
|
||||||
{
|
|
||||||
myMap.Clear();
|
|
||||||
|
|
||||||
Handle(GraphDS_Entity) ENT;
|
|
||||||
Handle(GraphDS_Relation) REL;
|
|
||||||
GraphDS_DataMapIteratorOfEntityRoleMap itv;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient itr;
|
|
||||||
|
|
||||||
for (itv.Initialize(R->GetEntities());itv.More();itv.Next()) {
|
|
||||||
ENT = Handle(GraphDS_Entity)::DownCast(itv.Key());
|
|
||||||
if (itv.Value() != GraphDS_OnlyInput) {
|
|
||||||
for (itr.Initialize(ENT->GetRelations()); itr.More(); itr.Next()) {
|
|
||||||
REL = Handle(GraphDS_Relation)::DownCast(itr.Key());
|
|
||||||
if (REL->IsInput(ENT)) myMap.Add(REL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myRelations.Initialize(myMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_RelationsIterator::More () const
|
|
||||||
{
|
|
||||||
return myRelations.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_RelationsIterator::Next ()
|
|
||||||
{
|
|
||||||
myRelations.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Relation)& GraphDS_RelationsIterator::Value () const
|
|
||||||
{
|
|
||||||
return *((Handle(GraphDS_Relation)*)& myRelations.Key());
|
|
||||||
//return Handle(GraphDS_Relation)::DownCast(myRelations.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
|||||||
// Created on: 1993-03-16
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_DomainError.hxx>
|
|
||||||
#include <Standard_NotImplemented.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_Vertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_Vertex::GraphDS_Vertex (const GraphDS_Item& value) : myItem(value)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetItem
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphDS_Item& GraphDS_Vertex::GetItem () const
|
|
||||||
{
|
|
||||||
return myItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetItem
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Vertex::SetItem (const GraphDS_Item& Value)
|
|
||||||
{
|
|
||||||
myItem = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Contains
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Vertex::Contains (const Handle(GraphDS_Edge)& E) const
|
|
||||||
{
|
|
||||||
return myEdges.Contains(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Vertex::IsFront (const Handle(GraphDS_Edge)& ) const
|
|
||||||
{
|
|
||||||
Standard_NotImplemented::Raise();
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Vertex::IsBack (const Handle(GraphDS_Edge)& ) const
|
|
||||||
{
|
|
||||||
Standard_NotImplemented::Raise();
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsRoot
|
|
||||||
//purpose : never destination of an edge
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Vertex::IsRoot (const Standard_Boolean ignoreselfloop) const
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Vertex) me = this;
|
|
||||||
Handle(GraphDS_Edge) E;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient it;
|
|
||||||
for (it.Initialize(myEdges); it.More(); it.Next()) {
|
|
||||||
E = Handle(GraphDS_Edge)::DownCast(it.Key());
|
|
||||||
if (ignoreselfloop && E->IsLoop()) continue;
|
|
||||||
if (E->Destination() == me) return Standard_False;
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsLeaf
|
|
||||||
//purpose : never source of an edge
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Vertex::IsLeaf (const Standard_Boolean ignoreselfloop) const
|
|
||||||
{
|
|
||||||
Handle(GraphDS_Vertex) me = this;
|
|
||||||
Handle(GraphDS_Edge) E;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient it;
|
|
||||||
for (it.Initialize(myEdges); it.More(); it.Next()) {
|
|
||||||
E = Handle(GraphDS_Edge)::DownCast(it.Key());
|
|
||||||
if (ignoreselfloop && E->IsLoop()) continue;
|
|
||||||
if (E->Source() == me) return Standard_False;
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddEdge
|
|
||||||
//purpose : private
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_Vertex::AddEdge (const Handle(GraphDS_Edge)& E)
|
|
||||||
{
|
|
||||||
return myEdges.Add(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : RemoveEdge
|
|
||||||
//purpose : private
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_Vertex::RemoveEdge (const Handle(GraphDS_Edge)& E)
|
|
||||||
{
|
|
||||||
myEdges.Remove(E);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetEdges
|
|
||||||
//purpose : private
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const TColStd_MapOfTransient& GraphDS_Vertex::GetEdges () const
|
|
||||||
{
|
|
||||||
return myEdges;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
|||||||
// Created on: 1993-03-16
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_VerticesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_VerticesIterator::GraphDS_VerticesIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_VerticesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_VerticesIterator::GraphDS_VerticesIterator
|
|
||||||
(const GraphDS_DirectedGraph& DG)
|
|
||||||
{
|
|
||||||
Initialize (DG);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphDS_VerticesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphDS_VerticesIterator::GraphDS_VerticesIterator
|
|
||||||
(const GraphDS_DirectedGraph& DG,
|
|
||||||
const Handle(GraphDS_Vertex)& V)
|
|
||||||
{
|
|
||||||
Initialize (DG,V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_VerticesIterator::Initialize (const GraphDS_DirectedGraph& DG)
|
|
||||||
{
|
|
||||||
myVertices.Initialize(DG.myVertices);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_VerticesIterator::Initialize
|
|
||||||
(const GraphDS_DirectedGraph& DG,
|
|
||||||
const Handle(GraphDS_Vertex)& V)
|
|
||||||
{
|
|
||||||
myMap.Clear();
|
|
||||||
Handle(GraphDS_Edge) E;
|
|
||||||
TColStd_MapIteratorOfMapOfTransient it(V->GetEdges());
|
|
||||||
for (;it.More();it.Next()) {
|
|
||||||
E = Handle(GraphDS_Edge)::DownCast(it.Key());
|
|
||||||
if (E->Source() == V) myMap.Add(E->Destination());
|
|
||||||
}
|
|
||||||
myVertices.Initialize(myMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphDS_VerticesIterator::More () const
|
|
||||||
{
|
|
||||||
return myVertices.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphDS_VerticesIterator::Next ()
|
|
||||||
{
|
|
||||||
myVertices.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Handle(GraphDS_Vertex)& GraphDS_VerticesIterator::Value () const
|
|
||||||
{
|
|
||||||
return *((Handle(GraphDS_Vertex)*)& myVertices.Key());
|
|
||||||
//return Handle(GraphDS_Vertex)::DownCast(myVertices.Key());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
|||||||
-- Created on: 1991-03-07
|
|
||||||
-- Created by: Denis Pascal
|
|
||||||
-- Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
package GraphTools
|
|
||||||
|
|
||||||
---Purpose: This package <GraphTools> provides algorithms working
|
|
||||||
-- on a directed graph. Those algorithms are generic for
|
|
||||||
-- user (Graph and Vertex) data, and tool classes.
|
|
||||||
|
|
||||||
|
|
||||||
uses Standard,
|
|
||||||
MMgt,
|
|
||||||
TCollection,
|
|
||||||
TColStd
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
|
|
||||||
class ListOfSequenceOfInteger instantiates List from TCollection
|
|
||||||
(SequenceOfInteger from TColStd);
|
|
||||||
|
|
||||||
-- Requirements
|
|
||||||
-- ============
|
|
||||||
|
|
||||||
-- Data
|
|
||||||
-- Vertex
|
|
||||||
-- Graph
|
|
||||||
-- Tools
|
|
||||||
generic class GraphIterator;
|
|
||||||
generic class VertexIterator;
|
|
||||||
|
|
||||||
-- Services (Algorithms)
|
|
||||||
-- =====================
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: Depth First Search (DFS)
|
|
||||||
|
|
||||||
generic class DFSIterator,
|
|
||||||
DFSMap;
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: Breath First Search (BFS)
|
|
||||||
|
|
||||||
generic class BFSIterator,
|
|
||||||
BFSMap;
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: Sorted Strong Components (SC)
|
|
||||||
|
|
||||||
generic class SortedStrgCmptsFromIterator,
|
|
||||||
SCMap;
|
|
||||||
|
|
||||||
generic class SortedStrgCmptsIterator;
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: Topological Sort (TS)
|
|
||||||
|
|
||||||
class TSNode;
|
|
||||||
|
|
||||||
generic class TopologicalSortFromIterator,
|
|
||||||
TSMap;
|
|
||||||
|
|
||||||
generic class TopologicalSortIterator;
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: Connected Vertices (CV)
|
|
||||||
|
|
||||||
generic class ConnectedVerticesFromIterator,
|
|
||||||
CVMap,
|
|
||||||
ConnectMap;
|
|
||||||
|
|
||||||
generic class ConnectedVerticesIterator;
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: Reduced Graph (RG)
|
|
||||||
|
|
||||||
class RGNode;
|
|
||||||
|
|
||||||
class SC;
|
|
||||||
|
|
||||||
class SCList instantiates List from TCollection
|
|
||||||
(SC from GraphTools);
|
|
||||||
|
|
||||||
generic class ReducedGraph,
|
|
||||||
RGMap,
|
|
||||||
SortedSCIterator,
|
|
||||||
AdjSCIterator;
|
|
||||||
|
|
||||||
end GraphTools;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
|||||||
// Created on: 1991-10-23
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_AdjSCIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GraphTools_AdjSCIterator::GraphTools_AdjSCIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_AdjSCIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GraphTools_AdjSCIterator::GraphTools_AdjSCIterator
|
|
||||||
(const GraphTools_ReducedGraph& RG,
|
|
||||||
const Handle(GraphTools_SC)& SC)
|
|
||||||
{
|
|
||||||
Initialize (RG,SC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphTools_AdjSCIterator::Initialize
|
|
||||||
(const GraphTools_ReducedGraph& RG,
|
|
||||||
const Handle(GraphTools_SC)& SC)
|
|
||||||
{
|
|
||||||
myIterator.Initialize(SC->GetFrontSC());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GraphTools_AdjSCIterator::More() const
|
|
||||||
{
|
|
||||||
return myIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphTools_AdjSCIterator::Next()
|
|
||||||
{
|
|
||||||
myIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Handle(GraphTools_SC) GraphTools_AdjSCIterator::Value () const
|
|
||||||
{
|
|
||||||
return myIterator.Value();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
|||||||
-- Created on: 1992-10-12
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class BFSIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
VHasher as any;
|
|
||||||
VIterator as any)
|
|
||||||
|
|
||||||
--generic class BFSIterator from GraphTools
|
|
||||||
-- (Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- VHasher as MapHasher from TCollection (Vertex);
|
|
||||||
-- VIterator as VertexIterator (Graph,Vertex))
|
|
||||||
|
|
||||||
---Purpose: This generic class implement the Breadth First Search
|
|
||||||
-- algorithm from a Vertex with an iterator to reached
|
|
||||||
-- adjacent vertices of a given one. The interface of
|
|
||||||
-- this algorithm is made as an iterator.
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
class BFSMap instantiates IndexedMap from TCollection (Vertex,VHasher);
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns BFSIterator;
|
|
||||||
---Purpose: Create an empty iterator.
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph; V : Vertex);
|
|
||||||
---Purpose: Initializes the research from <V> member vertex of <G>.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me) returns Boolean from Standard;
|
|
||||||
---Purpose: Returns True if there are other vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next(me : in out)
|
|
||||||
---Purpose: Set the iterator to the next vertex.
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
Value(me) returns any Vertex
|
|
||||||
---Purpose: returns the vertex value for the current
|
|
||||||
-- position of the iterator.
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const &
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myVisited : BFSMap from GraphTools;
|
|
||||||
myCurrentIndex : Integer from Standard;
|
|
||||||
|
|
||||||
end BFSIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
|||||||
// Created on: 1992-10-12
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_BFSIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_BFSIterator::GraphTools_BFSIterator () {}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_BFSIterator::Perform
|
|
||||||
(const Graph& G, const Vertex& V)
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
myVisited.Clear();
|
|
||||||
TColStd_ListOfInteger myReady;
|
|
||||||
|
|
||||||
index = myVisited.Add(V);
|
|
||||||
myReady.Append(index);
|
|
||||||
while (!myReady.IsEmpty()) {
|
|
||||||
Vertex w1 = myVisited (myReady.First());
|
|
||||||
myReady.RemoveFirst();
|
|
||||||
for (VIterator it(G,w1); it.More(); it.Next()) {
|
|
||||||
Vertex w2 = it.Value();
|
|
||||||
if (!myVisited.Contains(w2)) {
|
|
||||||
index = myVisited.Add(w2);
|
|
||||||
myReady.Append(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myCurrentIndex = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_BFSIterator::More () const
|
|
||||||
{
|
|
||||||
return myCurrentIndex <= myVisited.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_BFSIterator::Next ()
|
|
||||||
{
|
|
||||||
myCurrentIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_BFSIterator::Value () const
|
|
||||||
{
|
|
||||||
return myVisited(myCurrentIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
-- Created on: 1992-10-16
|
|
||||||
-- Created by: Arnaud BOUZY
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class ConnectedVerticesFromIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
VIterator as any)
|
|
||||||
|
|
||||||
|
|
||||||
---Purpose: In a graph, returns subsets of a list of vertices in
|
|
||||||
-- which all vertices are connected.
|
|
||||||
|
|
||||||
uses HArray1OfInteger from TColStd
|
|
||||||
|
|
||||||
class CVMap instantiates IndexedMap from TCollection
|
|
||||||
(Vertex,
|
|
||||||
MapTransientHasher from TColStd);
|
|
||||||
|
|
||||||
class ConnectMap instantiates DataMap from TCollection
|
|
||||||
(Vertex,
|
|
||||||
Integer from Standard,
|
|
||||||
MapTransientHasher from TColStd);
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
---Purpose: Create an empty algorithm.
|
|
||||||
returns ConnectedVerticesFromIterator;
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex);
|
|
||||||
---Purpose: Add <V> as initial condition. This method is
|
|
||||||
-- cumulative. Use Perform method before visting the
|
|
||||||
-- result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Reset the algorithm. It may be reused with new
|
|
||||||
-- conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph);
|
|
||||||
---Purpose: Peform the algorithm in <G> from initial setted
|
|
||||||
-- conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More(me)
|
|
||||||
---Purpose: Returns TRUE if there are others subset of
|
|
||||||
-- connected vertices.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Next (me : in out);
|
|
||||||
---Purpose: Set the iterator to the next subset of connected
|
|
||||||
-- vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
NbVertices (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose: Returns number of vertices of the current subset
|
|
||||||
-- of connected vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me; index : Integer from Standard)
|
|
||||||
returns any Vertex;
|
|
||||||
---Purpose: Returns a vertex member of the current subset of
|
|
||||||
-- connected vertices.
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const&
|
|
||||||
|
|
||||||
Visit (me : in out; V : Vertex;
|
|
||||||
G : Graph;
|
|
||||||
visited : in out ConnectMap from GraphTools)
|
|
||||||
---Purpose: Recursively called to visit the vertices connected to
|
|
||||||
-- <avert> in <agraph>, with already visited vertices
|
|
||||||
-- <visited>.
|
|
||||||
---Level: Internal
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
initMap : CVMap from GraphTools;
|
|
||||||
tab : HArray1OfInteger from TColStd;
|
|
||||||
myCurrent : Integer from Standard;
|
|
||||||
|
|
||||||
end ConnectedVerticesFromIterator;
|
|
||||||
|
|
||||||
|
|
@ -1,211 +0,0 @@
|
|||||||
// Created on: 1992-10-19
|
|
||||||
// Created by: Arnaud BOUZY
|
|
||||||
// Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_ConnectedVerticesFromIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_ConnectedVerticesFromIterator::GraphTools_ConnectedVerticesFromIterator()
|
|
||||||
{
|
|
||||||
myCurrent = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesFromIterator::FromVertex(const Vertex& avert)
|
|
||||||
{
|
|
||||||
initMap.Add(avert);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesFromIterator::Reset ()
|
|
||||||
{
|
|
||||||
myCurrent = 0;
|
|
||||||
initMap.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesFromIterator::Perform (const Graph& aGraph)
|
|
||||||
{
|
|
||||||
Standard_Integer nbvert = initMap.Extent();
|
|
||||||
GraphTools_ConnectMap visited;
|
|
||||||
Standard_Integer i;
|
|
||||||
for (i=1;i<=nbvert; i++) {
|
|
||||||
visited.Bind(initMap(i),i);
|
|
||||||
}
|
|
||||||
for (i=1;i<=nbvert; i++) {
|
|
||||||
if (visited(initMap(i)) == i) {
|
|
||||||
myCurrent = i;
|
|
||||||
VIterator vit(aGraph,initMap(i));
|
|
||||||
while (vit.More()) {
|
|
||||||
Visit(vit.Value(),aGraph,visited);
|
|
||||||
vit.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tab = new TColStd_HArray1OfInteger(1,nbvert,0);
|
|
||||||
for (i=1; i<= nbvert; i++) {
|
|
||||||
tab->SetValue(i,visited(initMap(i)));
|
|
||||||
}
|
|
||||||
myCurrent = 0;
|
|
||||||
Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_ConnectedVerticesFromIterator::More() const
|
|
||||||
{
|
|
||||||
for (Standard_Integer i=1; i<= tab->Upper(); i++) {
|
|
||||||
if (tab->Value(i) >= myCurrent) {
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesFromIterator::Next()
|
|
||||||
{
|
|
||||||
Standard_Boolean found=Standard_False;
|
|
||||||
myCurrent++;
|
|
||||||
Standard_Integer nbv = tab->Upper();
|
|
||||||
Standard_Integer i;
|
|
||||||
while (!found && (myCurrent <= nbv)) {
|
|
||||||
for (i=1; (i<= nbv) && !found; i++) {
|
|
||||||
if (tab->Value(i) == myCurrent) {
|
|
||||||
found = Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
myCurrent++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_ConnectedVerticesFromIterator::NbVertices() const
|
|
||||||
{
|
|
||||||
if (!More()) {
|
|
||||||
Standard_NoSuchObject::Raise();
|
|
||||||
}
|
|
||||||
Standard_Integer res = 0;
|
|
||||||
for (Standard_Integer i=1; i<= tab->Upper(); i++) {
|
|
||||||
if (tab->Value(i) == myCurrent) {
|
|
||||||
res++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_ConnectedVerticesFromIterator::Value
|
|
||||||
(const Standard_Integer index) const
|
|
||||||
{
|
|
||||||
if (!More()) {
|
|
||||||
Standard_NoSuchObject::Raise();
|
|
||||||
}
|
|
||||||
Standard_Integer current=0;
|
|
||||||
for (Standard_Integer i=1; i<= tab->Upper(); i++) {
|
|
||||||
if (tab->Value(i) == myCurrent) {
|
|
||||||
current++;
|
|
||||||
if (current == index) {
|
|
||||||
return initMap(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Visit
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesFromIterator::Visit
|
|
||||||
(const Vertex& avert,
|
|
||||||
const Graph& agraph,
|
|
||||||
GraphTools_ConnectMap& visited)
|
|
||||||
{
|
|
||||||
Standard_Boolean godown = Standard_False;
|
|
||||||
if (!visited.IsBound(avert)) {
|
|
||||||
visited.Bind(avert,myCurrent);
|
|
||||||
godown = Standard_True;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Standard_Integer thebound = visited(avert);
|
|
||||||
if (thebound > myCurrent) {
|
|
||||||
visited(avert) = myCurrent;
|
|
||||||
godown = Standard_True;
|
|
||||||
}
|
|
||||||
else if (thebound < myCurrent) {
|
|
||||||
Standard_Integer rebind = visited(initMap(thebound));
|
|
||||||
for (Standard_Integer i=1; i <= initMap.Extent(); i++) {
|
|
||||||
if ((visited(initMap(i)) == thebound) ||
|
|
||||||
(visited(initMap(i)) == rebind)) {
|
|
||||||
visited(initMap(i)) = myCurrent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (godown) {
|
|
||||||
VIterator vit(agraph,avert);
|
|
||||||
while (vit.More()) {
|
|
||||||
Visit(vit.Value(),agraph,visited);
|
|
||||||
vit.Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
-- Created on: 1993-03-18
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class ConnectedVerticesIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
GIterator as any;
|
|
||||||
CVIterator as any)
|
|
||||||
|
|
||||||
--generic class ConnectedVerticesIterator from GraphTools
|
|
||||||
-- (Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- GIterator as GraphIterator (Graph,Vertex))
|
|
||||||
-- CVIterator as ConnectedVerticesFromIterator
|
|
||||||
|
|
||||||
---Purpose: In a graph, returns subsets of a list of vertices in
|
|
||||||
-- which all vertices are connected.
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
---Purpose: Create an empty algorithm.
|
|
||||||
returns ConnectedVerticesIterator from GraphTools;
|
|
||||||
|
|
||||||
Create (G : Graph)
|
|
||||||
---Purpose: Create the algorithm setting each vertex of <G>
|
|
||||||
-- reached by GIterator tool, as initial conditions.
|
|
||||||
-- Use Perform method before visting the result of
|
|
||||||
-- the algorithm.
|
|
||||||
returns ConnectedVerticesIterator from GraphTools;
|
|
||||||
|
|
||||||
FromGraph (me : in out; G : Graph);
|
|
||||||
---Purpose: Add each vertex of <G> reached by GIterator tool
|
|
||||||
-- as initial conditions. Use Perform method
|
|
||||||
-- before visiting the result of the algorithm.
|
|
||||||
---Level: Public;
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex);
|
|
||||||
---Purpose: Add <V> as research condition. This method is
|
|
||||||
-- cumulative. User must used Perform method before
|
|
||||||
-- visting the result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Reset the algorithm. It may be reused with new
|
|
||||||
-- initial conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph);
|
|
||||||
---Purpose: Peform the algorithm in <G> from initial setted
|
|
||||||
-- conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More(me)
|
|
||||||
---Purpose: Returns TRUE if there are others subset of
|
|
||||||
-- connected vertices.
|
|
||||||
---Level: Public
|
|
||||||
returns Boolean from Standard;
|
|
||||||
|
|
||||||
Next (me : in out);
|
|
||||||
---Purpose: Set the iterator to the next subset of connected
|
|
||||||
-- vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
NbVertices (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Purpose: Returns number of vertices of the current subset
|
|
||||||
-- of connected vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me; index : Integer from Standard)
|
|
||||||
returns any Vertex;
|
|
||||||
---Purpose: Returns a vertex member of the current subset of
|
|
||||||
-- connected vertices.
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const&
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myIterator : CVIterator;
|
|
||||||
|
|
||||||
end ConnectedVerticesIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
|||||||
// Created on: 1991-05-29
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_ConnectedVerticesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_ConnectedVerticesIterator::GraphTools_ConnectedVerticesIterator ()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_TopologicalSortIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_ConnectedVerticesIterator::GraphTools_ConnectedVerticesIterator
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
FromGraph (G);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesIterator::FromVertex
|
|
||||||
(const Vertex& V)
|
|
||||||
{
|
|
||||||
myIterator.FromVertex(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_ConnectedVerticesIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphTools_ConnectedVerticesIterator::FromGraph (const Graph& G)
|
|
||||||
{
|
|
||||||
for ( GIterator it (G); it.More(); it.Next() ) {
|
|
||||||
myIterator.FromVertex(it.Value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesIterator::Perform
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
myIterator.Perform(G);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ConnectedVerticesIterator::Reset ()
|
|
||||||
{
|
|
||||||
myIterator.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GraphTools_ConnectedVerticesIterator::More () const
|
|
||||||
{
|
|
||||||
return myIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GraphTools_ConnectedVerticesIterator::Next ()
|
|
||||||
{
|
|
||||||
myIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_ConnectedVerticesIterator::NbVertices() const
|
|
||||||
{
|
|
||||||
return myIterator.NbVertices();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
const Vertex& GraphTools_ConnectedVerticesIterator::Value
|
|
||||||
(const Standard_Integer I) const
|
|
||||||
{
|
|
||||||
return myIterator.Value(I);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
-- Created on: 1992-09-24
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class DFSIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
VHasher as any;
|
|
||||||
VIterator as any)
|
|
||||||
|
|
||||||
---Purpose: This generic class implement the Depth First Search
|
|
||||||
-- algorithm from a Vertex with an iterator to reached
|
|
||||||
-- adjacent vertices of a given one. The interface of
|
|
||||||
-- this algorithm is made as an iterator.
|
|
||||||
|
|
||||||
--generic class DFSIterator from GraphTools
|
|
||||||
-- (Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- VHasher as MapHasher from TCollection (Vertex);
|
|
||||||
-- VIterator as VertexIterator (Graph,Vertex))
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
class DFSMap instantiates IndexedMap from TCollection (Vertex,VHasher);
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns DFSIterator;
|
|
||||||
---Purpose: Create an empty iterator.
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph; V : Vertex);
|
|
||||||
---Purpose: Initializes the research from <V> member vertex of
|
|
||||||
-- <G>.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me) returns Boolean from Standard;
|
|
||||||
---Purpose: Returns True if there are other vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next(me : in out)
|
|
||||||
---Purpose: Set the iterator to the next vertex.
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
Value (me) returns any Vertex
|
|
||||||
---Purpose: returns the vertex value for the current position
|
|
||||||
-- of the iterator.
|
|
||||||
---C++: return const &
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myVisited : DFSMap from GraphTools;
|
|
||||||
myCurrentIndex : Integer from Standard;
|
|
||||||
|
|
||||||
end DFSIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
|||||||
// Created on: 1992-10-12
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_DFSIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_DFSIterator::GraphTools_DFSIterator () {}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_DFSIterator::Perform
|
|
||||||
(const Graph& G, const Vertex& V)
|
|
||||||
{
|
|
||||||
Standard_Integer index;
|
|
||||||
myVisited.Clear();
|
|
||||||
TColStd_ListOfInteger myReady;
|
|
||||||
|
|
||||||
index = myVisited.Add(V);
|
|
||||||
myReady.Prepend(index);
|
|
||||||
while (!myReady.IsEmpty()) {
|
|
||||||
Vertex w1 = myVisited (myReady.First());
|
|
||||||
myReady.RemoveFirst();
|
|
||||||
for (VIterator it(G,w1); it.More(); it.Next()) {
|
|
||||||
Vertex w2 = it.Value();
|
|
||||||
if (!myVisited.Contains(w2)) {
|
|
||||||
index = myVisited.Add(w2);
|
|
||||||
myReady.Prepend(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myCurrentIndex = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_DFSIterator::More () const
|
|
||||||
{
|
|
||||||
return myCurrentIndex <= myVisited.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_DFSIterator::Next ()
|
|
||||||
{
|
|
||||||
myCurrentIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_DFSIterator::Value () const
|
|
||||||
{
|
|
||||||
return myVisited(myCurrentIndex);
|
|
||||||
}
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
-- Created on: 1991-03-06
|
|
||||||
-- Created by: Denis Pascal
|
|
||||||
-- Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class GraphIterator from GraphTools (Graph as any;
|
|
||||||
Vertex as any)
|
|
||||||
|
|
||||||
-- template class GraphIterator from GraphTools (Graph as any;
|
|
||||||
-- Vertex as any)
|
|
||||||
|
|
||||||
---Purpose: Template class which defines signatures of an
|
|
||||||
-- iterator to visit each vertex, member of the
|
|
||||||
-- underlying graph.
|
|
||||||
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create (G : Graph) returns GraphIterator;
|
|
||||||
|
|
||||||
More (me) returns Boolean;
|
|
||||||
---Purpose: Returns TRUE if there are other vertices.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
--- Purpose : Set the iterator to the next Vertex.
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
Value (me) returns Vertex
|
|
||||||
--- Purpose: Returns the vertex value for the current position
|
|
||||||
-- of the iterator
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
end GraphIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
// Created on: 1993-09-27
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
@ -1,53 +0,0 @@
|
|||||||
-- Created on: 1993-09-29
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class RGNode from GraphTools
|
|
||||||
|
|
||||||
uses SC from GraphTools,
|
|
||||||
SequenceOfInteger from TColStd
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns RGNode;
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
|
|
||||||
SetVisited (me : in out; v : Integer from Standard);
|
|
||||||
|
|
||||||
GetVisited (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
AddAdj (me : in out; adj : Integer from Standard);
|
|
||||||
|
|
||||||
NbAdj (me)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
GetAdj (me; index : Integer from Standard)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
SetSC (me : in out; SC : SC from GraphTools);
|
|
||||||
|
|
||||||
GetSC (me)
|
|
||||||
returns SC from GraphTools;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
visited : Integer from Standard;
|
|
||||||
myAdj : SequenceOfInteger from TColStd;
|
|
||||||
mySC : SC from GraphTools;
|
|
||||||
|
|
||||||
end RGNode;
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
|||||||
// Created on: 1993-09-29
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <GraphTools_RGNode.ixx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_RGNode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_RGNode::GraphTools_RGNode()
|
|
||||||
{
|
|
||||||
visited = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_RGNode::Reset()
|
|
||||||
{
|
|
||||||
visited = 0;
|
|
||||||
myAdj.Clear();
|
|
||||||
mySC.Nullify();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetVisited
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_RGNode::SetVisited(const Standard_Integer v)
|
|
||||||
{
|
|
||||||
visited = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetVisited
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_RGNode::GetVisited() const
|
|
||||||
{
|
|
||||||
return visited;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddAdj
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_RGNode::AddAdj (const Standard_Integer adj)
|
|
||||||
{
|
|
||||||
myAdj.Append(adj);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbAdj
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_RGNode::NbAdj() const
|
|
||||||
{
|
|
||||||
return myAdj.Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetAdj
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_RGNode::GetAdj
|
|
||||||
(const Standard_Integer index) const
|
|
||||||
{
|
|
||||||
return myAdj(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SetSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_RGNode::SetSC (const Handle(GraphTools_SC)& SC)
|
|
||||||
{
|
|
||||||
mySC = SC;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(GraphTools_SC) GraphTools_RGNode::GetSC () const
|
|
||||||
{
|
|
||||||
return mySC;
|
|
||||||
}
|
|
@ -1,253 +0,0 @@
|
|||||||
-- Created on: 1993-01-06
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class ReducedGraph from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
VHasher as any;
|
|
||||||
VIterator as any;
|
|
||||||
GIterator as any)
|
|
||||||
|
|
||||||
--signature class ReducedGraph from GraphTools
|
|
||||||
-- Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- VHasher as MapHasher from TCollection (Vertex);
|
|
||||||
-- VIterator as VertexIterator (Graph,Vertex);
|
|
||||||
-- GIterator as GraphIterator (Graph,Vertex))
|
|
||||||
|
|
||||||
---Purpose: this generic class defines an algorithm to build and
|
|
||||||
-- visit the reduced graph of a given directed graph.
|
|
||||||
--
|
|
||||||
-- A reduced graph is defined itself as a graph where
|
|
||||||
-- each vertex represents a strong component. Each
|
|
||||||
-- strong component is a subset of vertices of the
|
|
||||||
-- underlying graph which are mutually dependant in the
|
|
||||||
-- way that there is always a path to go from a given
|
|
||||||
-- vertex to another vertex and back (Definition of a
|
|
||||||
-- cycle) . Of course the Reduced Graph (or Condensed
|
|
||||||
-- Graph) is a DAG (Directed Acyclic Graph).
|
|
||||||
--
|
|
||||||
-- After initialisation conditions (methods FromXXX) the
|
|
||||||
-- user has to build the reduced graph using the method
|
|
||||||
-- Perfrom. So each vertex of the underlying graph will
|
|
||||||
-- be encapsulated in a strong component (class SC of the
|
|
||||||
-- package). The algorithm may be reused using the
|
|
||||||
-- method Reset.
|
|
||||||
--
|
|
||||||
-- nested iterators and methods provides services to
|
|
||||||
-- visit the reduced graph:
|
|
||||||
--
|
|
||||||
-- * class SortedSCIterator defines an iterator to visit
|
|
||||||
-- each strong component. This visit is done according
|
|
||||||
-- to topologiacl sort of the reduced graph (which is a
|
|
||||||
-- DAG).
|
|
||||||
--
|
|
||||||
-- * class AdjSCIterator defines an iterator to visit
|
|
||||||
-- each adjacent StrongComponent of a given one.
|
|
||||||
--
|
|
||||||
-- * The methods NbVertices and GetVertex of the reduced
|
|
||||||
-- graph returned the number and each vertex member of a
|
|
||||||
-- strong component. The method GetSC returned for a
|
|
||||||
-- given vertex its strong component.e
|
|
||||||
--
|
|
||||||
-- Warning: Noone method may be used on SC class. This class is only
|
|
||||||
-- here to identify a StrongComponent.
|
|
||||||
|
|
||||||
uses SC from GraphTools,
|
|
||||||
SCList from GraphTools,
|
|
||||||
ListIteratorOfSCList from GraphTools,
|
|
||||||
ListOfInteger from TColStd
|
|
||||||
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
NoMoreObject from Standard,
|
|
||||||
OutOfRange from Standard
|
|
||||||
|
|
||||||
private class RGMap instantiates IndexedDataMap from TCollection
|
|
||||||
(Vertex,
|
|
||||||
RGNode from GraphTools,
|
|
||||||
VHasher);
|
|
||||||
|
|
||||||
class SortedSCIterator from GraphTools
|
|
||||||
|
|
||||||
uses SC from GraphTools,
|
|
||||||
ListIteratorOfSCList from GraphTools
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns SortedSCIterator from GraphTools;
|
|
||||||
|
|
||||||
Create (RG : ReducedGraph from GraphTools)
|
|
||||||
returns SortedSCIterator from GraphTools;
|
|
||||||
|
|
||||||
Initialize (me : in out; RG : ReducedGraph from GraphTools);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me) returns Boolean from Standard;
|
|
||||||
---Purpose: Returns True if there are others Strong
|
|
||||||
-- Components.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me) returns SC from GraphTools
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myIterator : ListIteratorOfSCList;
|
|
||||||
|
|
||||||
end SortedSCIterator;
|
|
||||||
|
|
||||||
|
|
||||||
class AdjSCIterator from GraphTools
|
|
||||||
|
|
||||||
uses SC from GraphTools,
|
|
||||||
ListIteratorOfSCList from GraphTools
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard,
|
|
||||||
OutOfRange from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns AdjSCIterator from GraphTools;
|
|
||||||
|
|
||||||
Create (RG : ReducedGraph from GraphTools;
|
|
||||||
SC : SC from GraphTools)
|
|
||||||
returns AdjSCIterator from GraphTools;
|
|
||||||
|
|
||||||
Initialize (me : in out; RG : ReducedGraph from GraphTools;
|
|
||||||
SC : SC from GraphTools);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me) returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me) returns SC from GraphTools
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myIterator : ListIteratorOfSCList;
|
|
||||||
|
|
||||||
end AdjSCIterator;
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
---Purpose: Create an empty algorithm
|
|
||||||
returns ReducedGraph from GraphTools;
|
|
||||||
|
|
||||||
|
|
||||||
Create (G : Graph)
|
|
||||||
---Purpose: Create the algorithm, set each vertex of <G>
|
|
||||||
-- reached by GIterator, as research conditions, and
|
|
||||||
-- perform the algorithm. User may directly visit
|
|
||||||
-- (nested class xxxIterator) the result of the
|
|
||||||
-- algorithm.
|
|
||||||
returns ReducedGraph from GraphTools;
|
|
||||||
|
|
||||||
FromGraph (me : in out; G : Graph);
|
|
||||||
---Purpose: Add each vertex of <G> reached by GIterator tool
|
|
||||||
-- as research conditions. User must used Perform
|
|
||||||
-- method before visiting the result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex);
|
|
||||||
---Purpose: Add <V> as research condition. This method is
|
|
||||||
-- cumulative. User must used Perform method before
|
|
||||||
-- visting the result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph);
|
|
||||||
---Purpose: Perform the algorithm IN <G> FROM previous
|
|
||||||
-- initialisation condition(s).
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Clear initialisation conditions. The algorithm may
|
|
||||||
-- be initialized and performed again from new
|
|
||||||
-- conditions. In that case new nested SCIterator and
|
|
||||||
-- AdjSCIterator may be reinitialized.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
IsRoot (me; SC : SC from GraphTools)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
IsLeaf (me; SC : SC from GraphTools)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
NbVertices (me; SC : SC from GraphTools)
|
|
||||||
---Purpose: returns number of vertices, members of <me>.
|
|
||||||
---Level: Public
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
GetVertex (me; SC : SC from GraphTools;
|
|
||||||
index : Integer from Standard)
|
|
||||||
returns any Vertex
|
|
||||||
---C++: return const&
|
|
||||||
---Level: Public
|
|
||||||
raises OutOfRange from Standard;
|
|
||||||
|
|
||||||
GetSC (me; V : Vertex)
|
|
||||||
---Purpose: Returns the SC which contains <V>.
|
|
||||||
---Level: Public
|
|
||||||
returns SC from GraphTools;
|
|
||||||
|
|
||||||
Visit (me : in out; k : Integer from Standard;
|
|
||||||
G : Graph)
|
|
||||||
---Level: Public
|
|
||||||
returns Integer from Standard
|
|
||||||
is private;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
-- conditions
|
|
||||||
myVertices : RGMap from GraphTools;
|
|
||||||
-- algorithm
|
|
||||||
performed : Boolean from Standard;
|
|
||||||
myNowIndex : Integer from Standard;
|
|
||||||
myStack : ListOfInteger from TColStd;
|
|
||||||
-- result
|
|
||||||
mySort : SCList from GraphTools;
|
|
||||||
|
|
||||||
friends
|
|
||||||
|
|
||||||
class SortedSCIterator from GraphTools
|
|
||||||
|
|
||||||
end ReducedGraph;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,261 +0,0 @@
|
|||||||
// Created on: 1991-10-23
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <GraphTools_RGNode.hxx>
|
|
||||||
#include <GraphTools_ListIteratorOfSCList.hxx>
|
|
||||||
|
|
||||||
static Standard_Boolean ContainsBack (const Handle(GraphTools_SC)& SC1,
|
|
||||||
const Handle(GraphTools_SC)& SC2)
|
|
||||||
{
|
|
||||||
GraphTools_ListIteratorOfSCList it (SC1->GetBackSC());
|
|
||||||
for (;it.More();it.Next()) {
|
|
||||||
if (it.Value() == SC2) return Standard_True;
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Standard_Boolean ContainsFront (const Handle(GraphTools_SC)& SC1,
|
|
||||||
const Handle(GraphTools_SC)& SC2)
|
|
||||||
{
|
|
||||||
GraphTools_ListIteratorOfSCList it (SC1->GetFrontSC());
|
|
||||||
for (;it.More();it.Next()) {
|
|
||||||
if (it.Value() == SC2) return Standard_True;
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_ReducedGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_ReducedGraph::GraphTools_ReducedGraph ()
|
|
||||||
{
|
|
||||||
performed = Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_ReducedGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_ReducedGraph::GraphTools_ReducedGraph
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
FromGraph(G);
|
|
||||||
Perform(G);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ReducedGraph::FromGraph (const Graph& G)
|
|
||||||
{
|
|
||||||
performed = Standard_False;
|
|
||||||
for (GIterator itG (G); itG.More(); itG.Next() ) {
|
|
||||||
GraphTools_RGNode newnode;
|
|
||||||
myVertices.Add (itG.Value(),newnode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ReducedGraph::FromVertex (const Vertex& V)
|
|
||||||
{
|
|
||||||
performed = Standard_False;
|
|
||||||
GraphTools_RGNode newnode;
|
|
||||||
myVertices.Add(V,newnode);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ReducedGraph::Perform (const Graph& G)
|
|
||||||
{
|
|
||||||
performed = Standard_True;
|
|
||||||
myNowIndex = 0;
|
|
||||||
myStack.Clear();
|
|
||||||
mySort.Clear();
|
|
||||||
Standard_Integer visited;
|
|
||||||
Standard_Integer index = 1;
|
|
||||||
while (index <= myVertices.Extent()) {
|
|
||||||
visited = myVertices(index).GetVisited();
|
|
||||||
if (visited == 0) Visit(index,G);
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
// front and back strong components of a given one : Update
|
|
||||||
Standard_Integer curV,nbV,adjV,nbadjV;
|
|
||||||
Handle(GraphTools_SC) curSC,adjSC;
|
|
||||||
GraphTools_ListIteratorOfSCList it;
|
|
||||||
for (it.Initialize(mySort); it.More(); it.Next()) {
|
|
||||||
curSC = it.Value();
|
|
||||||
nbV = curSC->NbVertices();
|
|
||||||
for (Standard_Integer j = 1; j <= nbV; j++) {
|
|
||||||
curV = curSC->GetVertex(j);
|
|
||||||
nbadjV = myVertices(curV).NbAdj();
|
|
||||||
for (Standard_Integer k = 1; k <= nbadjV; k++) {
|
|
||||||
adjV = myVertices(curV).GetAdj(k);
|
|
||||||
adjSC = myVertices(adjV).GetSC();
|
|
||||||
if (adjSC != curSC) {
|
|
||||||
if (!ContainsFront(curSC,adjSC)) curSC->AddFrontSC (adjSC);
|
|
||||||
if (!ContainsBack(adjSC,curSC)) adjSC->AddBackSC (curSC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_ReducedGraph::Reset ()
|
|
||||||
{
|
|
||||||
performed = Standard_False;
|
|
||||||
myVertices.Clear();
|
|
||||||
myNowIndex = 0;
|
|
||||||
myStack.Clear();
|
|
||||||
mySort.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsRoot
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GraphTools_ReducedGraph::IsRoot
|
|
||||||
(const Handle(GraphTools_SC)& SC) const
|
|
||||||
{
|
|
||||||
return (SC->GetBackSC().IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsLeaf
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean GraphTools_ReducedGraph::IsLeaf
|
|
||||||
(const Handle(GraphTools_SC)& SC) const
|
|
||||||
{
|
|
||||||
return (SC->GetFrontSC().IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_ReducedGraph::NbVertices
|
|
||||||
(const Handle(GraphTools_SC)& SC) const
|
|
||||||
{
|
|
||||||
return SC->NbVertices();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_ReducedGraph::GetVertex
|
|
||||||
(const Handle(GraphTools_SC)& SC,
|
|
||||||
const Standard_Integer index) const
|
|
||||||
{
|
|
||||||
return myVertices.FindKey(SC->GetVertex(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Handle(GraphTools_SC) GraphTools_ReducedGraph::GetSC
|
|
||||||
(const Vertex& V) const
|
|
||||||
{
|
|
||||||
if (!performed) Standard_DomainError::Raise();
|
|
||||||
return myVertices.FindFromKey(V).GetSC();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Visit
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_ReducedGraph::Visit
|
|
||||||
(const Standard_Integer k, const Graph& G)
|
|
||||||
{
|
|
||||||
Standard_Integer MIN;
|
|
||||||
Standard_Integer M;
|
|
||||||
myNowIndex++;
|
|
||||||
myVertices(k).SetVisited(myNowIndex);
|
|
||||||
MIN = myNowIndex;
|
|
||||||
myStack.Prepend(k);
|
|
||||||
Standard_Integer currentVisited;
|
|
||||||
currentVisited = myVertices(k).GetVisited();
|
|
||||||
Standard_Integer adjacentIndex;
|
|
||||||
Standard_Integer adjacentVisited;
|
|
||||||
for (VIterator itV (G,myVertices.FindKey(k)); itV.More(); itV.Next()) {
|
|
||||||
adjacentIndex = myVertices.FindIndex(itV.Value());
|
|
||||||
if (adjacentIndex == 0) {
|
|
||||||
GraphTools_RGNode newnode;
|
|
||||||
adjacentIndex = myVertices.Add (itV.Value(),newnode);
|
|
||||||
adjacentVisited = 0;
|
|
||||||
}
|
|
||||||
else adjacentVisited = myVertices(adjacentIndex).GetVisited();
|
|
||||||
myVertices(k).AddAdj(adjacentIndex);
|
|
||||||
if (adjacentVisited == 0) M = Visit (adjacentIndex,G);
|
|
||||||
else M = adjacentVisited;
|
|
||||||
if (M < MIN) MIN = M;
|
|
||||||
}
|
|
||||||
if (MIN == currentVisited) {
|
|
||||||
Handle(GraphTools_SC) SC = new GraphTools_SC();
|
|
||||||
Standard_Boolean more;
|
|
||||||
do {
|
|
||||||
SC->AddVertex(myStack.First());
|
|
||||||
myVertices(myStack.First()).SetVisited(IntegerLast());
|
|
||||||
myVertices(myStack.First()).SetSC(SC);
|
|
||||||
more = myStack.First() != k;
|
|
||||||
myStack.RemoveFirst() ;
|
|
||||||
}
|
|
||||||
while (more);
|
|
||||||
mySort.Prepend(SC);
|
|
||||||
}
|
|
||||||
return MIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
|||||||
-- Created on: 1993-09-30
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class SC from GraphTools inherits TShared from MMgt
|
|
||||||
|
|
||||||
---Purpose: This class is used to identify a Strong Component.
|
|
||||||
-- The user has not to used its methods.
|
|
||||||
|
|
||||||
uses SCList from GraphTools,
|
|
||||||
SequenceOfInteger from TColStd
|
|
||||||
|
|
||||||
raises OutOfRange from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns mutable SC;
|
|
||||||
|
|
||||||
Reset (me : mutable);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
AddVertex (me : mutable; V : Integer from Standard);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
NbVertices (me) returns Integer from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
GetVertex (me; index: Integer from Standard)
|
|
||||||
---Level: Public
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
AddFrontSC (me : mutable; SC : SC from GraphTools);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
GetFrontSC (me) returns SCList from GraphTools;
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
AddBackSC (me : mutable; SC : SC from GraphTools);
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
GetBackSC (me) returns SCList from GraphTools;
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const &
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myBackSC : SCList from GraphTools;
|
|
||||||
myVertices : SequenceOfInteger from TColStd;
|
|
||||||
myFrontSC : SCList from GraphTools;
|
|
||||||
|
|
||||||
end SC;
|
|
||||||
|
|
||||||
|
|
@ -1,116 +0,0 @@
|
|||||||
// Created on: 1993-09-30
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#include <GraphTools_SC.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_SC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_SC::GraphTools_SC () {}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SC::Reset()
|
|
||||||
{
|
|
||||||
myBackSC.Clear();
|
|
||||||
myVertices.Clear();
|
|
||||||
myFrontSC.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SC::AddVertex(const Standard_Integer V)
|
|
||||||
{
|
|
||||||
myVertices.Append (V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_SC::NbVertices() const
|
|
||||||
{
|
|
||||||
return myVertices.Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_SC::GetVertex
|
|
||||||
(const Standard_Integer index) const
|
|
||||||
{
|
|
||||||
return myVertices(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddFrontSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SC::AddFrontSC(const Handle(GraphTools_SC)& SC)
|
|
||||||
{
|
|
||||||
myFrontSC.Append(SC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetFrontSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphTools_SCList& GraphTools_SC::GetFrontSC() const
|
|
||||||
{
|
|
||||||
return myFrontSC;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddBackSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SC::AddBackSC(const Handle(GraphTools_SC)& SC)
|
|
||||||
{
|
|
||||||
myBackSC.Append(SC);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetBackSC
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const GraphTools_SCList& GraphTools_SC::GetBackSC() const
|
|
||||||
{
|
|
||||||
return myBackSC;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
// Created on: 1991-10-23
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_SortedSCIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_SortedSCIterator::GraphTools_SortedSCIterator ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_SortedSCIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_SortedSCIterator::GraphTools_SortedSCIterator
|
|
||||||
(const GraphTools_ReducedGraph& RG)
|
|
||||||
{
|
|
||||||
Initialize (RG);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Initialize
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedSCIterator::Initialize
|
|
||||||
(const GraphTools_ReducedGraph& RG)
|
|
||||||
{
|
|
||||||
myIterator.Initialize(RG.mySort);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_SortedSCIterator::More() const
|
|
||||||
{
|
|
||||||
return myIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedSCIterator::Next()
|
|
||||||
{
|
|
||||||
myIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Handle(GraphTools_SC) GraphTools_SortedSCIterator::Value () const
|
|
||||||
{
|
|
||||||
return myIterator.Value();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,129 +0,0 @@
|
|||||||
-- Created on: 1991-10-23
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class SortedStrgCmptsFromIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
VHasher as any;
|
|
||||||
VIterator as any)
|
|
||||||
|
|
||||||
---Purposes: This generic class implements the Strong Components
|
|
||||||
-- Research algorithm from a set of vertices. An
|
|
||||||
-- iterator on adjacent vertices of a given one, are
|
|
||||||
-- requested. Each Strong Component encapsulates
|
|
||||||
-- vertices which are part of a cycle, in the underlying
|
|
||||||
-- graph. The interface of this algorithm is made as an
|
|
||||||
-- iterator. A each step it is possible to know the
|
|
||||||
-- number of vertices, which are members of the current
|
|
||||||
-- Strong Components, and to visit each one. Strong
|
|
||||||
-- Components are visited in such an order than noone is
|
|
||||||
-- returned before an other which point to it.
|
|
||||||
|
|
||||||
|
|
||||||
uses ListOfInteger from TColStd,
|
|
||||||
ListOfSequenceOfInteger from GraphTools,
|
|
||||||
ListIteratorOfListOfSequenceOfInteger from GraphTools
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard,
|
|
||||||
DomainError from Standard
|
|
||||||
|
|
||||||
|
|
||||||
private class SCMap instantiates IndexedDataMap from TCollection
|
|
||||||
(Vertex,Integer,VHasher);
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
---Purpose: Create an empty algorithm.
|
|
||||||
returns SortedStrgCmptsFromIterator from GraphTools;
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex)
|
|
||||||
---Purpose: Add <V> as initial condition. This method is
|
|
||||||
-- cumulative. Use Perform method before visting the
|
|
||||||
-- result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
raises DomainError from Standard;
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Reset the algorithm. It may be reused with new
|
|
||||||
-- conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph);
|
|
||||||
---Purpose: Peform the algorithm in <G> from initial setted
|
|
||||||
-- conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More(me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Purpose: returns True if there are others strong
|
|
||||||
-- components.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next(me : in out)
|
|
||||||
---Purpose: Set the iterator to the next strong component.
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
NbVertices (me)
|
|
||||||
returns Integer from Standard
|
|
||||||
---Purpose: Returns number of vertices of the current Strong
|
|
||||||
-- Components.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Value(me; index : Integer from Standard)
|
|
||||||
returns any Vertex
|
|
||||||
---Purpose: returns the vertex of index <I> of the current
|
|
||||||
-- Strong Component.
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const &
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Visit (me : in out; k : Integer from Standard;
|
|
||||||
G : Graph)
|
|
||||||
---Level: Internal
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
-- conditions
|
|
||||||
myVertices : SCMap from GraphTools;
|
|
||||||
-- algorithm
|
|
||||||
myNowIndex : Integer from Standard;
|
|
||||||
myStack : ListOfInteger from TColStd;
|
|
||||||
-- result
|
|
||||||
mySort : ListOfSequenceOfInteger from GraphTools;
|
|
||||||
myIterator : ListIteratorOfListOfSequenceOfInteger from GraphTools;
|
|
||||||
|
|
||||||
end SortedStrgCmptsFromIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,200 +0,0 @@
|
|||||||
// Created on: 1991-10-23
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_DomainError.hxx>
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <TColStd_SequenceOfInteger.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_SortedStrgCmptsFromIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_SortedStrgCmptsFromIterator::
|
|
||||||
GraphTools_SortedStrgCmptsFromIterator ()
|
|
||||||
{
|
|
||||||
myNowIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsFromIterator::FromVertex (const Vertex& V)
|
|
||||||
{
|
|
||||||
#ifdef DEB
|
|
||||||
Standard_Integer index =
|
|
||||||
#endif
|
|
||||||
myVertices.Add (V,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsFromIterator::Perform (const Graph& G)
|
|
||||||
{
|
|
||||||
myNowIndex = 0;
|
|
||||||
mySort.Clear();
|
|
||||||
Standard_Integer visited;
|
|
||||||
Standard_Integer temp;
|
|
||||||
Standard_Integer index = 1;
|
|
||||||
while (index <= myVertices.Extent()) {
|
|
||||||
visited = myVertices.FindFromIndex(index);
|
|
||||||
if (visited == 0) temp = Visit(index,G);
|
|
||||||
index ++;
|
|
||||||
}
|
|
||||||
myIterator.Initialize(mySort);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsFromIterator::Reset ()
|
|
||||||
{
|
|
||||||
myVertices.Clear();
|
|
||||||
myNowIndex = 0;
|
|
||||||
myStack.Clear();
|
|
||||||
mySort.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose : declenche l'algorithme de recherche des Strong Components
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_SortedStrgCmptsFromIterator::More() const
|
|
||||||
{
|
|
||||||
return myIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsFromIterator::Next()
|
|
||||||
{
|
|
||||||
myIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_SortedStrgCmptsFromIterator::NbVertices() const
|
|
||||||
{
|
|
||||||
return myIterator.Value().Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_SortedStrgCmptsFromIterator::Value
|
|
||||||
(const Standard_Integer I) const
|
|
||||||
{
|
|
||||||
Standard_Integer indexvertex = myIterator.Value().Value(I);
|
|
||||||
return myVertices.FindKey (indexvertex);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Visit
|
|
||||||
//purpose : private
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_SortedStrgCmptsFromIterator::Visit
|
|
||||||
(const Standard_Integer k, const Graph& G)
|
|
||||||
{
|
|
||||||
Standard_Integer MIN;
|
|
||||||
Standard_Integer M;
|
|
||||||
myNowIndex++;
|
|
||||||
myVertices(k) = myNowIndex;
|
|
||||||
MIN = myNowIndex;
|
|
||||||
myStack.Prepend(k);
|
|
||||||
Standard_Integer currentVisited;
|
|
||||||
currentVisited = myVertices.FindFromIndex (k);
|
|
||||||
Standard_Integer adjacentIndex;
|
|
||||||
Standard_Integer adjacentVisited;
|
|
||||||
for (VIterator itV (G,myVertices.FindKey(k)); itV.More(); itV.Next()) {
|
|
||||||
adjacentIndex = myVertices.FindIndex(itV.Value());
|
|
||||||
if (adjacentIndex == 0) {
|
|
||||||
adjacentIndex = myVertices.Add (itV.Value(),0);
|
|
||||||
adjacentVisited = 0;
|
|
||||||
}
|
|
||||||
else adjacentVisited = myVertices.FindFromIndex (adjacentIndex);
|
|
||||||
if (adjacentVisited == 0) M = Visit(adjacentIndex,G);
|
|
||||||
else M = adjacentVisited;
|
|
||||||
if (M < MIN) MIN = M;
|
|
||||||
}
|
|
||||||
if (MIN == currentVisited) {
|
|
||||||
TColStd_SequenceOfInteger theSequence;
|
|
||||||
mySort.Prepend(theSequence);
|
|
||||||
TColStd_SequenceOfInteger& newSC = mySort.First();
|
|
||||||
Standard_Boolean more;
|
|
||||||
do {
|
|
||||||
newSC.Append(myStack.First());
|
|
||||||
myVertices(myStack.First()) = IntegerLast();
|
|
||||||
more = myStack.First() != k;
|
|
||||||
myStack.RemoveFirst() ;
|
|
||||||
}
|
|
||||||
while (more);
|
|
||||||
}
|
|
||||||
return MIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
|||||||
-- Created on: 1991-10-23
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class SortedStrgCmptsIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
GIterator as any;
|
|
||||||
SSCIterator as any)
|
|
||||||
|
|
||||||
--generic class SortedStrgCmptsIterator from GraphTools
|
|
||||||
-- (Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- GIterator as GraphIterator (Graph,Vertex))
|
|
||||||
-- SSCIterator as SortedStrgCmptsFromIterator
|
|
||||||
|
|
||||||
---Purposes: This generic class implements the
|
|
||||||
-- SortedStrgCptsFromIterator with all vertices of <G>
|
|
||||||
-- reached by the Tool GIterator.
|
|
||||||
|
|
||||||
raises NoMoreObject from Standard,
|
|
||||||
NoSuchObject from Standard
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
|
|
||||||
Create
|
|
||||||
returns SortedStrgCmptsIterator from GraphTools;
|
|
||||||
---Purpose: Create an empty algorithm.
|
|
||||||
|
|
||||||
Create (G : Graph)
|
|
||||||
---Purpose: Create the algorithm setting each vertex of <G>
|
|
||||||
-- reached by GIterator tool, as initial conditions.
|
|
||||||
-- Use Perform method before visting the result of
|
|
||||||
-- the algorithm.
|
|
||||||
returns SortedStrgCmptsIterator from GraphTools;
|
|
||||||
|
|
||||||
FromGraph (me : in out; G : Graph);
|
|
||||||
---Purpose: Add each vertex of <G> reached by GIterator tool
|
|
||||||
-- as initial conditions. Use Perform method
|
|
||||||
-- before visiting the result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex);
|
|
||||||
---Purpose: Add <V> as initial condition. This method is
|
|
||||||
-- cumulative. Use Perform method before visting the
|
|
||||||
-- result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Reset the algorithm. It may be reused with new
|
|
||||||
-- initial conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph);
|
|
||||||
---Purpose: Peform the algorithm in <G> from initial setted
|
|
||||||
-- conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More(me) returns Boolean from Standard;
|
|
||||||
---Purpose: returns True if there are others strong
|
|
||||||
-- components.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next(me : in out)
|
|
||||||
---Purpose: Set the iterator to the next strong component.
|
|
||||||
---Level: Public
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
|
|
||||||
NbVertices (me) returns Integer from Standard
|
|
||||||
---Purpose: Returns number of vertices of the current Strong
|
|
||||||
-- Components.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
Value(me; I : Integer from Standard)
|
|
||||||
returns any Vertex
|
|
||||||
---Purpose: returns the vertex of index <I> of the current
|
|
||||||
-- Strong Component.
|
|
||||||
---C++: return const &
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myIterator : SSCIterator;
|
|
||||||
|
|
||||||
end SortedStrgCmptsIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
|||||||
// Created on: 1991-10-23
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_SortedStrgCmptsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_SortedStrgCmptsIterator::GraphTools_SortedStrgCmptsIterator ()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_SortedStrgCmptsIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_SortedStrgCmptsIterator::GraphTools_SortedStrgCmptsIterator
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
FromGraph(G);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsIterator::FromVertex
|
|
||||||
(const Vertex& V)
|
|
||||||
{
|
|
||||||
myIterator.FromVertex(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsIterator::FromGraph
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
for ( GIterator it (G); it.More(); it.Next() ) {
|
|
||||||
myIterator.FromVertex(it.Value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsIterator::Perform
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
myIterator.Perform(G);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsIterator::Reset ()
|
|
||||||
{
|
|
||||||
myIterator.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_SortedStrgCmptsIterator::More() const
|
|
||||||
{
|
|
||||||
return myIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_SortedStrgCmptsIterator::Next()
|
|
||||||
{
|
|
||||||
myIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbVertices
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_SortedStrgCmptsIterator::NbVertices() const
|
|
||||||
{
|
|
||||||
return myIterator.NbVertices();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_SortedStrgCmptsIterator::Value
|
|
||||||
(const Standard_Integer I) const
|
|
||||||
{
|
|
||||||
return myIterator.Value(I);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
-- Created on: 1993-09-28
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1993-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
class TSNode from GraphTools
|
|
||||||
|
|
||||||
uses SequenceOfInteger from TColStd
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create returns TSNode from GraphTools;
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
|
|
||||||
IncreaseRef (me : in out);
|
|
||||||
|
|
||||||
DecreaseRef (me : in out);
|
|
||||||
|
|
||||||
NbRef (me) returns Integer from Standard;
|
|
||||||
|
|
||||||
AddSuccessor (me : in out; s : Integer from Standard);
|
|
||||||
|
|
||||||
NbSuccessors (me) returns Integer from Standard;
|
|
||||||
|
|
||||||
GetSuccessor (me; index : Integer from Standard)
|
|
||||||
returns Integer from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
referenceCount : Integer from Standard;
|
|
||||||
mySuccessors : SequenceOfInteger from TColStd;
|
|
||||||
|
|
||||||
end TSNode;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
|||||||
// Created on: 1991-06-20
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <GraphTools_TSNode.ixx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_TSNode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
GraphTools_TSNode::GraphTools_TSNode ()
|
|
||||||
{
|
|
||||||
referenceCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TSNode::Reset ()
|
|
||||||
{
|
|
||||||
referenceCount = 0;
|
|
||||||
mySuccessors.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IncreaseRef
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TSNode::IncreaseRef() { referenceCount++; }
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : DecreaseRef
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TSNode::DecreaseRef() { referenceCount--; }
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbRef
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_TSNode::NbRef() const
|
|
||||||
{
|
|
||||||
return referenceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AddSuccessor
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TSNode::AddSuccessor(const Standard_Integer s)
|
|
||||||
{
|
|
||||||
mySuccessors.Append(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : NbSuccessors
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_TSNode::NbSuccessors() const
|
|
||||||
{
|
|
||||||
return mySuccessors.Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetSuccessor
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Integer GraphTools_TSNode::GetSuccessor
|
|
||||||
(const Standard_Integer index) const
|
|
||||||
{
|
|
||||||
return mySuccessors(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,114 +0,0 @@
|
|||||||
-- Created on: 1992-12-24
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class TopologicalSortFromIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
VHasher as any;
|
|
||||||
VIterator as any)
|
|
||||||
|
|
||||||
--generic class TopologicalSortFromIterator from GraphTools
|
|
||||||
-- (Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- VHasher as MapHasher from TCollection (Vertex);
|
|
||||||
-- VIterator as VertexIterator (Graph,Vertex))
|
|
||||||
|
|
||||||
---Purpose: This generic class defines an iterator to visit
|
|
||||||
-- each vertex of the underlying graph, in such an
|
|
||||||
-- order that noone vertex is reach before any vertex
|
|
||||||
-- that point to it. In general the order produced by
|
|
||||||
-- topological sort is not unique. Usefull for DAG
|
|
||||||
-- Topological Sort. The option <ignoreSelfLoop>
|
|
||||||
-- allows the user to ignore (or not) any vertex wich
|
|
||||||
-- contains a self loop. The option <processCycle>
|
|
||||||
-- allows the user to visit (or not> vertices which
|
|
||||||
-- are in a cycle.
|
|
||||||
|
|
||||||
|
|
||||||
uses SequenceOfInteger from TColStd
|
|
||||||
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
NoMoreObject from Standard,
|
|
||||||
DomainError from Standard
|
|
||||||
|
|
||||||
private class TSMap instantiates IndexedDataMap from TCollection
|
|
||||||
(Vertex,TSNode from GraphTools,VHasher);
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
---Purpose: Create an empty algorithm.
|
|
||||||
returns TopologicalSortFromIterator from GraphTools;
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex);
|
|
||||||
---Purpose: Add <V> as initial condition. This method is
|
|
||||||
-- cumulative. Use Perform method before visting the
|
|
||||||
-- result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Reset the algorithm. It may be reused with new
|
|
||||||
-- initial conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph;
|
|
||||||
ignoreSelfLoop : Boolean from Standard;
|
|
||||||
processCycle : Boolean from Standard);
|
|
||||||
---Purpose: Peform the algorithm in <G> from initial setted
|
|
||||||
-- conditions according to the two following flags.
|
|
||||||
-- * <ignoreSelfLoop> allows the user to ignore (or
|
|
||||||
-- not) any vertex wich contains a self loop.
|
|
||||||
-- * <processCycle> allows the user to visit (or not>
|
|
||||||
-- vertex which is in a cycle.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me)
|
|
||||||
returns any Vertex
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const &
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
IsInCycle (me)
|
|
||||||
returns Boolean from Standard
|
|
||||||
---Purpose: Returns TRUE if the current vertex is in a cycle.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
-- conditions
|
|
||||||
myVertices : TSMap from GraphTools;
|
|
||||||
myIgnoreSelfLoop : Boolean from Standard;
|
|
||||||
myProcessCycle : Boolean from Standard;
|
|
||||||
-- result
|
|
||||||
mySort : SequenceOfInteger from TColStd;
|
|
||||||
myCycles : Integer from Standard;
|
|
||||||
myCurrent : Integer from Standard;
|
|
||||||
|
|
||||||
end TopologicalSortFromIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,225 +0,0 @@
|
|||||||
// Created on: 1991-05-29
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
#include <Standard_NoMoreObject.hxx>
|
|
||||||
#include <Standard_NoSuchObject.hxx>
|
|
||||||
#include <Standard_DomainError.hxx>
|
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
|
||||||
#include <GraphTools_TSNode.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_TopologicalSortFromIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_TopologicalSortFromIterator::GraphTools_TopologicalSortFromIterator () {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortFromIterator::FromVertex (const Vertex& V)
|
|
||||||
{
|
|
||||||
GraphTools_TSNode newnode;
|
|
||||||
myVertices.Add(V,newnode);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortFromIterator::Perform
|
|
||||||
(const Graph& G,
|
|
||||||
const Standard_Boolean ignoreSelfLoop,
|
|
||||||
const Standard_Boolean processCycle)
|
|
||||||
{
|
|
||||||
myIgnoreSelfLoop = ignoreSelfLoop;
|
|
||||||
myProcessCycle = processCycle;
|
|
||||||
myCurrent = 1;
|
|
||||||
mySort.Clear();
|
|
||||||
// algorithm DS
|
|
||||||
Standard_Integer i, indexcurrent, indexadjacent, nbadjacent;
|
|
||||||
indexcurrent = 1;
|
|
||||||
while (indexcurrent <= myVertices.Extent()) {
|
|
||||||
VIterator itV (G,myVertices.FindKey(indexcurrent));
|
|
||||||
for ( ; itV.More(); itV.Next()) {
|
|
||||||
indexadjacent = myVertices.FindIndex(itV.Value());
|
|
||||||
if (indexadjacent == 0) {
|
|
||||||
GraphTools_TSNode newnode;
|
|
||||||
indexadjacent = myVertices.Add(itV.Value(),newnode);
|
|
||||||
}
|
|
||||||
if (! (indexcurrent == indexadjacent && myIgnoreSelfLoop)) {
|
|
||||||
myVertices(indexcurrent).AddSuccessor(indexadjacent);
|
|
||||||
myVertices(indexadjacent).IncreaseRef();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
indexcurrent++;
|
|
||||||
}
|
|
||||||
// current root vertices queue
|
|
||||||
TColStd_ListOfInteger processQueue;
|
|
||||||
Standard_Integer nbVertices = myVertices.Extent();
|
|
||||||
for (i = 1 ; i <= nbVertices; i++) {
|
|
||||||
if (myVertices(i).NbRef() == 0) processQueue.Append(i);
|
|
||||||
}
|
|
||||||
// acyclic processing
|
|
||||||
while (!processQueue.IsEmpty()) {
|
|
||||||
indexcurrent = processQueue.First();
|
|
||||||
mySort.Append(indexcurrent);
|
|
||||||
nbadjacent = myVertices(indexcurrent).NbSuccessors();
|
|
||||||
for (i = 1; i <= nbadjacent; i++) {
|
|
||||||
indexadjacent = myVertices(indexcurrent).GetSuccessor(i);
|
|
||||||
myVertices(indexadjacent).DecreaseRef();
|
|
||||||
if (myVertices(indexadjacent).NbRef() == 0) {
|
|
||||||
processQueue.Append(indexadjacent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
processQueue.RemoveFirst();
|
|
||||||
}
|
|
||||||
// cyclic processing
|
|
||||||
myCycles = mySort.Length() + 1;
|
|
||||||
if (myProcessCycle) {
|
|
||||||
for (i = 1 ; i <= nbVertices; i++) {
|
|
||||||
if (myVertices(i).NbRef() != 0) mySort.Append(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortFromIterator::Reset ()
|
|
||||||
{
|
|
||||||
myVertices.Clear();
|
|
||||||
// myIgnoreSelfLoop : Boolean from Standard;
|
|
||||||
// myProcessCycle : Boolean from Standard;
|
|
||||||
mySort.Clear();
|
|
||||||
// myCycles : Integer from Standard;
|
|
||||||
myCurrent = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_TopologicalSortFromIterator::More () const
|
|
||||||
{
|
|
||||||
return myCurrent <= mySort.Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortFromIterator::Next ()
|
|
||||||
{
|
|
||||||
if (!More()) Standard_NoMoreObject::Raise();
|
|
||||||
myCurrent ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_TopologicalSortFromIterator::Value () const {
|
|
||||||
if (!More()) Standard_NoSuchObject::Raise();
|
|
||||||
return myVertices.FindKey (mySort(myCurrent));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsInCycle
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_TopologicalSortFromIterator::IsInCycle () const
|
|
||||||
{
|
|
||||||
if (!More()) Standard_NoSuchObject::Raise();
|
|
||||||
return myCurrent >= myCycles;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
|||||||
-- Created on: 1992-12-24
|
|
||||||
-- Created by: Denis PASCAL
|
|
||||||
-- Copyright (c) 1992-1999 Matra Datavision
|
|
||||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
--
|
|
||||||
-- This file is part of Open CASCADE Technology software library.
|
|
||||||
--
|
|
||||||
-- This library is free software; you can redistribute it and/or modify it under
|
|
||||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
-- by the Free Software Foundation, with special exception defined in the file
|
|
||||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
--
|
|
||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
-- commercial license or contractual agreement.
|
|
||||||
|
|
||||||
generic class TopologicalSortIterator from GraphTools
|
|
||||||
(Graph as any;
|
|
||||||
Vertex as any;
|
|
||||||
GIterator as any;
|
|
||||||
TSIterator as any)
|
|
||||||
|
|
||||||
--generic class TopologicalSorIterator from GraphTools
|
|
||||||
-- (Graph as any;
|
|
||||||
-- Vertex as any;
|
|
||||||
-- GIterator as GraphIterator (Graph,Vertex))
|
|
||||||
-- TSIterator as TopologicalSortFromIterator
|
|
||||||
|
|
||||||
---Purpose: This generic class defines an iterator to visit
|
|
||||||
-- each vertex of the underlying graph, in such an
|
|
||||||
-- order that noone vertex is reach before any vertex
|
|
||||||
-- that point to it. In general the order produced by
|
|
||||||
-- topological sort is not unique. Usefull for DAG
|
|
||||||
-- Topological Sort.
|
|
||||||
|
|
||||||
raises NoSuchObject from Standard,
|
|
||||||
NoMoreObject from Standard
|
|
||||||
|
|
||||||
|
|
||||||
is
|
|
||||||
|
|
||||||
Create
|
|
||||||
---Purpose: Create an empty algorithm.
|
|
||||||
returns TopologicalSortIterator from GraphTools;
|
|
||||||
|
|
||||||
Create (G : Graph)
|
|
||||||
---Purpose: Create the algorithm setting each vertex of <G>
|
|
||||||
-- reached by GIterator tool, as initial conditions.
|
|
||||||
-- Use Perform method before visting the result of
|
|
||||||
-- the algorithm.
|
|
||||||
returns TopologicalSortIterator from GraphTools;
|
|
||||||
|
|
||||||
FromGraph (me : in out; G : Graph);
|
|
||||||
---Purpose: Add each vertex of <G> reached by GIterator tool
|
|
||||||
-- as initial conditions. Use Perform method
|
|
||||||
-- before visiting the result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
FromVertex (me : in out; V : Vertex);
|
|
||||||
---Purpose: Add <V> as initial condition. This method is
|
|
||||||
-- cumulative. Use Perform method before visting the
|
|
||||||
-- result of the algorithm.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Reset (me : in out);
|
|
||||||
---Purpose: Reset the algorithm. It may be reused with new
|
|
||||||
-- initial conditions.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Perform (me : in out; G : Graph ;
|
|
||||||
ignoreSelfLoop : Boolean from Standard;
|
|
||||||
processCycle : Boolean from Standard);
|
|
||||||
---Purpose: Peform the algorithm in <G> from initial setted
|
|
||||||
-- conditions according to the two following flags.
|
|
||||||
-- * <ignoreSelfLoop> allows the user to ignore (or
|
|
||||||
-- not) any vertex wich contains a self loop.
|
|
||||||
-- * <processCycle> allows the user to visit (or not>
|
|
||||||
-- vertex which is in a cycle.
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
More (me)
|
|
||||||
returns Boolean from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Next (me : in out)
|
|
||||||
raises NoMoreObject from Standard;
|
|
||||||
---Level: Public
|
|
||||||
|
|
||||||
Value (me) returns any Vertex
|
|
||||||
---Level: Public
|
|
||||||
---C++: return const &
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
IsInCycle (me) returns Boolean from Standard
|
|
||||||
---Purpose: Returns TRUE if the current vertex is in a cycle.
|
|
||||||
---Level: Public
|
|
||||||
raises NoSuchObject from Standard;
|
|
||||||
|
|
||||||
fields
|
|
||||||
|
|
||||||
myIterator : TSIterator;
|
|
||||||
|
|
||||||
end TopologicalSortIterator;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
|||||||
// Created on: 1991-05-29
|
|
||||||
// Created by: Denis PASCAL
|
|
||||||
// Copyright (c) 1991-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
// <dp>
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_TopologicalSortIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_TopologicalSortIterator::GraphTools_TopologicalSortIterator ()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GraphTools_TopologicalSortIterator
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
GraphTools_TopologicalSortIterator::GraphTools_TopologicalSortIterator
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
FromGraph (G);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromVertex
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortIterator::FromVertex
|
|
||||||
(const Vertex& V)
|
|
||||||
{
|
|
||||||
myIterator.FromVertex(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FromGraph
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortIterator::FromGraph
|
|
||||||
(const Graph& G)
|
|
||||||
{
|
|
||||||
for ( GIterator it (G); it.More(); it.Next() ) {
|
|
||||||
myIterator.FromVertex(it.Value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Perform
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortIterator::Perform
|
|
||||||
(const Graph& G,
|
|
||||||
const Standard_Boolean ignoreSelfLoops,
|
|
||||||
const Standard_Boolean processCycle)
|
|
||||||
{
|
|
||||||
myIterator.Perform(G,ignoreSelfLoops,processCycle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Reset
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortIterator::Reset ()
|
|
||||||
{
|
|
||||||
myIterator.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : More
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_TopologicalSortIterator::More () const
|
|
||||||
{
|
|
||||||
return myIterator.More();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Next
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void GraphTools_TopologicalSortIterator::Next ()
|
|
||||||
{
|
|
||||||
myIterator.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Value
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
const Vertex& GraphTools_TopologicalSortIterator::Value () const
|
|
||||||
{
|
|
||||||
return myIterator.Value();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsInCycle
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean GraphTools_TopologicalSortIterator::IsInCycle () const
|
|
||||||
{
|
|
||||||
return myIterator.IsInCycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user