Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrew Bauer
VTK
Commits
5ff1d205
Commit
5ff1d205
authored
Sep 12, 1994
by
Will Schroeder
Browse files
ENH: Changed memory model.
parent
f6277674
Changes
29
Hide whitespace changes
Inline
Side-by-side
include/CellArr.hh
View file @
5ff1d205
...
...
@@ -20,12 +20,11 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
// of the form: (n,id1,id2,...,idn, n,id1,id2,...,idn, ...)
// where n is the number of points in the cell, and id is a zero-offset index
// into an associated point list.
//
// Advantages of this data structure are its compactness, simplicity, and easy
// interface to external data. However, it is totally inadequate for random
// access. This functionality (when necessary) is accomplished by using the
// vlCellList and vlLinkList objects to extend the definition of data
// structure.
// Advantages of this data structure are its compactness, simplicity, and
// easy interface to external data. However, it is totally inadequate for
// random access. This functionality (when necessary) is accomplished by
// using the vlCellList and vlLinkList objects to extend the definition of
// data structure.
#ifndef __vlCellArray_h
#define __vlCellArray_h
...
...
@@ -33,7 +32,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include
"IntArray.hh"
#include
"Cell.hh"
class
vlCellArray
:
public
vl
Object
class
vlCellArray
:
public
vl
RefCount
{
public:
vlCellArray
()
:
NumberOfCells
(
0
),
Location
(
0
)
{};
...
...
include/CellList.hh
View file @
5ff1d205
...
...
@@ -23,14 +23,15 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlCellList_h
#define __vlCellList_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
struct
vlCell_s
{
unsigned
char
type
;
//from CellTypes.hh
int
loc
;
//location in associated CellArray object
};
class
vlCellList
:
public
vlObject
{
class
vlCellList
:
public
vlRefCount
{
public:
vlCellList
()
:
Array
(
NULL
),
Size
(
0
),
MaxId
(
-
1
),
Extend
(
1000
)
{};
vlCellList
(
const
int
sz
,
const
int
ext
);
...
...
include/LinkList.hh
View file @
5ff1d205
...
...
@@ -13,7 +13,7 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
// .NAME vlLinkList - object represents upward pointers from point list
t
o cell
lis
t
// .NAME vlLinkList - object represents upward pointers from point
s to
list o
f
cell
s using each poin
t
// .SECTION Description
// vlLinkList is a supplemental object to CellArray and CellList to allow
// access from points to cells using the points. LinkList is a collection
...
...
@@ -24,7 +24,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlLinkList_h
#define __vlLinkList_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
class
vlDataSet
;
struct
vlLink
{
...
...
@@ -32,7 +32,8 @@ struct vlLink {
int
*
cells
;
};
class
vlLinkList
:
public
vlObject
{
class
vlLinkList
:
public
vlRefCount
{
public:
vlLinkList
()
:
Array
(
NULL
),
Size
(
0
),
MaxId
(
-
1
),
Extend
(
1000
)
{};
vlLinkList
(
int
sz
,
int
ext
=
1000
);
...
...
include/Locator.hh
View file @
5ff1d205
...
...
@@ -43,7 +43,7 @@ public:
// Description:
// Set list of points to insert into locator.
vlSetObjectMacro
(
Points
,
vlPoints
);
vlSet
RefCounted
ObjectMacro
(
Points
,
vlPoints
);
vlGetObjectMacro
(
Points
,
vlPoints
);
// Description:
...
...
include/Normals.hh
View file @
5ff1d205
...
...
@@ -24,12 +24,12 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlNormals_h
#define __vlNormals_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
class
vlIdList
;
class
vlFloatNormals
;
class
vlNormals
:
public
vl
Objec
t
class
vlNormals
:
public
vl
RefCoun
t
{
public:
vlNormals
()
{};
...
...
@@ -50,16 +50,16 @@ public:
virtual
float
*
GetNormal
(
int
i
)
=
0
;
// Description:
// Insert
vector
into object. No range checking performed (fast!).
// Insert
normal
into object. No range checking performed (fast!).
virtual
void
SetNormal
(
int
i
,
float
n
[
3
])
=
0
;
// Description:
// Insert
vector
into object. Range checking performed and memory
// Insert
normal
into object. Range checking performed and memory
// allocated as necessary.
virtual
void
InsertNormal
(
int
i
,
float
n
[
3
])
=
0
;
// Description:
// Insert
vector
into next available slot. Returns point id of slot.
// Insert
normal
into next available slot. Returns point id of slot.
virtual
int
InsertNextNormal
(
float
n
[
3
])
=
0
;
// Description:
...
...
include/Object.hh
View file @
5ff1d205
...
...
@@ -16,8 +16,8 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
// .NAME vlObject - abstract base class for visualization library
// .SECTION Description
// vlObject is the base class for many objects in the visualization
// library. vlObject provides methods for
reference counting, tracking
//
modification time,
debugging, and printing.
// library. vlObject provides methods for
tracking modification time,
// debugging, and printing.
#ifndef __vlObject_hh
#define __vlObject_hh
...
...
@@ -35,11 +35,6 @@ public:
virtual
~
vlObject
();
virtual
char
*
GetClassName
()
{
return
"vlObject"
;};
// reference counting
void
Register
(
vlObject
*
o
);
void
UnRegister
(
vlObject
*
o
);
int
GetRefCount
()
{
return
this
->
RefCount
;};
// debugging
void
DebugOn
();
void
DebugOff
();
...
...
@@ -63,7 +58,6 @@ protected:
vlTimeStamp
MTime
;
// Keep track of modification time
private:
int
RefCount
;
// Number of uses of this object by other objects
vlPrintList
PrintList
;
friend
ostream
&
operator
<<
(
ostream
&
os
,
vlObject
&
o
);
...
...
include/PointSet.hh
View file @
5ff1d205
...
...
@@ -51,7 +51,7 @@ public:
// Description:
// Specify point array to define point coordinates.
vlSetObjectMacro
(
Points
,
vlPoints
);
vlSet
RefCounted
ObjectMacro
(
Points
,
vlPoints
);
vlGetObjectMacro
(
Points
,
vlPoints
);
protected:
...
...
include/Points.hh
View file @
5ff1d205
...
...
@@ -23,12 +23,12 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlPoints_h
#define __vlPoints_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
class
vlFloatPoints
;
class
vlIdList
;
class
vlPoints
:
public
vl
Objec
t
class
vlPoints
:
public
vl
RefCoun
t
{
public:
vlPoints
();
...
...
include/PtData.hh
View file @
5ff1d205
...
...
@@ -61,22 +61,22 @@ public:
// Description:
// Set the scalar data.
vlSetObjectMacro
(
Scalars
,
vlScalars
);
vlSet
RefCounted
ObjectMacro
(
Scalars
,
vlScalars
);
vlGetObjectMacro
(
Scalars
,
vlScalars
);
// Description:
// Set the vector data.
vlSetObjectMacro
(
Vectors
,
vlVectors
);
vlSet
RefCounted
ObjectMacro
(
Vectors
,
vlVectors
);
vlGetObjectMacro
(
Vectors
,
vlVectors
);
// Description:
// Set the normal data.
vlSetObjectMacro
(
Normals
,
vlNormals
);
vlSet
RefCounted
ObjectMacro
(
Normals
,
vlNormals
);
vlGetObjectMacro
(
Normals
,
vlNormals
);
// Description:
// Set the texture coordinate data.
vlSetObjectMacro
(
TCoords
,
vlTCoords
);
vlSet
RefCounted
ObjectMacro
(
TCoords
,
vlTCoords
);
vlGetObjectMacro
(
TCoords
,
vlTCoords
);
// Description:
...
...
include/Scalars.hh
View file @
5ff1d205
...
...
@@ -23,12 +23,12 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlScalars_h
#define __vlScalars_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
class
vlIdList
;
class
vlFloatScalars
;
class
vlScalars
:
public
vl
Objec
t
class
vlScalars
:
public
vl
RefCoun
t
{
public:
vlScalars
();
...
...
include/SetGet.hh
View file @
5ff1d205
...
...
@@ -13,17 +13,13 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
// .NAME SetGet Macros - standard macros for setting/getting instance
// variable values
// .NAME SetGet Macros - standard macros for setting/getting instance variables
// .SECTION Description
// The SetGet macros are used to interface to instance variables
// in a standard fashion. This includes properly treating modified time,
// registering/unregistering object use, and printing out debug
// information.
//
// Macros are available for built-in types; for character strings;
// vector arrays of built-in types size 2,3,4; and for setting
// objects (i.e., Registering objects).
// in a standard fashion. This includes properly treating modified time
// and printing out debug information.
// Macros are available for built-in types; for character strings;
// vector arrays of built-in types size 2,3,4; and for setting objects.
#ifndef __vlSetGet_hh
#define __vlSetGet_hh
...
...
@@ -109,10 +105,28 @@ void Set##name (type _arg) \
}
//
// Set pointer to object; uses vlObject reference counting methodology.
// Creates method Set"name"() (e.g., SetPoints()).
// Set pointer to object. Creates method Set"name"() (e.g., SetPoints()).
//
#define vlSetObjectMacro(name,type) \
void Set##name (type* _arg) \
{ \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to " << &_arg << "\n\n"; \
if (name != _arg) \
{ \
name = _arg; \
this->Modified(); \
} \
} \
void Set##name (type& _arg) \
{ \
Set##name (&_arg);\
}
//
// Set pointer to object; uses vlRefCount reference counting methodology.
// Creates method Set"name"() (e.g., SetPoints()).
//
#define vlSetRefCountedObjectMacro(name,type) \
void Set##name (type* _arg) \
{ \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to " << &_arg << "\n\n"; \
...
...
include/StrData.hh
View file @
5ff1d205
...
...
@@ -71,6 +71,8 @@ protected:
vlBitArray
*
PointVisibility
;
};
// Description:
// Return non-zero value if specified point is visible.
inline
int
vlStructuredDataSet
::
IsPointVisible
(
int
ptId
)
{
if
(
!
this
->
Blanking
)
return
1
;
...
...
include/TCoords.hh
View file @
5ff1d205
...
...
@@ -25,12 +25,12 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlTCoords_h
#define __vlTCoords_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
class
vlIdList
;
class
vlFloatTCoords
;
class
vlTCoords
:
public
vl
Object
class
vlTCoords
:
public
vl
RefCount
{
public:
vlTCoords
(
int
dim
=
2
);
...
...
include/Vectors.hh
View file @
5ff1d205
...
...
@@ -23,12 +23,12 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlVectors_h
#define __vlVectors_h
#include
"
Objec
t.hh"
#include
"
RefCoun
t.hh"
class
vlIdList
;
class
vlFloatVectors
;
class
vlVectors
:
public
vl
Objec
t
class
vlVectors
:
public
vl
RefCoun
t
{
public:
vlVectors
();
...
...
src/CellArr.cc
View file @
5ff1d205
...
...
@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
...
...
src/CellList.cc
View file @
5ff1d205
...
...
@@ -13,7 +13,6 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
#include
<iostream.h>
#include
"CellList.hh"
vlCellList
::
vlCellList
(
const
int
sz
,
const
int
ext
)
...
...
src/DataSetF.cc
View file @
5ff1d205
...
...
@@ -25,10 +25,6 @@ vlDataSetFilter::vlDataSetFilter()
vlDataSetFilter
::~
vlDataSetFilter
()
{
if
(
this
->
Input
!=
NULL
)
{
this
->
Input
->
UnRegister
(
this
);
}
}
void
vlDataSetFilter
::
Update
()
...
...
src/Normals.cc
View file @
5ff1d205
...
...
@@ -29,7 +29,7 @@ void vlNormals::GetNormals(vlIdList& ptId, vlFloatNormals& fp)
void
vlNormals
::
PrintSelf
(
ostream
&
os
,
vlIndent
indent
)
{
vl
Objec
t
::
PrintSelf
(
os
,
indent
);
vl
RefCoun
t
::
PrintSelf
(
os
,
indent
);
os
<<
indent
<<
"Number Of Normals: "
<<
this
->
GetNumberOfNormals
()
<<
"
\n
"
;
}
src/Object.cc
View file @
5ff1d205
...
...
@@ -26,39 +26,15 @@ ostream& operator<<(ostream& os, vlObject& o)
vlObject
::
vlObject
()
{
this
->
RefCount
=
0
;
this
->
Debug
=
0
;
this
->
Modified
();
// Insures modified time > than any other time
}
vlObject
::~
vlObject
()
{
if
(
this
->
RefCount
>
0
)
{
vlErrorMacro
(
<<
"Trying to delete object with non-zero refCount"
);
}
vlDebugMacro
(
<<
"Destructing!"
);
}
// Description:
// Increase the reference count (mark as used by another object).
void
vlObject
::
Register
(
vlObject
*
o
)
{
this
->
RefCount
++
;
vlDebugMacro
(
<<
"Registered by "
<<
o
->
GetClassName
()
<<
" ("
<<
o
<<
")"
);
}
// Description:
// Decrease the reference count (release by another object).
void
vlObject
::
UnRegister
(
vlObject
*
o
)
{
vlDebugMacro
(
<<
"UnRegistered by "
<<
o
->
GetClassName
()
<<
" ("
<<
0
<<
")"
);
if
(
--
this
->
RefCount
<=
0
)
delete
this
;
}
// Description:
// Return the modification for this object.
unsigned
long
int
vlObject
::
GetMTime
()
...
...
@@ -89,7 +65,6 @@ void vlObject::PrintSelf(ostream& os, vlIndent indent)
{
os
<<
indent
<<
"Debug: "
<<
(
this
->
Debug
?
"On
\n
"
:
"Off
\n
"
);
os
<<
indent
<<
"Modified Time: "
<<
this
->
GetMTime
()
<<
"
\n
"
;
os
<<
indent
<<
"Reference Count: "
<<
this
->
RefCount
<<
"
\n
"
;
}
}
...
...
src/PointSet.cc
View file @
5ff1d205
...
...
@@ -28,7 +28,6 @@ vlDataSet(ps)
if
(
this
->
Points
)
this
->
Points
->
Register
(
this
);
this
->
Locator
=
ps
.
Locator
;
if
(
this
->
Locator
)
this
->
Locator
->
Register
(
this
);
}
void
vlPointSet
::
Initialize
()
...
...
@@ -43,8 +42,7 @@ void vlPointSet::Initialize()
if
(
this
->
Locator
)
{
this
->
Locator
->
UnRegister
(
this
);
this
->
Locator
=
NULL
;
this
->
Locator
->
Initialize
();
}
}
void
vlPointSet
::
ComputeBounds
()
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment