Purpose:
|
Creates an instance of a graph vertex for use in graph theory.
|
|
Derivation:
|
gvertex : ACIS_OBJECT : -
|
|
Filename:
|
kern/kernel/kernutil/law/generic_graph.hxx
|
|
Description:
|
The concepts of vertex, edge, and graph have been implemented as the
C++ classes
gvertex,
gedge, and
generic_graph. (entity_gvertex is derived from
gvertex except that it contains a pointer to an entity in the model. Such an entity could be a cell or a face.) A
gvertex may be created with an optional
char *name. A
gedge may be created with two
gvertex pointers. An empty graph may be created and edges and vertices may be added to it by calling its
add_vertex and
add_edge methods. Once created, a graph may be interrogated, ordered, or subsetted in a number of ways.
|
|
|
The
C++ classes of
gvertex and
gedge are use counted in the same way that laws are use counted. That is to say that the are copied by calling the
add method and deleted by calling the
remove method.
|
|
|
To make a
gvertex or
gedge contain data, derive a class from the base classes of
gvertex and
gedge. Use a technique similar to the
entity_gvertex class which enables it to contain an entity pointer.
|
|
References:
|
by KERN
|
gedge
|
|
Data:
|
protected char *internal_name;
|
|
Character representation used to refer to this vertex.
|
|
|
public static int how_many;
|
|
Keeps track of how many gvertexes have been created.
|
|
Constructor:
|
public: gvertex::gvertex
(
|
|
|
char const* name
|
// name of vertex
|
|
|
|
= NULL
|
|
|
);
|
|
|
Creates an instance of a graph vertex and supplies it with a name.
|
|
|
|
|
Destructor:
|
protected: virtual gvertex::~gvertex
();
|
|
|
Do not call this destructor directly. An instance of
gvertex is deleted by calling the
remove method. This is necessary, because
gvertex is use counted. This destructor will throw a
sys_error if it is called when its
use_count is not equal to zero.
|
|
|
|
Methods:
|
public: void gvertex::add
() const;
|
|
|
The
C++ classes of
gvertex and
gedge are use counted in the same way that laws are use counted. That is to say that the are copied by calling the
add method and deleted by calling the
remove method.
|
|
|
|
|
|
|
public: void gvertex::clear_kind
();
|
|
|
Sets the user-defined
kind array for this graph item to
NULL.
kind is actually a dynamic array. The
value argument specifies whether or not this graph edge is of the
kind number specified.
|
|
|
|
|
|
|
public: virtual ENTITY* gvertex::get_entity
() const;
|
|
|
This returns a pointer to the entity that the graph vertex refers to. Initially, this can be a
CELL or a
FACE.
|
|
|
|
|
|
|
public: int gvertex::get_kind_size
() const;
|
|
|
Returns the size of the
kind
array.
|
|
|
|
|
|
|
public: logical gvertex::is_kind
(
|
|
|
int which
|
// kind to test
|
|
|
) const;
|
|
|
Determines whether or not this graph vertex is of the specified kind.
|
|
|
|
|
|
|
public: char const* gvertex::name
() const;
|
|
|
Every graph vertices can be supplied a character string as a name. This method returns its name.
|
|
|
|
|
|
|
public: logical gvertex::operator!=
(
|
|
|
gvertex const& in_vertex
|
// gvertex
|
|
|
) const;
|
|
|
Determines whether or not the supplied vertex is not equal to this graph vertex.
|
|
|
|
|
|
|
public: logical gvertex::operator==
(
|
|
|
gvertex const& in_vertex
|
// supplied vertex
|
|
|
) const;
|
|
|
Determines whether or not the supplied vertex is equal to this graph vertex.
|
|
|
|
|
|
|
public: void gvertex::remove
();
|
|
|
The
C++ classes of
gvertex and
gedge are use counted in the same way that laws are use counted. That is to say that the are copied by calling the
add method and deleted by calling the
remove method.
|
|
|
|
|
|
|
public: void gvertex::set_kind
(
|
|
|
int which,
|
// kind to use
|
|
|
logical value
|
// turn on or off
|
|
|
);
|
|
|
Assigns a user-defined
kind to this graph edge.
kind is actually a dynamic array. The
value argument specifies whether or not this graph edge is of the
kind number specified.
|
|
Internal Use:
|
id, isa, same, type
|