mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
290
src/Dynamic/Dynamic.cdl
Executable file
290
src/Dynamic/Dynamic.cdl
Executable file
@@ -0,0 +1,290 @@
|
||||
-- File: Dynamic.cdl
|
||||
-- Created: Fri Jan 22 11:14:25 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
generic class EnumerationParameter;
|
||||
|
||||
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;
|
||||
|
||||
generic class MethodInstance;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
45
src/Dynamic/Dynamic.cxx
Executable file
45
src/Dynamic/Dynamic.cxx
Executable file
@@ -0,0 +1,45 @@
|
||||
// File: Dynamic.cxx
|
||||
// Created: Wed Aug 31 15:24:04 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
// 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)
|
||||
{
|
||||
#ifdef DEB
|
||||
Dynamic_ModeEnum aMode;
|
||||
#else
|
||||
Dynamic_ModeEnum aMode=Dynamic_IN;
|
||||
#endif
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
39
src/Dynamic/Dynamic_AbstractVariableInstance.cdl
Executable file
39
src/Dynamic/Dynamic_AbstractVariableInstance.cdl
Executable file
@@ -0,0 +1,39 @@
|
||||
-- File: Dynamic_AbstractVariableInstance.cdl
|
||||
-- Created: Mon Sep 5 15:02:15 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
26
src/Dynamic/Dynamic_AbstractVariableInstance.cxx
Executable file
26
src/Dynamic/Dynamic_AbstractVariableInstance.cxx
Executable file
@@ -0,0 +1,26 @@
|
||||
// File: Dynamic_AbstractVariableInstance.cxx
|
||||
// Created: Mon Sep 5 15:06:46 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
#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)& )
|
||||
{
|
||||
}
|
||||
|
79
src/Dynamic/Dynamic_BooleanParameter.cdl
Executable file
79
src/Dynamic/Dynamic_BooleanParameter.cdl
Executable file
@@ -0,0 +1,79 @@
|
||||
-- File: Dynamic_BooleanParameter.cdl
|
||||
-- Created: Mon Jan 24 13:33:06 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@meteox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
88
src/Dynamic/Dynamic_BooleanParameter.cxx
Executable file
88
src/Dynamic/Dynamic_BooleanParameter.cxx
Executable file
@@ -0,0 +1,88 @@
|
||||
// File: Dynamic_BooleanParameter.cxx
|
||||
// Created: Mon Jan 24 13:34:15 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@meteox>
|
||||
// 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;
|
||||
}
|
57
src/Dynamic/Dynamic_CompiledMethod.cdl
Executable file
57
src/Dynamic/Dynamic_CompiledMethod.cdl
Executable file
@@ -0,0 +1,57 @@
|
||||
-- File: Dynamic_CompiledMethod.cdl
|
||||
-- Created: Thu Jan 28 14:59:01 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
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;
|
40
src/Dynamic/Dynamic_CompiledMethod.cxx
Executable file
40
src/Dynamic/Dynamic_CompiledMethod.cxx
Executable file
@@ -0,0 +1,40 @@
|
||||
// File: Dynamic_CompiledMethod.cxx
|
||||
// Created: Thu Jan 28 15:07:26 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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();
|
||||
}
|
77
src/Dynamic/Dynamic_CompositMethod.cdl
Executable file
77
src/Dynamic/Dynamic_CompositMethod.cdl
Executable file
@@ -0,0 +1,77 @@
|
||||
-- File: Dynamic_CompositMethod.cdl
|
||||
-- Created: Fri Aug 26 10:30:08 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
69
src/Dynamic/Dynamic_CompositMethod.cxx
Executable file
69
src/Dynamic/Dynamic_CompositMethod.cxx
Executable file
@@ -0,0 +1,69 @@
|
||||
// File: Dynamic_CompositMethod.cxx
|
||||
// Created: Fri Aug 26 11:35:39 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
// 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;
|
||||
}
|
||||
}
|
52
src/Dynamic/Dynamic_CompositVariableInstance.cdl
Executable file
52
src/Dynamic/Dynamic_CompositVariableInstance.cdl
Executable file
@@ -0,0 +1,52 @@
|
||||
-- File: Dynamic_CompositVariableInstance.cdl
|
||||
-- Created: Mon Sep 5 15:02:15 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
37
src/Dynamic/Dynamic_CompositVariableInstance.cxx
Executable file
37
src/Dynamic/Dynamic_CompositVariableInstance.cxx
Executable file
@@ -0,0 +1,37 @@
|
||||
// File: Dynamic_CompositVariableInstance.cxx
|
||||
// Created: Mon Sep 5 15:06:46 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
#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;
|
||||
}
|
102
src/Dynamic/Dynamic_DynamicClass.cdl
Executable file
102
src/Dynamic/Dynamic_DynamicClass.cdl
Executable file
@@ -0,0 +1,102 @@
|
||||
-- File: Dynamic_DynamicClass.cdl
|
||||
-- Created: Fri Jan 22 11:41:34 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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 ;
|
127
src/Dynamic/Dynamic_DynamicClass.cxx
Executable file
127
src/Dynamic/Dynamic_DynamicClass.cxx
Executable file
@@ -0,0 +1,127 @@
|
||||
// File: Dynamic_DynamicClass.cxx
|
||||
// Created: Fri Jan 22 11:45:20 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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
|
||||
{}
|
68
src/Dynamic/Dynamic_DynamicDerivedClass.cdl
Executable file
68
src/Dynamic/Dynamic_DynamicDerivedClass.cdl
Executable file
@@ -0,0 +1,68 @@
|
||||
-- File: Dynamic_DynamicDerivedClass.cdl
|
||||
-- Created: Fri Feb 5 10:09:23 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
67
src/Dynamic/Dynamic_DynamicDerivedClass.cxx
Executable file
67
src/Dynamic/Dynamic_DynamicDerivedClass.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
// File: Dynamic_DynamicDerivedClass.cxx
|
||||
// Created: Fri Feb 5 10:14:00 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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;
|
||||
}
|
123
src/Dynamic/Dynamic_DynamicInstance.cdl
Executable file
123
src/Dynamic/Dynamic_DynamicInstance.cdl
Executable file
@@ -0,0 +1,123 @@
|
||||
-- File: Dynamic_DynamicInstance.cdl
|
||||
-- Created: Fri Jan 22 11:41:34 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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 ;
|
171
src/Dynamic/Dynamic_DynamicInstance.cxx
Executable file
171
src/Dynamic/Dynamic_DynamicInstance.cxx
Executable file
@@ -0,0 +1,171 @@
|
||||
// File: Dynamic_DynamicInstance.cxx
|
||||
// Created: Fri Jan 22 11:45:20 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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);*/
|
||||
}
|
||||
}
|
||||
|
93
src/Dynamic/Dynamic_EnumerationParameter.cdl
Executable file
93
src/Dynamic/Dynamic_EnumerationParameter.cdl
Executable file
@@ -0,0 +1,93 @@
|
||||
-- File: Dynamic_EnumerationParameter.cdl
|
||||
-- Created: Thu Feb 3 14:44:37 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@metrox>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
generic class EnumerationParameter from Dynamic (Enum as any)
|
||||
|
||||
inherits
|
||||
|
||||
Parameter from Dynamic
|
||||
|
||||
---Purpose: This generic class defines a parameter with a given
|
||||
-- enumeration. For correct use an instanciation of this
|
||||
-- class, the Convert method must be defined. This
|
||||
-- method is automaticaly called by the constructor which
|
||||
-- takes a CString as value for the enumeration. The
|
||||
-- prototype of the Convert method must be described as
|
||||
-- follows :
|
||||
--
|
||||
-- void Convert(const Standard_CString,Enum);
|
||||
--
|
||||
-- The prototype and the body of this method, can be
|
||||
-- written in the file <mypackage.cxx> where the
|
||||
-- enumeration is described. No declaration of the
|
||||
-- Convert method in any .cdl file is necessary.
|
||||
|
||||
|
||||
uses
|
||||
CString from Standard,
|
||||
OStream from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(aparameter : CString from Standard)
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Creates an EnumerationParameter of <aparameter> as
|
||||
-- name.
|
||||
|
||||
returns mutable EnumerationParameter from Dynamic;
|
||||
|
||||
Create(aparameter : CString from Standard; avalue : Enum)
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Creates an EnumerationParameter of <aparameter> as
|
||||
-- name and <avalue> as value.
|
||||
|
||||
returns mutable EnumerationParameter from Dynamic;
|
||||
|
||||
Create(aparameter , avalue : CString from Standard)
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Creates an EnumerationParameter of <aparameter> as
|
||||
-- name and <avalue> as value. The user has to define a
|
||||
-- Convert method to translate the string <avalue> in an
|
||||
-- enumeration term.
|
||||
|
||||
returns mutable EnumerationParameter from Dynamic;
|
||||
|
||||
Value(me) returns Enum
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Returns the enumeration value <thevalue>.
|
||||
|
||||
is static;
|
||||
|
||||
Value (me : mutable ; avalue : Enum)
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Sets the field <thevalue> with the enumeration value <avalue>
|
||||
|
||||
is static;
|
||||
|
||||
Dump(me ; astream : in out OStream from Standard)
|
||||
|
||||
---Level: Internal
|
||||
|
||||
---Purpose: useful for debugging.
|
||||
|
||||
is redefined;
|
||||
|
||||
fields
|
||||
|
||||
thevalue : Enum;
|
||||
|
||||
end EnumerationParameter;
|
74
src/Dynamic/Dynamic_EnumerationParameter.gxx
Executable file
74
src/Dynamic/Dynamic_EnumerationParameter.gxx
Executable file
@@ -0,0 +1,74 @@
|
||||
// File: Dynamic_EnumerationParameter.gxx
|
||||
// Created: Thu Feb 3 14:50:09 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@metrox>
|
||||
|
||||
|
||||
void String(const Standard_CString,Enum);
|
||||
|
||||
//=======================================================================
|
||||
//function : Dynamic_EnumerationParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Dynamic_EnumerationParameter::Dynamic_EnumerationParameter
|
||||
(const Standard_CString aparameter)
|
||||
: Dynamic_Parameter(aparameter)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dynamic_EnumerationParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Dynamic_EnumerationParameter::Dynamic_EnumerationParameter
|
||||
(const Standard_CString aparameter,
|
||||
const Enum& avalue)
|
||||
: Dynamic_Parameter(aparameter)
|
||||
{
|
||||
thevalue = avalue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dynamic_EnumerationParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Dynamic_EnumerationParameter::Dynamic_EnumerationParameter
|
||||
(const Standard_CString aparameter,
|
||||
const Standard_CString avalue)
|
||||
: Dynamic_Parameter(aparameter)
|
||||
{
|
||||
String(avalue,thevalue);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Enum Dynamic_EnumerationParameter::Value() const
|
||||
{
|
||||
return thevalue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Dynamic_EnumerationParameter::Value(const Enum& avalue)
|
||||
{
|
||||
thevalue = avalue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Dynamic_EnumerationParameter::Dump(Standard_OStream& astream) const
|
||||
{
|
||||
Dynamic_Parameter::Dump(astream);
|
||||
astream<<" "<<thevalue;
|
||||
}
|
204
src/Dynamic/Dynamic_FuzzyClass.cdl
Executable file
204
src/Dynamic/Dynamic_FuzzyClass.cdl
Executable file
@@ -0,0 +1,204 @@
|
||||
-- File: Dynamic_FuzzyClass.cdl
|
||||
-- Created: Fri Jan 22 11:41:34 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
350
src/Dynamic/Dynamic_FuzzyClass.cxx
Executable file
350
src/Dynamic/Dynamic_FuzzyClass.cxx
Executable file
@@ -0,0 +1,350 @@
|
||||
// File: Dynamic_FuzzyClass.cxx
|
||||
// Created: Fri Jan 22 11:45:20 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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
|
||||
{}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
57
src/Dynamic/Dynamic_FuzzyDefinition.cdl
Executable file
57
src/Dynamic/Dynamic_FuzzyDefinition.cdl
Executable file
@@ -0,0 +1,57 @@
|
||||
-- File: Dynamic_FuzzyDefinition.cdl
|
||||
-- Created: Fri Jan 22 11:41:34 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
38
src/Dynamic/Dynamic_FuzzyDefinition.cxx
Executable file
38
src/Dynamic/Dynamic_FuzzyDefinition.cxx
Executable file
@@ -0,0 +1,38 @@
|
||||
// File: Dynamic_FuzzyDefinition.cxx
|
||||
// Created: Fri Jan 22 11:45:20 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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
|
||||
{}
|
119
src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cdl
Executable file
119
src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cdl
Executable file
@@ -0,0 +1,119 @@
|
||||
-- File: FuzzyDefinitionsDictionary.cdl
|
||||
-- Created: Mon Jun 22 18:08:47 1992
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
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 : Integer from Standard ;
|
||||
thesequenceoffuzzydefinitions : SequenceOfFuzzyDefinitions from Dynamic ;
|
||||
|
||||
end FuzzyDefinitionsDictionary;
|
256
src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cxx
Executable file
256
src/Dynamic/Dynamic_FuzzyDefinitionsDictionary.cxx
Executable file
@@ -0,0 +1,256 @@
|
||||
// File: Dynamic_FuzzyDefinitionsDictionary.cxx
|
||||
// Created: Wed Jun 24 12:49:59 1992
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@phobox>
|
||||
// Historique :
|
||||
// CRD : 03/07/97 : Portage 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[255];
|
||||
char name[80];
|
||||
char type[80];
|
||||
char value[80],value1[80],value2[80],value3[80];
|
||||
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(;;)
|
||||
{
|
||||
for(i=0; i<255; i++) line[i] = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<80; i++)name[i]=0;
|
||||
|
||||
endline = 0;
|
||||
for(i=begin+1; i<=end-1; i++)name[endline++] = line[i];
|
||||
|
||||
for(i=0; i<80; i++)type [i] = 0;
|
||||
for(i=0; i<80; i++)value [i] = 0;
|
||||
for(i=0; i<80; i++)value1 [i] = 0;
|
||||
for(i=0; i<80; i++)value2 [i] = 0;
|
||||
for(i=0; i<80; i++)value3 [i] = 0;
|
||||
|
||||
// fr = sscanf(&line[end+1],"%s%80c",&type,&value);
|
||||
fr = sscanf(&line[end+1],"%s%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<<"Le parametre "<<aname<<" du type "<<atype<<" avec "<<avalue<<" n'existe pas."<<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);
|
||||
}
|
109
src/Dynamic/Dynamic_FuzzyInstance.cdl
Executable file
109
src/Dynamic/Dynamic_FuzzyInstance.cdl
Executable file
@@ -0,0 +1,109 @@
|
||||
-- File: Dynamic_FuzzyInstance.cdl
|
||||
-- Created: Thu Dec 23 17:26:53 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@mastox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
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;
|
229
src/Dynamic/Dynamic_FuzzyInstance.gxx
Executable file
229
src/Dynamic/Dynamic_FuzzyInstance.gxx
Executable file
@@ -0,0 +1,229 @@
|
||||
// File: Dynamic_FuzzyInstance.gxx
|
||||
// Created: Fri Dec 24 10:35:10 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@mastox>
|
||||
// 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();
|
||||
}
|
||||
}
|
73
src/Dynamic/Dynamic_InstanceParameter.cdl
Executable file
73
src/Dynamic/Dynamic_InstanceParameter.cdl
Executable file
@@ -0,0 +1,73 @@
|
||||
-- File: Dynamic_InstanceParameter.cdl
|
||||
-- Created: Wed Feb 3 15:49:43 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
60
src/Dynamic/Dynamic_InstanceParameter.cxx
Executable file
60
src/Dynamic/Dynamic_InstanceParameter.cxx
Executable file
@@ -0,0 +1,60 @@
|
||||
// File: Dynamic_InstanceParameter.cxx
|
||||
// Created: Wed Feb 3 15:54:02 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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);
|
||||
}
|
71
src/Dynamic/Dynamic_IntegerParameter.cdl
Executable file
71
src/Dynamic/Dynamic_IntegerParameter.cdl
Executable file
@@ -0,0 +1,71 @@
|
||||
-- File: Dynamic_IntegerParameter.cdl
|
||||
-- Created: Wed Feb 3 15:49:43 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
61
src/Dynamic/Dynamic_IntegerParameter.cxx
Executable file
61
src/Dynamic/Dynamic_IntegerParameter.cxx
Executable file
@@ -0,0 +1,61 @@
|
||||
// File: Dynamic_IntegerParameter.cxx
|
||||
// Created: Wed Feb 3 15:54:02 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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;
|
||||
}
|
54
src/Dynamic/Dynamic_InterpretedMethod.cdl
Executable file
54
src/Dynamic/Dynamic_InterpretedMethod.cdl
Executable file
@@ -0,0 +1,54 @@
|
||||
-- File: Dynamic_InterpretedMethod.cdl
|
||||
-- Created: Thu Jan 28 14:59:01 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
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;
|
40
src/Dynamic/Dynamic_InterpretedMethod.cxx
Executable file
40
src/Dynamic/Dynamic_InterpretedMethod.cxx
Executable file
@@ -0,0 +1,40 @@
|
||||
// File: Dynamic_InterpretedMethod.cxx
|
||||
// Created: Thu Jan 28 15:07:26 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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();
|
||||
}
|
113
src/Dynamic/Dynamic_Method.cdl
Executable file
113
src/Dynamic/Dynamic_Method.cdl
Executable file
@@ -0,0 +1,113 @@
|
||||
-- File: Dynamic_Method.cdl
|
||||
-- Created: Fri Jan 22 11:41:34 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
130
src/Dynamic/Dynamic_Method.cxx
Executable file
130
src/Dynamic/Dynamic_Method.cxx
Executable file
@@ -0,0 +1,130 @@
|
||||
// File: Dynamic_Method.cxx
|
||||
// Created: Fri Jan 22 11:45:20 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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;
|
||||
}
|
81
src/Dynamic/Dynamic_MethodDefinition.cdl
Executable file
81
src/Dynamic/Dynamic_MethodDefinition.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: Dynamic_MethodDefinition.cdl
|
||||
-- Created: Fri Jan 22 11:41:34 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
76
src/Dynamic/Dynamic_MethodDefinition.cxx
Executable file
76
src/Dynamic/Dynamic_MethodDefinition.cxx
Executable file
@@ -0,0 +1,76 @@
|
||||
// File: Dynamic_MethodDefinition.cxx
|
||||
// Created: Thu Aug 25 10:26:03 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
#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);
|
||||
}
|
127
src/Dynamic/Dynamic_MethodDefinitionsDictionary.cdl
Executable file
127
src/Dynamic/Dynamic_MethodDefinitionsDictionary.cdl
Executable file
@@ -0,0 +1,127 @@
|
||||
-- File: MethodDefinitionsDictionary.cdl
|
||||
-- Created: Mon Jun 22 18:08:47 1992
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@phobox>
|
||||
---Copyright: Matra Datavision 1992
|
||||
|
||||
|
||||
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 : Integer from Standard ;
|
||||
thesequenceofmethoddefinitions : SequenceOfMethodDefinitions from Dynamic ;
|
||||
|
||||
end MethodDefinitionsDictionary;
|
287
src/Dynamic/Dynamic_MethodDefinitionsDictionary.cxx
Executable file
287
src/Dynamic/Dynamic_MethodDefinitionsDictionary.cxx
Executable file
@@ -0,0 +1,287 @@
|
||||
// File: Dynamic_MethodDefinitionsDictionary.cxx
|
||||
// Created: Wed Jun 24 12:49:59 1992
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@phobox>
|
||||
// Historique :
|
||||
// CRD : 15/04/97 : Passage WOK++ : Remplacement de TYPE par STANDARD_TYPE
|
||||
// CRD : 03/07/97 : Portage 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[255];
|
||||
char name[80];
|
||||
char mode[80];
|
||||
char type[80];
|
||||
char value[80],value1[80],value2[80],value3[80];
|
||||
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(;;)
|
||||
{
|
||||
for(i=0; i<255; i++) line[i] = 0;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<80; i++)name[i]=0;
|
||||
|
||||
endline = 0;
|
||||
for(i=begin+1; i<=end-1; i++)name[endline++] = line[i];
|
||||
|
||||
for(i=0; i<80; i++)mode [i] = 0;
|
||||
for(i=0; i<80; i++)type [i] = 0;
|
||||
for(i=0; i<80; i++)value [i] = 0;
|
||||
for(i=0; i<80; i++)value1 [i] = 0;
|
||||
for(i=0; i<80; i++)value2 [i] = 0;
|
||||
for(i=0; i<80; i++)value3 [i] = 0;
|
||||
|
||||
// fr = sscanf(&line[end+1],"%s%s%80c",&mode,&type,&value);
|
||||
fr = sscanf(&line[end+1],"%s%s%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<<"la definition n'est pas une 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<<"Le parametre "<<aname<<" du type "<<atype<<" avec "<<avalue<<" n'existe pas."<<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);
|
||||
}
|
130
src/Dynamic/Dynamic_MethodInstance.cdl
Executable file
130
src/Dynamic/Dynamic_MethodInstance.cdl
Executable file
@@ -0,0 +1,130 @@
|
||||
-- File: Dynamic_MethodInstance.cdl
|
||||
-- Created: Thu Dec 23 17:26:53 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@mastox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
generic class MethodInstance from Dynamic (Dictionary as Transient)
|
||||
|
||||
inherits
|
||||
|
||||
Method from Dynamic
|
||||
|
||||
---Purpose: This class describes the facilities available to
|
||||
-- manipulate methods objects. It is a generic class
|
||||
-- because the creation of a MethodInstance requests
|
||||
-- a specific dictionary of definitions. In a method
|
||||
-- instance, it is only possible to set
|
||||
-- VariableInstance which are roughtly a copy of the
|
||||
-- variable set in the method definition and a
|
||||
-- pointer on the variable, describing the signature
|
||||
-- of the complex method in the process of build or
|
||||
-- addressing the user value.
|
||||
|
||||
uses
|
||||
|
||||
CString from Standard,
|
||||
OStream from Standard,
|
||||
Boolean from Standard,
|
||||
ModeEnum from Dynamic,
|
||||
Parameter from Dynamic,
|
||||
Variable from Dynamic,
|
||||
VariableNode from Dynamic,
|
||||
AsciiString from TCollection
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create(atype : CString from Standard) returns mutable MethodInstance from Dynamic;
|
||||
|
||||
---Level: Public
|
||||
|
||||
--- Purpose: Creates a MethodInstance object of the type <atype>.
|
||||
-- If <atype> is not defined in the dictionary, the object
|
||||
-- created will have no definition.
|
||||
|
||||
Create(amethodinstance : MethodInstance from Dynamic) returns mutable MethodInstance from Dynamic;
|
||||
|
||||
---Level: Public
|
||||
|
||||
--- Purpose: Creates a MethodInstance with as definition the method
|
||||
-- instance <amethodinstance>.
|
||||
|
||||
Type(me) returns AsciiString from TCollection
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Returns the type of object read in the definition.
|
||||
|
||||
is redefined;
|
||||
|
||||
Definition(me) returns Method from Dynamic
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Returns a reference to the definition of the
|
||||
-- MethodInstance.
|
||||
|
||||
is static;
|
||||
|
||||
Variable(me : mutable ; aparameter : Parameter from Dynamic
|
||||
; amode : ModeEnum from Dynamic
|
||||
; avariable : Variable from Dynamic)
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Creates and adds to the instance <me> the variable
|
||||
-- instance build with <aparameter> and <amode> and
|
||||
-- adresses the variable .
|
||||
|
||||
is static;
|
||||
|
||||
Value(me ; aname : CString from Standard
|
||||
; aparameter : out any Parameter from Dynamic
|
||||
; amode : out ModeEnum from Dynamic
|
||||
; avariable : out any Variable from Dynamic) returns Boolean
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Returns True, if there is a variable instance named
|
||||
-- <aname>, False otherwise. It returns in the argument
|
||||
-- <aparameter> the signature of the variable, in <amode>
|
||||
-- the variable is in, out, inout, internal or constant
|
||||
-- and in <avariable>, the reference to the effective
|
||||
-- value used by the instance or a reference to the
|
||||
-- variable defining the signature of the complex method
|
||||
-- using this instance of method.
|
||||
|
||||
is static;
|
||||
|
||||
Value(me ; aname : CString from Standard
|
||||
; aparameter : out any Parameter from Dynamic
|
||||
; amode : out ModeEnum from Dynamic
|
||||
; avariablenode : out any VariableNode from Dynamic) returns Boolean from Standard
|
||||
|
||||
---Level: Public
|
||||
|
||||
---Purpose: Returns True, if there is a variable instance named
|
||||
-- <aname>, False otherwise. It returns in the argument
|
||||
-- <aparameter> the signature of the variable, in <amode>
|
||||
-- the variable is in, out, inout, internal or constant
|
||||
-- and in <avariablenode>, the head of the effective
|
||||
-- referenced value used by the instance or the head of
|
||||
-- the variables reference defining the signature of the
|
||||
-- complex method using this instance of method.
|
||||
|
||||
is static;
|
||||
|
||||
Dump(me ; astream : in out OStream from Standard)
|
||||
|
||||
---Level: Internal
|
||||
|
||||
---Purpose: Useful for debugging.
|
||||
|
||||
is redefined;
|
||||
|
||||
fields
|
||||
|
||||
thedefinition : Method from Dynamic;
|
||||
|
||||
end MethodInstance;
|
204
src/Dynamic/Dynamic_MethodInstance.gxx
Executable file
204
src/Dynamic/Dynamic_MethodInstance.gxx
Executable file
@@ -0,0 +1,204 @@
|
||||
// File: Dynamic_MethodInstance.gxx
|
||||
// Created: Fri Dec 24 10:35:10 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@mastox>
|
||||
// CRD : 15/04/97 : Passage WOK++ : Remplacement de TYPE par STANDARD_TYPE
|
||||
|
||||
|
||||
#include <Dynamic_MethodDefinition.hxx>
|
||||
#include <Dynamic_SequenceOfMethodDefinitions.hxx>
|
||||
#include <Dynamic_VariableNode.hxx>
|
||||
#include <Dynamic_Variable.hxx>
|
||||
#include <Dynamic_VariableInstance.hxx>
|
||||
#include <Dynamic_CompositVariableInstance.hxx>
|
||||
#include <Dynamic_AbstractVariableInstance.hxx>
|
||||
|
||||
void DictionaryOfDefinitions(Handle(Dictionary)&);
|
||||
|
||||
//=======================================================================
|
||||
//function : Dynamic_MethodInstance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Dynamic_MethodInstance::Dynamic_MethodInstance(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_MethodInstance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Dynamic_MethodInstance::Dynamic_MethodInstance(const Handle(Dynamic_MethodInstance)& amethodinstance)
|
||||
{
|
||||
thedefinition = amethodinstance;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_AsciiString Dynamic_MethodInstance::Type() const
|
||||
{
|
||||
return Definition()->Type();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Definition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Dynamic_Method) Dynamic_MethodInstance::Definition() const
|
||||
{
|
||||
Handle(Dynamic_MethodInstance) definition;
|
||||
|
||||
if(thedefinition->IsKind(STANDARD_TYPE(Dynamic_MethodDefinition)))
|
||||
{
|
||||
return thedefinition;
|
||||
}
|
||||
else
|
||||
{
|
||||
definition = *(Handle_Dynamic_MethodInstance*)&thedefinition;
|
||||
return definition->Definition();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Variable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Dynamic_MethodInstance::Variable(const Handle(Dynamic_Parameter)& aparameter,
|
||||
const Dynamic_ModeEnum amode,
|
||||
const Handle(Dynamic_Variable)& avariable)
|
||||
{
|
||||
Handle(Dynamic_AbstractVariableInstance) abstractvariableinstance;
|
||||
Handle(Dynamic_VariableNode) variablenode;
|
||||
Handle(Dynamic_Variable) variable;
|
||||
TCollection_AsciiString name = aparameter->Name();
|
||||
|
||||
if(Definition()->Variable(name.ToCString()))
|
||||
{
|
||||
variablenode = FirstVariableNode();
|
||||
while(!variablenode.IsNull())
|
||||
{
|
||||
variable = variablenode->Object();
|
||||
abstractvariableinstance = *(Handle_Dynamic_AbstractVariableInstance*)&variable;
|
||||
if(abstractvariableinstance->Parameter()->Name() == aparameter->Name())
|
||||
{
|
||||
abstractvariableinstance->Mode(amode);
|
||||
abstractvariableinstance->Parameter(aparameter);
|
||||
abstractvariableinstance->Variable(avariable);
|
||||
return;
|
||||
}
|
||||
variablenode = variablenode->Next();
|
||||
}
|
||||
abstractvariableinstance = new Dynamic_VariableInstance();
|
||||
abstractvariableinstance->Mode(amode);
|
||||
abstractvariableinstance->Parameter(aparameter);
|
||||
abstractvariableinstance->Variable(avariable);
|
||||
Dynamic_Method::Variable(abstractvariableinstance);
|
||||
}
|
||||
else
|
||||
cout<<"Pas de parametre du nom de : "<< aparameter->Name()<<endl;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Dynamic_MethodInstance::Value(const Standard_CString aname,
|
||||
Handle(Dynamic_Parameter)& aparameter,
|
||||
Dynamic_ModeEnum& amode,
|
||||
Handle(Dynamic_Variable)& avariable) const
|
||||
{
|
||||
Handle(Dynamic_Variable) variable;
|
||||
Handle(Dynamic_Variable) nullvariable;
|
||||
|
||||
if(Dynamic_Method::Value(aname,variable))
|
||||
{
|
||||
amode = variable->Mode();
|
||||
aparameter = variable->Parameter();
|
||||
if(variable->IsKind(STANDARD_TYPE(Dynamic_VariableInstance)))
|
||||
avariable = (*(Handle_Dynamic_VariableInstance*)&variable)->Variable();
|
||||
else
|
||||
avariable = nullvariable;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
else if(thedefinition->Value(aname,variable))
|
||||
{
|
||||
amode = variable->Mode();
|
||||
aparameter = variable->Parameter();
|
||||
if(variable->IsKind(STANDARD_TYPE(Dynamic_VariableInstance)))
|
||||
avariable = (*(Handle_Dynamic_VariableInstance*)&variable)->Variable();
|
||||
else
|
||||
avariable = nullvariable;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
else return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Dynamic_MethodInstance::Value(const Standard_CString aname,
|
||||
Handle(Dynamic_Parameter)& aparameter,
|
||||
Dynamic_ModeEnum& amode,
|
||||
Handle(Dynamic_VariableNode)& avariablenode) const
|
||||
{
|
||||
Handle(Dynamic_Variable) variable;
|
||||
Handle(Dynamic_VariableNode) nullvariablenode;
|
||||
|
||||
if(Dynamic_Method::Value(aname,variable))
|
||||
{
|
||||
amode = variable->Mode();
|
||||
aparameter = variable->Parameter();
|
||||
if(variable->IsKind(STANDARD_TYPE(Dynamic_CompositVariableInstance)))
|
||||
avariablenode = (*(Handle_Dynamic_CompositVariableInstance*)&variable)->FirstVariableNode();
|
||||
else
|
||||
avariablenode = nullvariablenode;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
else if(thedefinition->Value(aname,variable))
|
||||
{
|
||||
amode = variable->Mode();
|
||||
aparameter = variable->Parameter();
|
||||
if(variable->IsKind(STANDARD_TYPE(Dynamic_CompositVariableInstance)))
|
||||
avariablenode = (*(Handle_Dynamic_CompositVariableInstance*)&variable)->FirstVariableNode();
|
||||
else
|
||||
avariablenode = nullvariablenode;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
else return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Dynamic_MethodInstance::Dump(Standard_OStream& astream) const
|
||||
{
|
||||
Handle(Dynamic_VariableNode) variablenode = FirstVariableNode();
|
||||
astream<<"Method Instance : "<<Definition()->Type()<<endl;
|
||||
while(!variablenode.IsNull())
|
||||
{
|
||||
astream<<" ";
|
||||
variablenode->Object()->Dump(astream);
|
||||
astream<<endl;
|
||||
variablenode = variablenode->Next();
|
||||
}
|
||||
}
|
74
src/Dynamic/Dynamic_Node.cdl
Executable file
74
src/Dynamic/Dynamic_Node.cdl
Executable file
@@ -0,0 +1,74 @@
|
||||
-- File: Dynamic_Node.cdl
|
||||
-- Created: Mon Sep 19 11:18:30 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
64
src/Dynamic/Dynamic_Node.gxx
Executable file
64
src/Dynamic/Dynamic_Node.gxx
Executable file
@@ -0,0 +1,64 @@
|
||||
// File: Dynamic_Node.gxx
|
||||
// Created: Mon Sep 19 11:27:15 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//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;
|
||||
}
|
68
src/Dynamic/Dynamic_ObjectParameter.cdl
Executable file
68
src/Dynamic/Dynamic_ObjectParameter.cdl
Executable file
@@ -0,0 +1,68 @@
|
||||
-- File: Dynamic_ObjectParameter.cdl
|
||||
-- Created: Fri Dec 24 10:26:25 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@mastox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
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;
|
59
src/Dynamic/Dynamic_ObjectParameter.cxx
Executable file
59
src/Dynamic/Dynamic_ObjectParameter.cxx
Executable file
@@ -0,0 +1,59 @@
|
||||
// File: Dynamic_ObjectParameter.cxx
|
||||
// Created: Fri Dec 24 10:31:23 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@mastox>
|
||||
|
||||
#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);
|
||||
}
|
63
src/Dynamic/Dynamic_Parameter.cdl
Executable file
63
src/Dynamic/Dynamic_Parameter.cdl
Executable file
@@ -0,0 +1,63 @@
|
||||
-- File: Dynamic_Parameter.cdl
|
||||
-- Created: Thu Jan 28 15:03:38 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
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;
|
37
src/Dynamic/Dynamic_Parameter.cxx
Executable file
37
src/Dynamic/Dynamic_Parameter.cxx
Executable file
@@ -0,0 +1,37 @@
|
||||
// File: Dynamic_Parameter.cxx
|
||||
// Created: Thu Jan 28 15:06:03 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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();
|
||||
}
|
72
src/Dynamic/Dynamic_RealParameter.cdl
Executable file
72
src/Dynamic/Dynamic_RealParameter.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: Dynamic_RealParameter.cdl
|
||||
-- Created: Wed Feb 3 15:49:43 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
62
src/Dynamic/Dynamic_RealParameter.cxx
Executable file
62
src/Dynamic/Dynamic_RealParameter.cxx
Executable file
@@ -0,0 +1,62 @@
|
||||
// File: Dynamic_RealParameter.cxx
|
||||
// Created: Wed Feb 3 15:54:02 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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;
|
||||
}
|
76
src/Dynamic/Dynamic_StringParameter.cdl
Executable file
76
src/Dynamic/Dynamic_StringParameter.cdl
Executable file
@@ -0,0 +1,76 @@
|
||||
-- File: Dynamic_StringParameter.cdl
|
||||
-- Created: Wed Feb 3 15:49:43 1993
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@bravox>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
|
||||
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;
|
62
src/Dynamic/Dynamic_StringParameter.cxx
Executable file
62
src/Dynamic/Dynamic_StringParameter.cxx
Executable file
@@ -0,0 +1,62 @@
|
||||
// File: Dynamic_StringParameter.cxx
|
||||
// Created: Wed Feb 3 15:54:02 1993
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@bravox>
|
||||
|
||||
|
||||
#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();
|
||||
}
|
96
src/Dynamic/Dynamic_Variable.cdl
Executable file
96
src/Dynamic/Dynamic_Variable.cdl
Executable file
@@ -0,0 +1,96 @@
|
||||
-- File: Dynamic_Variable.cdl
|
||||
-- Created: Wed Aug 24 09:59:22 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
66
src/Dynamic/Dynamic_Variable.cxx
Executable file
66
src/Dynamic/Dynamic_Variable.cxx
Executable file
@@ -0,0 +1,66 @@
|
||||
// File: Dynamic_Variable.cxx
|
||||
// Created: Wed Aug 24 10:16:48 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
#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);
|
||||
}
|
32
src/Dynamic/Dynamic_VariableGroup.cdl
Executable file
32
src/Dynamic/Dynamic_VariableGroup.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: Dynamic_VariableGroup.cdl
|
||||
-- Created: Wed Aug 24 09:59:22 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
16
src/Dynamic/Dynamic_VariableGroup.cxx
Executable file
16
src/Dynamic/Dynamic_VariableGroup.cxx
Executable file
@@ -0,0 +1,16 @@
|
||||
// File: Dynamic_VariableGroup.cxx
|
||||
// Created: Wed Aug 24 10:16:48 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
#include <Dynamic_VariableGroup.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Dynamic_VariableGroup
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Dynamic_VariableGroup::Dynamic_VariableGroup() : Dynamic_Variable()
|
||||
{
|
||||
}
|
62
src/Dynamic/Dynamic_VariableInstance.cdl
Executable file
62
src/Dynamic/Dynamic_VariableInstance.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: Dynamic_VariableInstance.cdl
|
||||
-- Created: Mon Sep 5 15:02:15 1994
|
||||
-- Author: Gilles DEBARBOUILLE
|
||||
-- <gde@watson>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
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;
|
35
src/Dynamic/Dynamic_VariableInstance.cxx
Executable file
35
src/Dynamic/Dynamic_VariableInstance.cxx
Executable file
@@ -0,0 +1,35 @@
|
||||
// File: Dynamic_VariableInstance.cxx
|
||||
// Created: Mon Sep 5 15:06:46 1994
|
||||
// Author: Gilles DEBARBOUILLE
|
||||
// <gde@watson>
|
||||
|
||||
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user