The use of this macro should be used sparingly. It is a little cumbersome to use and, if not used with care, may defeat the dynamic nature and benefits of dynamic binding. However, if used appropriately (in tight loops where efficiency is important), this macro may be a valuable tool.
This macro returns a pointer to the C function which implements the method.
NULL
is returned if no method is found.
Example: gChangeValue_t meth; object x; int i; x = gNewWithInt(ShortInteger, 5); meth = imiPointer(x, gChangeValue); for (i=0 ; i != 100 ; ) meth(x, i*2); /* or use: (*meth)(x, i*2); on old C compilers */ /* same as gChangeValue(x, i*2); */ /* except 0 runtime overhead in loop */ |
See also: imcPointer, cmiPointer, cmcPointer,
FindMethod::Behavior
InitGeneric(gen); object (*gen)(); |
The InitGeneric
macro is used to create Dynace generic function
objects which know the address of the C function which implements it.
All generic functions are normally initialized from a single source file
called generics.c
which is automatically created by the
dpp
program. gen
is the name of the generic
function.
There would not normally be a reason to call this macro.
Example: InitGeneric(vNew); |
See also: dpp, NewGeneric::GenericFunction, defGeneric,
externGeneric
r = IsaClass(obj); object obj; int r; |
This macro is used to determine if obj
refers to a class type
object. It returns a 1 for class and metaclass type objects and 0 for
instance type objects.
Example: object a; int c; a = gNewWithInt(ShortInteger, 7); c = IsaClass(a); /* c == 0 */ c = IsaClass(ShortInteger) /* c == 1 */ c = IsaClass(ClassOf(a)); /* c == 1 */ c = IsaClass(ClassOf(ShortInteger)) /* c == 1 */ |
See also: IsaMetaClass, ClassOf, EQ
r = IsaMetaClass(obj); object obj; int r; |
This macro is used to determine if obj
refers to a metaclass
type object. It returns a 1 for metaclass type objects and 0 for
instance and class type objects.
Example: object a; int c; a = gNewWithInt(ShortInteger, 7); c = IsaMetaClass(a); /* c == 0 */ c = IsaMetaClass(ShortInteger) /* c == 0 */ c = IsaMetaClass(ClassOf(a)); /* c == 0 */ c = IsaMetaClass(ClassOf(ShortInteger)) /* c == 1 */ |
See also: IsaClass, ClassOf, EQ
r = IsInstanceOf(i, cls); object i; object cls; int r; |
This macro is used to determine if i
is a direct
instance of cls
. If so a 1 is returned and 0 otherwise.
Example: object a, b; int c; a = gNewWithInt(ShortInteger, 7); b = gNewWithInt(Dictionary, 101); c = IsInstanceOf(a, ShortInteger); /* c == 1 */ c = IsInstanceOf(a, LongInteger); /* c == 0 */ c = IsInstanceOf(b, Dictionary); /* c == 1 */ c = IsInstanceOf(b, Set); /* c == 0 */ c = IsInstanceOf(b, LinkList); /* c == 0 */ |
See also: IsKindOf::Object, ClassOf
meth = iSuper(cls, gen); object cls; /* class */ RTYPE (*gen)(); /* generic function */ RTYPE (*meth)(); /* method */ |
This macro returns the superclass instance method associated with the
generic function gen
for class cls
. If the method is not
found the normal method search procedure will be used.
RTYPE
is the return type associated with the generic and
macro in question. The method pointer returned will be correctly
typecast.
This macro has been superseded by oSuper
.
Example: /* execute the superclass instance method associated with gDispose and pass it the single argument self */ iSuper(MyClass, gDispose)(self); |
See also: oSuper, cSuper
meth = ivMethodFor(cls, gen, cf, ff); object cls; /* class */ object (*gen)(); /* generic function */ object (*cf)(); /* C function */ object (*ff)(); /* fixed C function */ object meth; /* method object */ |
This macro is used to associate a C function, which implements an
instance method, with a generic function for class cls
. It is
normally only used within the class initialization function associated
with each class file.
This macro returns a Dynace object (an instance of the Method class) which represents the C function which implements the method. Each Class and Generic object contains a list of Method objects which it relates to so there is not normally a need to save the returned value.
The difference between this macro and iMethodFor
is the extra ff
parameter. When using dpp
strategies other then 1 (see the dpp
section) under certain circumstance dpp
will alter the argument
signature of the defined method in order to accommodate the non-assembler
generic / method interface. It will then create a new function which has
the correct signature in case the programmer requests a pointer to the
method. This way the returned function pointer will match the argument
signature defined in the class definition file. ff
is a pointer
to this cover function.
Example: ivMethodFor(MyClass, gChangeValue, my_change, f_my_change); |
See also: iMethodFor, cMethodFor
iv = ivPtr(i); object i; ivType *iv; |
The ivPtr
macro returns a pointer to the locally defined
instance variable structure associated with instance i
. It is
used to gain access to the instance variables associated with the
instance object pointed to by the i
variable. It may only be
used in a file which defines a class and i
must be an instance
of the class being defined or one of its subclasses.
If the method is going to make more than one access to its instances
variables the pointer returned by ivPtr
should normally be saved
and reused.
If the variable containing the instance variables you wish to access is
named self
than the ivsPtr
or accessIVs
macro
should be used.
Although the example below makes its illustration with the self
variable (because it’s always the name of the first argument to a
method) ivPtr
is most often used to access the instance variables
of a second argument (which wouldn’t have the name self
) which is
an instance of the same (or sub) class.
Example: defclass { char name[30]; int age; }; imeth object PrintAge(object self) { printf("Age = %d\n", ivPtr(self)->age); return self; } imeth object PrintInstance(object self) { ivType *iv = ivPtr(self); /* save the pointer */ /* the above line is the same as accessIVs */ printf("Name = %s\n", iv->name); /* use saved pointer */ printf("Age = %d\n", iv->age); return self; } |
See also: accessIVs, ivsPtr, ivType, GetIVs
iv = ivsPtr; ivType *iv; |
The ivsPtr
macro returns a pointer to the locally defined
instance variable structure for the variable named self
. It is
used to gain access to the instance variables associated with the
instance object pointed to by the self
variable. It may only be
used in instance methods, in a file which defines a class.
This macro is typically used when an instance method makes a single
access to its instance variables. If the method is going to make more
than one access to its instances variables the macro accessIVs
would normally be used or the pointer returned by ivsPtr
would normally be saved and reused.
If the variable containing the instance variables you wish to access
is not named self
than the ivPtr
macro should be used.
Example: defclass { char name[30]; int age; }; imeth object PrintAge(object self) { printf("Age = %d\n", ivsPtr->age); /* single use */ return self; } imeth object PrintInstance(object self) { ivType *iv = ivsPtr; /* save the pointer */ /* the above line is the same as accessIVs */ printf("Name = %s\n", iv->name); /* use saved pointer */ printf("Age = %d\n", iv->age); return self; } |
See also: accessIVs, ivPtr, ivType, GetIVs
ivType |
This macro is used to declare a variable to be of a structure which is defined by the local instance variable declaration. It can only be used in a source file which is used to define a class and only of the structure of the locally defined instance variable structure. It’s main use is while passing a pointer to a local variable structure to other, usually statically defined, C functions within a class definition file.
Example: ivType *ivp; ivp = ivsPtr; |
See also: accessIVs, ivPtr, ivsPtr
MAKE_REST(lst); |
This macro is used in conjunction with the GetArg
macro in order
to create a consistent mechanism for methods which take a variable
number of arguments to obtain its optional arguments. This mechanism,
as opposed to the normal va_*
mechanism, is necessary in order to
allow the same source code to work across the various dpp
code
strategies (see the dpp
subsection “Preprocessing Strategies”).
Methods which take a variable number of arguments and wish to access
those arguments must use the MAKE_REST
macro. This macro must
exist immediately following the declaration section of the method and
prior to the normal executable code.
MAKE_REST
takes a single argument which must be the last named
argument in the method’s argument list. The result of calling
MAKE_REST
is the creation of a variable named _rest_
which acts as a pointer to the variable argument list, a
va_list
.
Example: imeth gChangeValue(int a, char *b, ...) { double var1; int dd; MAKE_REST(b); var1 = GetArg(double); dd = GetArg(int); ... } |
See also: GetArg, RESET_REST
r = NEQ(obj1, obj2); object obj1, obj2; int r; |
This macro is used to determine if obj1
and obj2
refer to
the same exact object (not just the same value within the object). If
so a 0 is returned and 1 otherwise.
Example: object a, b, e; int c; a = gNewWithInt(ShortInteger, 7); b = gNewWithInt(ShortInteger, 7); e = a; c = NEQ(a, b); /* c == 1 */ c = NEQ(b, e); /* c == 1 */ c = NEQ(a, e); /* c == 0 */ |
See also: Equal::Object, EQ
meth = oSuper(cls, gen, obj); object cls; RTYPE (*gen)(); object obj; RTYPE (*meth)(); |
This macro returns the superclass instance or class method associated
with the generic function gen
for class cls
. obj
is used to tell whether the object being acted upon is a class or
instance object. It should be the argument which will be the first
argument to the methods being returned. If the method is not found the
normal method search procedure will be used.
RTYPE
is the return type associated with the generic and
macro in question. The method pointer returned will be correctly
typecast.
This macro effectively eliminates the need for the iSuper
or
cSuper
macros.
Example: /* execute the superclass method associated with gDispose and pass it the single argument self */ oSuper(MyClass, gDispose, self)(self); |
See also: iSuper, cSuper
p = RegisterVariable(v); object v; void *p; |
The RegisterVariable
macro is used as a short hand way of
registering global object variables to protect them from the
automatic garbage collector. v
is the global variable to be
protected and p
is a registered memory pointer which may
be used to change or delete the registration at some later point.
See the text for a detailed description of the garbage collector.
See also: RegisterMemory::Dynace, RemoveRegisteredMemory::Dynace,
ChangeRegisteredMemory::Dynace
RESET_REST; |
This macro is used in conjunction with the GetArg
and
MAKE_REST
macros in order
to create a consistent mechanism for methods which take a variable
number of arguments to obtain its optional arguments. This macro
allows the GetArg
to go back over the argument list from
the beginning, thus allowing multiple passes over the entire
argument list. RESET_REST
may be called anytime, and any
number of times, after MAKE_REST
has been called. Each time
RESET_REST
is called, GetArg
will start back at the
beginning of the argument list.
Example: imeth gChangeValue(int a, char *b, ...) { double var1; int dd; MAKE_REST(b); var1 = GetArg(double); dd = GetArg(int); /* get the same arguments again */ RESET_REST; var1 = GetArg(double); dd = GetArg(int); ... } |
See also: GetArg, MAKE_REST
r = RespondsTo(i, gen); object i; object (*gen)(); int r; |
This macro is used to determine if the class of i
implements a
method which is associated with generic gen
. If so a 1 is
returned and 0 otherwise.
Example: object a; int c; a = gNewWithInt(ShortInteger, 7); c = RespondsTo(a, gShortValue); /* c == 1 */ c = RespondsTo(a, gNext); /* c == 0 */ |
See also: FindMethod::Behavior
i = StackAlloc(cls); object cls; object i; |
This macro is used to allocate a new instance of class cls
from
the local stack space. i
will be an instance of class cls
with all its instance variables initialized to NULL
.
Disposal of the returned object will occur automatically when the local
stack is exited, however, no automatic execution of additional disposal
code will occur. Manual disposal may also be used (via gDispose
,
etc.) but the object will still take up stack space until the stack
frame is exited.
Since the returned object is allocated from the current stack frame it cannot be returned from the function which allocated it.
This facility depends on a robust implementation of the alloca
system call.
Example: object a; a = StackAlloc(ShortInteger); |
See also: StackAlloc::Behavior
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The number of regular C language functions available externally has been kept to an absolute minimum. The reason for this is the static nature of C functions and an effort to minimize the number of routines the programmer needs to use the system. The following text describes each function.
sz = Dynace_GetInitialPageSize(); long sz; |
This is an application defined function optionally supplied to determine the amount of memory Dynace should allocate upon startup. If used, it must be defined and supplied as part of the application’s code. The value returned, given in number of bytes, is what Dynace uses to allocate its initial block of memory for various objects to be allocated from. This is used to speed up Dynace under Windows. See Speeding-Up-IsObj.
Example: The following function would be defined by the application: long Dynace_GetInitialPageSize() { return 1000000; } |
See also: Dynace_GetPageSize
sz = Dynace_GetPageSize(); long sz; |
This is an application defined function optionally supplied to determine the amount of memory Dynace should allocate after its startup allocation. If used, it must be defined and supplied as part of the application’s code. The value returned, given in number of bytes, is what Dynace uses to allocate its blocks of memory, when needed, after its initial memory block is used up. This is used to speed up Dynace under Windows. See Speeding-Up-IsObj.
Example: The following function would be defined by the application: long Dynace_GetPageSize() { return 100000; } |
See also: Dynace_GetInitialPageSize
iv = GetIVptr(obj, cls); object obj; object cls; void *iv; |
This function is the one which does all the work to obtain
a pointer to the instances variables from an object. obj
is the object whose instance variables are needed. cls
is the class which describes the structure of the instance
variables needed. obj
must be an instance of class cls
at some point in its hierarchy. The pointer returned will only allow
access to the instance variables defined by class cls
regardless
of any other instance variables obj
may contain.
This function should not be called by an application. The relevant
macros should be used instead.
See also: ivPtr, ivsPtr, accessIVs
InitDynace(sb); void *sb; /* stack beginning */ |
This function is used to initialize the Dynace kernel and all classes
and generics. It must be called prior to the use of any other Dynace
facility. It is typically called in main()
.
This function calls InitKernel
internally to initialize the
kernel first. The sb
parameter tells Dynace where the beginning
of the stack resides. The garbage collector needs this information to
automatically scan automatic variables. sb
is typically passed
the address of the argc
argument to main()
.
Example: main(int argc, char *argv[]) { InitDynace(&argc); ..... } |
See also: InitKernel, GC::Dynace
InitKernel(sb); void *sb; /* stack beginning */ |
This function is used to initialize the Dynace kernel. It must be
called prior to the use of any other Dynace facility. Typically,
however, InitKernel
is called indirectly through another function
(such as InitDynace
which also initializes the class library and
user added classes). The sb
parameter tells Dynace where the
beginning of the stack resides. The garbage collector needs this
information to automatically scan automatic variables. sb
is
typically passed the address of the argc
argument to
main()
.
Example: main(int argc, char *argv[]) { InitKernel(&argc); ..... } |
See also: InitDynace, GC::Dynace
r = IsObj(obj); object obj; int r; |
This function is used to determine the validity of an object. If
obj
is a valid Dynace object IsObj
returns a 1 otherwise
it returns a 0.
Example: if (IsObj(obj)) gGeneric(obj); else abort("Not an object"); |
See Speeding-Up-IsObj.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There is really only one new data type associated with Dynace, the
object
type. However, Dynace also has some type definitions
which are simply used to ease programming in the Dynace environment.
object |
This is the principal type of object in Dynace. All Dynace objects are of
type object
. object
is actually a pointer to memory
which is allocated (by Dynace) from the heap. Objects never reside
on the stack or static memory, although pointers to them may.
The object
declaration may be used any place the int
declaration may be used.
Example: object a, b, c; |
ofun |
This declaration is just a short hand way of declaring a variable to be a pointer to a function which returns an object.
The ofun
declaration may be used any place the int
declaration may be used.
Example: ofun a; object (*b)(); /* a and b are of the same type */ |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Dynace class library is built on top of the Dynace kernel. It provides a library of facilities which make the Dynace system useful to an application programmer. It provides various data representational type classes which represent the normal C language data types such as short, long, double, pointer, etc. It also provides new data type classes such as date.
The class library also provides generic container type classes such as dictionaries and linked lists. It also provides classes which implement the ability for Dynace to run multiple threads and for those threads to communicate and control each other.
This chapter will discuss the structure and various facilities available in the Dynace class library.
Note that most of the Dynace kernel will run independently of the Dynace class library. The value of this is that should a programmer desire to create his own class library (to replace the included class library) he may build on top of the Dynace kernel just as the included library does.
Note that the first argument to all class methods is always the associated class object and the first argument to all instance methods is always an instance of the associated class. Therefore, documentation for the first argument of generics is not always given – it’s redundant.
There is a naming convention used with Dynace generics. All generics start with either a lower case “g” or “v”, and are always followed by an upper case letter. The ones which start with “g” are normal generics and may be treated like normal C functions. The ones which begin with “v” use the variable argument facilities of C and you should, therefore, take a bit extra care when using them since there is no compile time argument checking being done with these functions.
Since all generics start with either “g” or “v” and in order to avoid the difficulty associated with grouping all the generics under two letters, the first letter is dropped for indexing or heading purposes. Therefore if you are looking up a generic, it will always appear in the index or header with its first letter missing. The syntax description and example code, however, will show the entire name.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This Dynace class library contains the following class hierarchy (which of course includes the hierarchy described in the Kernel Reference):
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Array
class is used to represent heterogeneous and
non-heterogeneous indexable collections of arbitrary dimensions. These
arrays are designed to be flexible – they have the ability to be
dynamically re-dimensioned or reshaped – and space and speed efficient.
Although most of the actual functionality contained in subclasses of the
Array
class are implemented in the Array
class, most users
will find the subclasses more useful. The documentation associated with
this class serves to document the functionality which is common to all
its subclasses.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The majority of class methods associated with this class are mainly used
by and documented in subclasses of the Array
class.
s = gIndexOrigin(s, n) object s; int n; |
This method is used to set the index origin associated with all array indexing. The default is 0. This means that a 4 element, 1 dimension array would be indexed by 0, 1, 2, 3. If the index origin is set to one that same array would be indexed by 1, 2, 3, 4.
The index origin may be changed any number of times and has no actual effect on any arrays (either created previously or subsequently). It only effects how indexing works.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Instance methods associated with this class provide functionality which
is common to all subclasses of the Array
class.
p = gArrayPointer(s) object s; void *p; |
This method returns a pointer to the first element of an array represented
be s
. The return type will be a pointer to the type of array it
is. For example a ShorArray
will return a pointer to a short
and a DoubleFloatArray
will return a pointer to a double
.
Consecutive elements may be accessed by incrementing the pointer (although
this is not the preferred way of going through an array).
r = gCopy(i); object i; object r; |
This method is used to create a new array object which is an exact copy,
including type, rank, shape and values, of i
. The value returned
is the new array object.
See also: DeepCopy::Array
r = gDeepCopy(i); object i; object r; |
This method is used to create a new array object which is an exact copy,
including type, rank, shape and values, of i
. The value returned
is the new array object.
The difference between this method and Copy::Array
is that if the
array being copied is an ObjectArray
, DeepCopy
will also
make copies of the elements. Copy
will not.
See also: Copy::Array
r = gDeepDispose(s) object s; object r; /* NULL */ |
This method disposes and frees all memory associated with an Array
object. If it is an instance of the ObjectArray
class each
non-NULL element will also be DeepDispose
’d.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
r = gDispose(s) object s; object r; /* NULL */ |
This method disposes and frees all memory associated with an Array
object.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
r = gEqual(i, a) object i, a; int r; |
This method is used to determine the equality of two arrays. If they
(i
and a
) are instances of the same class, same rank,
same shape and same values than Equal
returns a 1. Equal
returns 0 otherwise.
See also: EQ
p = gIndex(i, idx) object i; va_list idx; |
This method is used to obtain a pointer to a single element of an array.
It is only intended to be used internally by the subclasses of
Array
. i
is the array to be indexed and idx
is a
va_list where each element indicates successive indices into the
array. The number of elements in idx
must equal the rank
of the array. The pointer returned may be typecast to the appropriate
type.
See also: ChangeValue::NumberArray, ShortValue::NumberArray
r = gRank(i) object i; unsigned r; |
This method is used to obtain the number of dimensions a particular
array (i
) has.
See also: Shape::Array, Size::Array, Reshape::Array
i = vReshape(i, r, ...) object i; unsigned r; |
This method is used to change the rank and shape of an array (i
).
r
is the new rank (number of dimensions) of the array and
the remaining arguments (type unsigned
) indicate the size of
each consecutive dimension. Not that the number of arguments after
r
must be equal to the number r
.
If the new shape has fewer elements than the original, the remaining elements are discarded. If, however, the new shape has more elements, the elements in the original array will be reused (from the beginning) over and over until the new array is filled.
The value returned is the modified array passed.
See also: Shape::Array, Rank::Array
s = gShape(i) object i; object s; |
This method is used to obtain the shape (or dimensions) of a particular
array (i
). The value returned (s
) is an instance of the
ShortArray
class, each element of which contains a consecutive
dimension.
See also: Reshape::Array, Rank::Array, Size::Array
s = gSize(i) object i; int s; |
This method is used to obtain the total number of elements in array i
.
See also: Rank::Array, Shape::Array
s = gStringRep(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the type, rank, shape and values associated with
i
. This is often used to print or display the value. It is also
used by PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project) in order to
directly print an object’s value.
See also: PrintValue::Object, Print::Object, StringRepValue::Array
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the values associated with i
. This is often
used to print or display the value. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
See also: PrintValue::Object, Print::Object, StringRep::Array
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Association
class is an abstract class which serves the
sole purpose of grouping several subclasses which have common
functionality. There is no specific class or instance methods
directly implemented by this class, however, some methods are documented
here because of their common interface with all subclasses of the
Association
class.
The subclasses of this class (LookupKey
,
ObjectAssociation
, StringAssociation
and
IntegerAssociation
) are used to associate a key with a value and
provide a means for manipulating these associations. Instances of these
classes are principally used by the Set
and Dictionary
classes but may also be useful wherever a key/value pair may be useful.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are no class methods implemented by this class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are no class methods implemented by this class, however, some
methods are documented here because of their common interface with all
subclasses of the Association
class. These methods are actually
implemented by all subclasses of this class.
r = gCompare(i, obj); object i; object obj; int r; |
This method is used by the generic container classes to determine
the equality of the keys represented by i
and obj
.
r
is -1 if the value represented by i
is less than
the value represented by obj
, 1 if the value of i
is greater than obj
, and 0 if they are equal.
See also: Hash::Association
val = gHash(i); object i; int val; |
This method is used by the generic container classes to obtain hash
values for the key. val
is a hash value between 0 and a large
integer value.
See also: Compare::Association
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, which is a subclass of Array
, is used to represent
arbitrary shaped arrays of on/off–yes/no information in an efficient
manner. Much of the functionality of this class is implemented and
documented in the Array
class. Differences are documented in
this section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The only class method implemented by this class is one used to create
new BitArray
instances.
ary = vNew(BitArray, rnk, ...) unsigned rnk, ... object ary; |
This class method is used to create a new bit array.
rnk
is the number of dimensions the new array should have.
The remaining arguments (each of type unsigned) indicates the size of
each consecutive dimension. Note that the number of arguments following
rnk
must be the same as the value in rnk
.
ary
is the new array object created and will be initialized to
all zeros.
Example: object ary; ary = vNew(BitArray, 2, 5, 4); /* ary is a 5x4 matrix */ |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The BitArray
instance methods are implemented in the Array
class
for efficiency reasons but those methods which are particular to the
BitArray
are documented here.
v = vBitValue(ary, ...); object ary; unsigned ... int v; |
This method is used to obtain the bit (1 or 0) value associated with a
particular element of an instance of the BitArray
class.
The arguments after the ary
argument (each an unsigned
)
are used to specify the exact index into each consecutive dimension of
the array. The number of arguments after the ary
argument
must be equal to the number of dimensions (or rank) of array
ary
. See IndexOrigin::Array
for more information.
Note that this is one of the few generics which doesn’t return a Dynace
object. It returns an int
.
Example: object ary; int v; ary = vNew(BitArray, 2, 5, 4); v = vBitValue(ary, 1, 2); /* v has ary[1][2] */ |
See also: ChangeBitValue::BitArray
ary = vChangeBitValue(ary, val, ...); object ary; int val; unsigned ... |
This method is used to change the value of one element of
BitArray
ary
.
val
is the value which the element of the array should be changed
to (a 1 or 0).
The arguments after the val
argument (each an unsigned
)
are used to specify the exact index into each consecutive dimension of
the array. The number of arguments after the val
argument
must be equal to the number of dimensions (or rank) of array
ary
. See IndexOrigin::Array
for more information.
The value returned is the modified array passed.
Example: object ary; ary = vNew(BitArray, 2, 5, 4); vChangeBitValue(ary, 1, 1, 2); /* ary[1][2] <- 1 */ |
See also: BitValue::BitArray
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The BTree
class provides a means to hold a group of key / value
pairs in a collection. Objects in a BTree
collection can then be
rapidly accessed arbitrarily (as in hash tables) as well as retrieved in
a specific sequence (as in an ordered linked lists). Keys and values
may be arbitrary Dynace objects.
It is important that the key objects correctly respond to gCopy
and gDeepCopy
because copies of the keys are used within the key
structure.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The only class method used in this class is one to create instances of itself.
bt = gNew(BTree); object bt; |
This class method creates instances of the BTree
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to add, remove, and retrieve key / value pairs.
old = gAddValue(bt, key, val); object bt; object key; object val; object old; |
This method is used to add an arbitrary key / value pair to BTree
bt
. Both key
and val
may be arbitrary Dynace
objects.
By default the built in generic gCompare
is used for all key comparisons.
This may be over written via gSetFunction::BTree
.
Each key added to a particular BTree
must be unique
(i.e. duplicate keys are not allowed).
AddValue
normally returns NULL
. However, if NULL
is not returned then it means that the key / value pair just added
replaced a similar key / value pair. In that case the old value
associated with the key will be returned and the old key object will
still be used. This will normally mean you will have to dispose of
the old value returned and your new key (since the old one was used).
Example: object key = gNewWithStr(String, "My Key"); object val = gNewWithStr(String, "My Value"); object old = gAddValue(bt, key, val); if (old) { gDispose(key); gDispose(old); } |
r = gDeepDispose(bt); object bt; object r; /* NULL */ |
This method is used to DeepDispose
all key / value pairs
associated with the BTree
and then dispose of bt
itself.
See also: Dispose::BTree, DeepDisposeAllNodes::BTree
r = gDeepDisposeAllNodes(bt); object bt; object r; |
This method is used to DeepDispose
all key / value pairs
associated with the BTree
without disposing of bt
itself.
The BTree
object passed is returned.
See also: Dispose::BTree, DeepDispose::BTree
r = gDeepDisposeObj(bt, key); object bt; object key; object r; |
This method is used to DeepDispose
a specific key / value pair
associated with the BTree
. The key / value pair is determined by
key
. If the key / value pair was found and removed,
gDeepDisposeObj
will return non-NULL
. If the key was not
found then NULL
is returned.
See also: DisposeObj::BTree, DeepDisposeAllNodes::BTree
r = gDispose(bt); object bt; object r; /* NULL */ |
This method is used to Dispose
of the BTree
object without
disposing of all of the key / value pairs.
See also: DeepDispose::BTree, DisposeAllNodes::BTree
r = gDisposeAllNodes(bt); object bt; object r; |
This method is used to disassociate all key / value pairs from the given
BTree
. Neither the keys, values, nor bt
are disposed. The
BTree
object passed is returned.
See also: DeepDispose::BTree, DisposeAllNodes::BTree
r = gDisposeObj(bt, key); object bt; object key; object r; |
This method is used to disassociate (not dispose) a specific key / value
pair from the BTree
. The key / value pair is determined by
key
. If the key / value pair was found and removed,
gDisposeObj
will return non-NULL
. If the key was not
found then NULL
is returned.
See also: DeepDisposeObj::BTree, DisposeAllNodes::BTree
val = gFindEQ(bt, key, fkey); object bt; object key; object *fkey; object val; |
This method is used to retrieve the value associated with a given key.
The object associated with a key which compares equally with key
is returned. If none is found NULL
is returned.
fkey
points to a location which will receive the actual key
object found. fkey
may be NULL
in which case that
argument will not be used.
Example: object fkey; object key = ...; object val = gFindEQ(bt, key, &fkey); |
See also: AddValue::BTree, FindNext::BTree
val = gFindFirst(bt, fkey); object bt; object *fkey; object val; |
This method is used to retrieve the first key / value pair. If no key
value pairs exist NULL
is returned.
fkey
will be updated to point to the key associated to the value
returned. It may be used on subsequent calls to gFindNext
.
See also: AddValue::BTree, FindNext::BTree
val = gFindGE(bt, key, fkey); object bt; object key; object *fkey; object val; |
This method is used to retrieve the value associated with a given key.
The object associated with a key which compares greater than or equal to
key
is returned. If none is found NULL
is returned.
fkey
points to a location which will receive the actual key
object found. fkey
may be NULL
in which case that
argument will not be used.
Example: object fkey; object key = ...; object val = gFindGE(bt, key, &fkey); |
See also: AddValue::BTree, FindNext::BTree
val = gFindGT(bt, key, fkey); object bt; object key; object *fkey; object val; |
This method is used to retrieve the value associated with a given key.
The object associated with a key which compares strictly greater than
key
is returned. If none is found NULL
is returned.
fkey
points to a location which will receive the actual key
object found. fkey
may be NULL
in which case that
argument will not be used.
Example: object fkey; object key = ...; object val = gFindGT(bt, key, &fkey); |
See also: AddValue::BTree, FindNext::BTree
val = gFindLast(bt, fkey); object bt; object *fkey; object val; |
This method is used to retrieve the last key / value pair. If no key
value pairs exist NULL
is returned.
fkey
will be updated to point to the key associated to the value
returned. It may be used on subsequent calls to gFindPrev
.
See also: AddValue::BTree, FindPrev::BTree
val = gFindLE(bt, key, fkey); object bt; object key; object *fkey; object val; |
This method is used to retrieve the value associated with a given key.
The object associated with a key which compares less than or equal to
key
is returned. If none is found NULL
is returned.
fkey
points to a location which will receive the actual key
object found. fkey
may be NULL
in which case that
argument will not be used.
Example: object fkey; object key = ...; object val = gFindLE(bt, key, &fkey); |
See also: AddValue::BTree, FindPrev::BTree
val = gFindLT(bt, key, fkey); object bt; object key; object *fkey; object val; |
This method is used to retrieve the value associated with a given key.
The object associated with a key which compares strictly less than
key
is returned. If none is found NULL
is returned.
fkey
points to a location which will receive the actual key
object found. fkey
may be NULL
in which case that
argument will not be used.
Example: object fkey; object key = ...; object val = gFindLT(bt, key, &fkey); |
See also: AddValue::BTree, FindPrev::BTree
val = gFindNext(bt, fkey); object bt; object *fkey; object val; |
This method is used to retrieve a key / value pair which comes
immediately after the key pointed to by fkey
. If fkey
points to NULL
than the first key / value pair is retrieved. If
none is found NULL
is returned.
fkey
will be updated to point to the key associated to the value
returned. It may be used on subsequent calls to gFindNext
.
Example: object fkey = NULL; object val; while (val = gFindNext(bt, &fkey)) do whatever; |
See also: AddValue::BTree, FindPrev::BTree
val = gFindPrev(bt, fkey); object bt; object *fkey; object val; |
This method is used to retrieve a key / value pair which comes
immediately before the key pointed to by fkey
. If fkey
points to NULL
than the last key / value pair is retrieved. If
none is found NULL
is returned.
fkey
will be updated to point to the key associated to the value
returned. It may be used on subsequent calls to gFindPrev
.
Example: object fkey = NULL; object val; while (val = gFindPrev(bt, &fkey)) do whatever; |
See also: AddValue::BTree, FindNext::BTree
f = gSetFunction(bt, fun); object bt; int (*fun)(object, object); object (*f)(); |
Normally, the BTree
class uses the generic function
gCompare
for all its key comparisons. With gSetFunction
you may override this behavior and specify an alternative generic (or
regular C) function to call. See Compare::String
for details
on the semantics of that function.
gSetFunction
returns the previous compare function set.
See also: AddValue::BTree, Compare::String
n = gSize(bt); object bt; int n; |
This method is used to obtain the number of key / value pairs associated
with bt
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is used by the BTree
class to store objects in memory.
There are no user methods associated with this class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Character
class is used to represent the C language
char
data type as a Dynace object. It is a subclass of the
Number
class. Even though the Character
class
implements most of its own functionality, it is documented as part of
the Number
class because most of the interface is the same for
all subclasses of the Number
class. Differences are documented
in this section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Character
class has only one class method and it is used to create
new instances of itself.
i = gNewWithChar(Character, c); int c; object i; |
This class method creates instances of the Character class. c
is
the initial value of the character being represented. Note that
c
is of type int
. That is because if you pass a character
to a generic function (which uses a variable argument declaration) the C
language will automatically promote it to an int
.
The value returned is a Dynace instance object which represents the character passed.
Note that the default disposal methods are used by this class since there are no special storage allocation requirements.
Example: object x; x = gNewWithChar(Character, 'a'); |
See also: CharValue::Number, ChangeCharValue::Number,
Dispose::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with the Character
class provide
a means of changing and obtaining the value associated with an instance
of the Character
class. Most of the Character
class
instance methods are documented in the Number
class because of
their common interface with all other subclasses of the Number
class. The remainder are documented in this section.
s = gFormatChar(i); object i; object s; |
This method creates an instance of the String
class which
contains the character represented by i
.
Example: object x, y; x = gNewWithChar(Character, 'a'); y = gFormatChar(x); /* y is a String object which represents "a" */ |
See also: FormatNumber::Number
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, which is a subclass of NumberArray
, is used to
represent arbitrary shaped arrays of the C language char
data
type in an efficient manner. Although this class implements much of its
own functionality it is documented within the NumberArray
and
Array
classes because the interface is shared by all subclasses
of the NumberArray
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is used to represent constants. Constants are objects which
can never be destroyed or copied. They always retain their value and
when compared, they only equal themselves. An example of a constant
would be an object which represents a true or false condition such
as T
and NIL
in lisp.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are no specific class methods associated with this class. The
default instance creation method (New
) is used.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to override certain default methods in order to insure the “constant” status of instances of this class.
s = gCopy(s) object s; |
This method performs no function and returns the value passed. Its only
use is to insure that there is only one copy of any particular instances
of the Constant
class.
s = gDeepCopy(s) object s; |
This method performs no function and returns the value passed. Its only
use is to insure that there is only one copy of any particular instances
of the Constant
class.
r = gDeepDispose(s) object s; object r; |
This method performs no function and returns the value passed. Its only
use is to insure the undelete-ability of instances of the
Constant
class.
r = gDispose(s) object s; object r; |
This method performs no function and returns the value passed. Its only
use is to insure the undelete-ability of instances of the
Constant
class.
r = gEqual(s, t) object s; object t; int r; |
This method checks for the equality of two objects (s
and t
).
If they are the same constant a 1 is returned and 0 otherwise.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Date
class is a subclass of the LongInteger
class and used to represent dates. The equivalent C language
representation would be a long integer in the form YYYYMMDD
so July 23, 1993 would be represented as 19930723L.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Date
class has only one class method. The New
method is inherited from the LongInteger
class.
i = gCalToJul(Date, dt); long i; long dt; |
This class method returns a julian date calculated from the input calendar date.
Example: long x; x = gCalToJul(Date, 20000605L); /* x = julian date 730276L */ |
See also: JulToCal::Date, Julian::Date
i = gFixInvalidDate(Date, mode); int i; int mode; |
This class method sets the method of handling invalid dates. The previous mode is returned.
The list of valid modes is as follows:
0 Does nothing. Leaves the date invalid. 1 Changes the date to be the last day of the month. 2 Changes the date to be the corresponding day of the next month. |
Example: int x; x = gFixInvalidDate(Date, 1); /* x = the previous mode */ |
i = gJulToCal(Date, jdt); long i; long jdt; |
This class method returns a calendar date calculated from the input julian date.
Example: long x; x = gCalToJul(Date, 730276L); /* x = calendar date 20000605L */ |
See also: CalToJul::Date, Julian::Date
i = gToday(Date); object i; |
This class method creates instances of the Date
class which
represents the current date contained within the system.
Example: object x; x = gToday(Date); /* x = the current date */ |
See also: FormatDate::Date, Dispose::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A portion of the Date
class’s functionality is obtained through
its inheritance of the LongInteger
class. The remaining
functionality is defined by the following specific methods.
i = gAddDays(i, days); object i; long days; |
This method is used to add an arbitrary number of days (days
) to
date i
. Leap years and the correct number of days in each month
are accounted for. The value returned is the object passed.
Example: object dt; dt = gNewWithLong(Date, 19940130L); gAddDays(dt, 2L); /* dt contains 19940201 */ |
See also: AddMonths::Date, AddYears::Date
i = gAddMonths(i, m); object i; int m; |
This method is used to add an arbitrary number of months (m
) to
date i
. The correct number of months in each year
is accounted for. The value returned is the object passed.
Example: object dt; dt = gNewWithLong(Date, 19940104L); gAddMonths(dt, 2); /* dt contains 19940304 */ |
See also: AddDays::Date, AddYears::Date
i = gAddYears(i, y); object i; int y; |
This method is used to add an arbitrary number of years (y
) to
date i
. The value returned is the object passed.
Example: object dt; dt = gNewWithLong(Date, 19940104L); gAddYears(dt, 2); /* dt contains 19960104 */ |
See also: AddDays::Date, AddMonths::Date
i = gChangeDateValue(i, dt); object i; long dt; |
This method is used to change the date associated with an instance of
the Date
class. Notice that this method returns the instance
being passed. dt
is the new date.
Example: object x; x = gNewWithLong(Date, 20000101L); gChangeLongValue(x, 20000605L); |
See also: ChangeLongValue::Number
dt = gDateValue(i); object i; long dt; |
This method is used to obtain the long
value that represents
the date associated with an instance the Date
class. Note that
this is one of the few generics which doesn’t return a Dynace object.
It returns a long
.
Example: object x; long dt; x = gNewWithLong(LongInteger, 20000605L); dt = gDateValue(x); /* dt = 20000605L */ |
See also: LongValue::Number
s = gDayName(i); object i; object s; |
This method returns an instance of the String
class which represents
the day of the week associated with instance i
.
Example: object s, dt; dt = gToday(Date); s = gDayName(dt); /* s contains "Monday" (or whatever) */ |
See also: FormatDate::Date, MonthName::Date
r = gDifference(i, dt); object i; object dt; long r; |
This method is used to obtain the difference, in days, between two date objects. Leap years and the correct number of days per month is accounted for.
Example: object dt1, dt2; long r; dt1 = gNewWithLong(Date, 19940104L); dt2 = gNewWithLong(Date, 19940204L); r = gDifference(dt2, dt1); /* r = 31L */ |
s = gFormatDate(i, fmt); object i; char *fmt; object s; |
This method returns an instance of the String
class which is a
formatted representation of the date associated with instance i
.
fmt
is the format specification used to determine the resulting
String
object. Each character in fmt
is sequentially
processed and except for the character ‘%’, they are simply copied to
the resulting String
object. Whenever this method encounters
the ‘%’ character, the character following is used to determine what
aspect and format of the date represented by i
should be added to
the resultant String
object. It works much like the standard C
printf
. The following table indicates the available formatting option
characters:
% the % character w the day of the week (Friday) M the month name (June) m short month name (Feb) d day (8) D day to two places (08) y short year to two places (04) Y full year (1994) s day suffix (th) n month number (6) N month number to two places (06) t current system time (10:05 AM) |
Example: object s, dt; dt = gToday(Date); s = gFormatDate(dt, "%w the %d%s of %M"); /* s contains "Monday the 1st of March" (or whatever) */ |
See also: MonthName::Date, DayName::Date
jdt = gJulian(i); object i; object jdt; |
This method returns a Julian date representation of the date
associated with instance i
.
Example: object jdt, dt; dt = gToday(Date); jdt = gMonthName(dt); /* s contains a Julian Date */ |
See also: CalToJul::Date, JulToCal::Date
s = gMonthName(i); object i; object s; |
This method returns an instance of the String
class which represents
the month of the year associated with instance i
.
Example: object s, dt; dt = gToday(Date); s = gMonthName(dt); /* s contains "June" (or whatever) */ |
See also: FormatDate::Date, DayName::Date
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the value associated with i
. This is often
used to print or display the value. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
Example: object x; object s; x = gNewWithLong(Date, 20000605L); s = gStringRepValue(x); /* s represents "6/05/00" */ |
See also: PrintValue::Object, Print::Object, FormatDate::Date
r = gValidDate(i); object i; int r; |
This method is used to determine the validity of a date. If i
is a valid date 1 is returned and 0 otherwise. Leap years and the
number of days in each month are all accounted for.
Example: object dt; int r; dt = gNewWithLong(Date, 19940104L); r = gValidDate(dt); /* r = 1 */ dt = gNewWithLong(Date, 19941404L); r = gValidDate(dt); /* r = 0 */ dt = gNewWithLong(Date, 19940230L); r = gValidDate(dt); /* r = 0 */ |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The DateTime
class uses multiple inheritance to inherit
from both the Date
and the Time
classes and is
used to represent precise moments in time.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The DateTime
class has two class methods to create instances.
i = gNewDateTime(Time, dt, tm); long dt, tm; object i; |
This class method creates instances of the DateTime
class. dt
represents the initial date value represented and tm
represents
the initial time value.
Example: object x; x = gNewWithLong(DateTime, 19990402L, 132345678L); /* x = 4/02/1999 1:23:45.678 pm */ |
See also: Now::DateTime, Dispose::Object
i = gNow(DateTime); object i; |
This class method creates instances of the DateTime
class which
represents the current time contained within the system.
Example: object x; x = gNow(DateTime); /* x = the current date and time */ |
See also: NewDateTime::DateTime, Dispose::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A portion of the DateTime
class’s functionality is obtained through
its inheritance of the Date
class and of the Time
. The
remaining functionality is defined by the following specific methods.
i = gAddHours(i, hours); object i; long hours; |
This method is used to add an arbitrary number of hours (hours
) to
date and time i
. Adding an hour that goes past midnight will cause the time
to cycle around to morning and add a day. Leap years and the correct number of
days in each month are accounted for. The value returned is the object passed.
Example: object d; d = gNewDateTime(DateTime, 19990402L, 234500000L); gAddHours(d, 2L); /* d contains 19990403L, 14500000L (4/03/1999 1:45:00.000 am) */ |
See also: AddMilliseconds::DateTime, AddMinutes::DateTime,
AddSeconds::DateTime
i = gAddMilliseconds(i, m); object i; long m; |
This method is used to add an arbitrary number of milliseconds (m
) to
date and time i
. Adding a millisecond that goes past midnight will cause
the time to cycle around to morning and add a day. Leap years and the correct
number of days in each month are accounted for. The value returned is the
object passed.
Example: object d; d = gNewDateTime(DateTime, 19990402L, 234500000L); gAddMilliseconds(d, 20L); /* d contains 19990402L, 234500000L (4/02/1999 11:45:00.020 pm) */ |
See also: AddHours::DateTime, AddMinutes::DateTime,
AddSeconds::DateTime
i = gAddMinutes(i, m); object i; long m; |
This method is used to add an arbitrary number of minutes (m
) to
date and time i
. Adding a minute that goes past midnight will cause the time
to cycle around to morning and add a day. Leap years and the correct number of
days in each month are accounted for. The value returned is the object passed.
Example: object d; d = gNewDateTime(DateTime, 19990402L, 234500000L); gAddMinutes(d, 20L); /* d contains 19990403L, 500000L (4/03/1999 1:05:00.000 am) */ |
See also: AddHours::DateTime, AddMilliseconds::DateTime,
AddSeconds::DateTime
i = gAddSeconds(i, s); object i; long s; |
This method is used to add an arbitrary number of seconds (s
) to
date and time i
. Adding a second that goes past midnight will cause
the time to cycle around to morning and add a day. Leap years and the correct
number of days in each month are accounted for. The value returned is the
object passed.
Example: object d; d = gNewDateTime(DateTime, 19990402L, 234500000L); gAddSeconds(d, 20L); /* d contains 19990402L, 234520000L (4/02/1999 11:45:20.000 pm) */ |
See also: AddHours::DateTime, AddMilliseconds::DateTime,
AddMinutes::DateTime
i = gChangeDateTimeValues(i, dt, tm); object i; long dt, tm; |
This method is used to change the date and time values associated
with an instance of the DateTime
class. Notice that this method
returns the instance being passed. dt
is the new date value and
tm
is the new time value and.
Example: object d; d = gNewDateTime(DateTime, 19990402L, 234500000L); gChangeDateTimeValues(d, 19981231L, 44500000L); /* d contains 12/31/1998 4:45:00.000 am */ |
See also: ChangeLongValue::DateTime, NewDateTime::DateTime
i = gChangeLongValue(i, val); object i; long val; |
This method is used to change the date value associated with an
instance of the DateTime
class. Notice that this method
returns the instance being passed. val
is the new date value.
The time value associated with the instance of the DateTime
class is reset to 0L (midnight).
Example: object d; d = gNewDateTime(DateTime, 19990402L, 234500000L); gChangeLongValue(tm, 19991231L); /* d contains 12/31/1999 12:00:00.000 am */ |
See also: ChangeDateTimeValues::DateTime, NewDateTime::DateTime
r = gCompare(i, obj); object i; object obj; int r; |
This method is used by the generic container classes to determine
the relationship of the values represented by i
and obj
.
r
is -1 if the date / time represented by i
is less than
the date / time represented by obj
, 1 if the date / time value of
i
is greater than obj
, and 0 if they are equal.
See also: Hash::DateTime
i = gDateTimeDifference(i, d, dd, td); object i, d; long *dd, *td; |
This method is used to obtain the difference, in days and milliseconds, between two time objects. dd is loaded with the difference in days and td is loaded with the difference in milliseconds. Notice that this method returns the instance being passed.
Example: object d1, d2; long dd, td; d1 = gNewDateTime(DateTime, 19990402L, 234500000L); d2 = gNewDateTime(DateTime, 19990403L, 234500111L); gDateTimeDifference(d2, d1, &dd, &td); /* dd = 1L, td = 111L */ |
i = gDateTimeValues(i, dt, tm); object i; long *dt, *tm; |
This method is used to obtain the long
values that represent
the date and time associated with an instance the DateTime
class.
Notice that this method returns the instance being passed.
Example: object x; long dt, tm; x = gNewDateTime(DateTime, 19990402L, 234500000L); gDateTimeValues(x, &dt, &tm); /* dt = 19990402L and tm = 234500000L */ |
See also: NewDateTime::DateTime, ChangeDateTimeValues::Time
s = gFormatDateTime(i, dtFmt, tmFmt); object i; char *dtFmt; char *tmFmt; object s; |
This method returns an instance of the String
class which is a
formatted representation of the date and time associated with instance
i
. dtFmt
is the format specification (see FormatDate::Date
)
used to determine the date portion of the resulting String
object.
tmFmt
is the format specification (see FormatTime::Time
)
used to determine the time portion of the resulting String
object.
Example: object s, dt; dt = gNow(DateTime); s = gFormatDateTime(dt, "%w the %d%s of %M at ", "%h:%M %p"); /* s = "Monday the 1st of March at 9:45 am" (or whatever) */ |
See also: FormatDate::Date, FormatTime::Time
val = gHash(i); object i; int val; |
This method is used by the generic container classes to obtain hash values
for the date / time object. val
is a hash value between 0 and a large
integer value.
See also: Compare::DateTime
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the time associated with i
. This is often
used to print or display the date and time. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
Example: object x; object s; x = gNewDateTime(DateTime, 19991231L, 234500000L); s = gStringRepValue(x); /* s represents "1999-12-31 11:45:00.000 pm" */ |
See also: PrintValue::Object, Print::Object
r = gValidDateTime(i); object i; int r; |
This method is used to determine the validity of a date / time.
If i
is a valid date / time 1 is returned and 0 otherwise.
Example: object d; int r; d = gNewDateTime(DateTime, 19991231L, 234500000L); r = gValidDateTime(tm); /* r = 1 */ d = gNewDateTime(DateTime, 19941404L, 234500000L); r = gValidDateTime(tm); /* r = 0 */ d = gNewDateTime(DateTime, 19991231L, 254500899L); r = gValidDateTime(tm); /* r = 0 */ |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Dictionary
class combines the functionality of the Set
and ObjectAssociation
classes in order to store a collection of
arbitrary key/value pairs. The key may be any unique Dynace object.
The gHash
and gCompare
generics are used in order to
access and compare the objects.
This class is a subclass of the Set
class and therefore inherits
all of its functionality.
See the examples included with the Dynace system for an illustration of the
use of the Set
/Dictionary
related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are no class methods for this class. It inherits the ability
to create instances of itself through its superclass, Set
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to add, retrieve
and remove key/value pairs from the Dictionary
. Note that additional
functionality may be obtained through its superclass, Set
.
r = gAddValue(i, key, value); object i; object key object value; /* or NULL */ object r; |
This method is used to add a new key/value pair to the Dictionary
instance (i
). If an object with the same key already exists in
the Dictionary
it will be left as is and AddValue
will return
NULL
. If the key/value objects are added AddValue
will
return the ObjectAssociation
instance created to represent the
key/value pair passed.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
See also: Find::Dictionary, FindValue::Dictionary,
RemoveObj::Dictionary
r = gChangeValueWithObj(i, key, value); object i; object key; object value; /* or NULL */ object r; |
This method is used to change the value associated with an existing
key/value pair to the Dictionary
instance (i
).
key
represents the identity of the pre-existing key/value
pair and value
represents the new value to be associated with
the key.
Normally, this method changes the value part of the association
and returns the previous value which is not disposed. If
key
doesn’t identify a pre-existing association, this method
simply returns NULL
.
See also: Find::Dictionary, FindValue::Dictionary,
RemoveObj::Dictionary
r = gDeepDisposeObj(i, key); object i; object key; object r; |
This method is used to remove and dispose of a key/value pair from a
Dictionary
. If found and removed i
is returned. If key
is not found NULL
is returned.
The key, value and ObjectAssociation
used to bind the two are all deep
disposed.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
This method is the same as DisposeObj::Dictionary
.
See also: RemoveObj::Dictionary
r = gDispose(i); object i; object r; /* NULL */ |
This method is used to dispose of an entire Dictionary
. It does not
dispose of any of the keys or values but does dispose of all the
associations used to represent the pair.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: RemoveObj::Dictionary, DeepDispose::Set,
DisposeAllNodes::Dictionary
i = gDisposeAllNodes(i); object i; |
This method is used to remove all objects in a Dictionary
instance without disposing of the instance itself. The objects in the
Dictionary
are simply disassociated from the Dictionary
instance and are not disposed.
The value returned is always the instance passed.
See also: DeepDisposeAllNodes::Set, Dispose::Dictionary
r = gDisposeObj(i, key); object i; object key; object r; |
This method is used to remove and dispose of a key/value pair from a
Dictionary
. If found and removed i
is returned. If key
is not found NULL
is returned.
The key, value and ObjectAssociation
used to bind the two are all deep
disposed.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
This method is the same as DeepDisposeObj::Dictionary
.
See also: RemoveObj::Dictionary
r = gFind(i, key); object i; object key; object r; |
This method is used to find the instance of the ObjectAssociation
class
which is used to represent the key/value pair stored under key
in
Dictionary
i
. If key
is not found NULL
is returned.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
See also: FindValue::Dictionary
r = gFindAddValue(i, key, value); object i; object key; object value; /* or NULL */ object r; |
This method is used to find and return the instance of the
ObjectAssociation
class used to represent the key/value pair stored
under the key key
. If it is not found a new ObjectAssociation
will be
added and returned which represent the key/value pair representing
key
and value
.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
See also: Find::Dictionary, FindValue::Dictionary
r = gFindValue(i, key); object i; object key; object r; |
This method is used to find the value stored under key
in
Dictionary
i
. If key
is not found NULL
is
returned.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
See also: Find::Dictionary
r = gRemoveObj(i, key); object i; object key; object r; |
This method is used to remove a key/value pair from a Dictionary
.
If found and removed i
is returned. If key
is not found
NULL
is returned.
The key and value are not disposed, however, the ObjectAssociation
used
to bind the two is.
key
may be any Dynace object. The gHash
and
gCompare
generics are used to find and compare the various
objects in the Dictionary
.
See also: DeepDisposeObj::Dictionary
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The DoubleFloat
class is used to represent the C language
double
data type as a Dynace object. It is a subclass of the
Number
class. Even though the DoubleFloat
class
implements most of its own functionality, it is documented as part of
the Number
class because most of the interface is the same for
all subclasses of the Number
class. Differences are documented
in this section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The DoubleFloat
class has only one class method and it is used to
create new instances of itself.
i = gNewWithDouble(DoubleFloat, val); double val; object i; |
This class method creates instances of the DoubleFloat class. val
is the initial value of the number being represented.
The value returned is a Dynace instance object which represents the number passed.
Note that the default disposal methods are used by this class since there are no special storage allocation requirements.
Example: object pi; pi = gNewWithDouble(DoubleFloat, 3.14159265358979); |
See also: DoubleValue::Number, Dispose::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with the DoubleFloat
class provide
a means of changing and obtaining the value associated with an instance
of the DoubleFloat
class. Most of the DoubleFloat
class
instance methods are documented in the Number
class because of
their common interface with all other subclasses of the Number
class. The remainder are documented in this section.
i = gRound(i, pl); object i; int pl; |
This method is used to round the value represented by i
to
pl
decimal places. The object returned is the rounded
object passed.
Example: object pi; pi = gNewWithDouble(DoubleFloat, 3.14159265358979); gRound(pi, 4); /* pi = 3.1416 */ |
See also: DoubleValue::Number, Truncate::DoubleFloat
i = gTruncate(i, pl); object i; int pl; |
This method is used to truncate the value represented by i
to
pl
decimal places. The object returned is the truncated
object passed.
Example: object pi; pi = gNewWithDouble(DoubleFloat, 3.14159265358979); gTruncate(pi, 4); /* pi = 3.1415 */ |
See also: DoubleValue::Number, Round::DoubleFloat
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, which is a subclass of NumberArray
, is used to
represent arbitrary shaped arrays of the C language double
data
type in an efficient manner. Although this class implements much of its
own functionality it is documented within the NumberArray
and
Array
classes because the interface is shared by all subclasses
of the NumberArray
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is used to encapsulate the standard C stream IO facility. It
is a subclass of Stream
and enables access to these routines
through an interface which is common to all subclasses of Stream
.
Although this class implements most of its own functionality, it is
documented as part of the Stream
class because most of the
interface is the same for all subclasses of Stream
. Differences
are documented in this section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The class methods associated with this class are methods used to open or create files.
i = gFlush(File); int i; |
This class method is used to flush all files opened with the stream IO system to disk. It returns the number of opened streams.
Example: gFlush(File); |
See also: instance Flush::File
i = gOpenFile(File, name, mode); char *name; /* file name */ char *mode; /* file mode */ object i; |
This class method is used to open or create a normal file using the
C stream IO facility. The name
and mode
parameters
correspond to the local C library function fopen
. The
local library manuals can more completely describe those arguments.
The value returned is an object which refers to the opened file.
If the file cannot be opened a NULL
will be returned.
Example: object f; f = gOpenFile(File, "myfile", "r"); |
See also: OpenTempFile::File, Dispose::File, Read::Stream
i = gOpenTempFile(File); object i; |
This class method is used to create a tempoary file using the C stream
IO facility. The location of the file will be dictated by the
TMP
or TEMP
environment variables (in that order). If
those variables are not defined then the current directory is used. The
file is created with the "w+"
binary mode.
The value returned is an object which refers to the opened file. Since
this is a temporary file, disposing of this object will also cause the
file to be removed. If the file cannot be opened a NULL
will be
returned.
Example: object f; f = gOpenTempFile(File); |
See also: SetTempSubDir::File, OpenFile::File, Dispose::File, Read::Stream
i = gSetTempSubDir(File, dir); char *dir; object i; |
This class method is used to specify a path for the system to use to
create temporary files (using gOpenTempFile
. The given directory
is appended to the normal system temp path. For example, if the system
path is ‘/tmp
’ and dir
is passed "App"
then the
path used will be ‘/tmp/App
’.
The value returned is File
.
Example: gSetTempSubDir(File, "Application"); |
See also: OpenTempFile::File
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to read and write data to the file represented by the instance.
Although this class implements most of its own functionality, it is
documented as part of the Stream
class because most of the
interface is the same for all subclasses of Stream
. Differences
are documented in this section.
r = gDeepDispose(i); object i; object r; /* NULL */ |
This method is used to close the file associated with the instance and
dispose of the instance. It performs the same function as
Dispose::File
.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::File, OpenFile::File
r = gDispose(i); object i; object r; /* NULL */ |
This method is used to close the file associated with the instance and
dispose of the instance. It performs the same function as
DeepDispose::File
.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: DeepDispose::File, OpenFile::File
i = gFlush(file); object file; int i; |
This method is used to flush the stream associated with file to disk. It returns zero on success.
Example: gFlush(file); |
See also: class Flush::File
n = gName(i); object i; char *n; /* the file name */ |
This method is used to obtain the name of the file represented by i
.
fp = gPointerValue(i); object i; FILE *fp; |
This method is used to obtain the file pointer associated with i
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The FindFile
class is designed to provide a portable means of
enumerating over the file names contained within a particular file
system directory. Currently, this class has only been ported to the DOS
and all Windows environments. There is no current support for Unix or
Macintosh environments.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The only class method used in this class is one to create instances of itself.
i = gNewFindFile(FindFile, name, attr); char *name; int attr; object i; |
This class method creates instances of the FindFile
class. Each
such instance is initialized to enable the instance to enumerate through
all the file names which meet a particular set of parameters.
The name
parameter is used to specify the pattern of the file name
to be searched for. This pattern may or may not contain a relative or
absolute directory path but must contain some wildcard
characters (such as “?” and “*”).
The attr
parameter is used to narrow the search to file names
which contain certain attributes. The list of available attribute
type (which should be or’ed together) is as follows:
FF_FILE include regular files FF_DIRECTORY include directories FF_READWRITE include files or directories in which you have read/write permission FF_READONLY include files or directories in which you only have read permission FF_ARCHIVE_ONLY don't include files/directories which don't have their archive bit set FF_HIDDEN include hidden files FF_SYSTEM include system files |
The new instance is returned.
Example: object ff; char *file; ff = gNewFindFile(FindFile, "*.c", FF_FILE | FF_READWRITE); while (file = gNextFile(ff)) { do something with file } gDispose(ff); |
See also: NextFile::FindFile
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class provide a means for sequentially enumerating through the selected file names and obtaining some degree of information associated with each particular file.
attr = gAttributes(ff); object ff; unsigned attr; |
This method is used to obtain attribute information relating to the last
selected file returned from NextFile
. The attribute flags are those
defined under NewFindFile
. If no valid file has been returned from
NextFile
this function simply returns 0.
Example: object ff; char *file; unsigned attr; ff = gNewFindFile(FindFile, "*.*", FF_FILE | FF_DIRECTORY | FF_READWRITE); while (file = gNextFile(ff)) { attr = gAttributes(ff); if (attr & FF_DIRECTORY) handle a directory else if (attr & FF_FILE) handle a file } gDispose(ff); |
See also: NewFindFile::FindFile, NextFile::FindFile,
WriteTime::FindFile
len = gLength(ff); object ff; long len; |
This method is used to obtain the length or size (in bytes) of the file
relating to the last selected file returned from NextFile
. If
no valid file has been returned from NextFile
this function
simply returns -1.
Example: object ff; char *file; long len; ff = gNewFindFile(FindFile, "*.c", FF_FILE | FF_READWRITE); while (file = gNextFile(ff)) { len = gLength(ff); } gDispose(ff); |
See also: Attributes::FindFile, NextFile::FindFile
nam = gName(ff); object ff; char *nam; |
This method is used to obtain the name of the last file found via
NextFile
. It will be the same name as returned from
NextFile
. If no valid file has been returned from
NextFile
this function simply returns NULL
.
Example: object ff; char *file; ff = gNewFindFile(FindFile, "*.c", FF_FILE | FF_READWRITE); while (gNextFile(ff)) { file = gName(ff); } gDispose(ff); |
See also: NextFile::FindFile
nam = gNextFile(ff); object ff; char *nam; |
This method is used to obtain the next file name in the sequential list
specified when using NewFindFile
. It also changes the context
associated with the object ff
such that all other methods
operated on ff
will refer to the file returned in the last call
to this method. In spite of the name of this method, it is also used
to obtain the first file name in the list, therefore, this method must
be called prior to any other method on ff
in order to obtain
the first file context.
This method returns the name of the file associated with the file
context this method establishes. If there is no first file or
additional files this method returns NULL
.
See also: NewFindFirst::FindFile
tim = gWriteTime(ff); object ff; long tim; |
This method is used to obtain the date and time the file associated
with the ff
context was last written to. The value returned
can be typecast to the common time_t
type and represents the
number of seconds past some date like 1970. If no valid file
context was setup via NextFile
, this method returns -1.
See also: Attributes::FindFile, NextFile::FindFile
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, which is a subclass of NumberArray
, is used to
represent arbitrary shaped arrays of the C language float
data
type in an efficient manner. Although this class implements much of its
own functionality it is documented within the NumberArray
and
Array
classes because the interface is shared by all subclasses
of the NumberArray
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, which is a subclass of NumberArray
, is used to
represent arbitrary shaped arrays of the C language int
data type
in an efficient manner. Although this class implements much of its own
functionality it is documented within the NumberArray
and
Array
classes because the interface is shared by all subclasses
of the NumberArray
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is a subclass of Association
and is used to represent
an association between a C language int
and an arbitrary Dynace
object. It performs all the functions as the LookupKey
and
ObjectAssociation
classes and is used in conjunction with the
Set
and Dictionary
classes. The purpose of this class is
to provide an efficient mechanism to form a common association.
See the examples included with the Dynace system for an illustration of the
use of the Set
/Dictionary
related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The only class method associated with this class is one needed to create new instances of itself.
i = gNewWithIntObj(IntegerAssociation, key, val); int key; object val; /* or NULL */ object i; |
This class method creates instances of the IntegerAssociation
class. key
is used to initialize the key associated with the
instance created and val
is used to initialize its associated
value.
The new instance is returned.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to obtain,
change and print the key and value associated with the instance.
Additional functionality, although implemented by this class, is documented
in IntegerAssociation
’s superclass, Association
. This is done
because of the common interface these methods share with all subclasses
of Association
.
i = gChangeIntKey(i, key); object i; int key; |
This method is used to change the key associated with instance i
.
key
is the new key. The old key is simply replaced. This method
returns i
.
See also: IntKey::IntegerAssociation,
ChangeValue::IntegerAssociation
old = gChangeValue(i, val); object i; object val; /* or NULL */ object old; |
This method is used to change the value associated with
i
to a value, val
. The old
value is simply no longer associated with the instance. It is not
disposed. This method returns the old value being replaced.
See also: Value::IntegerAssociation,
ChangeIntKey::IntegerAssociation
c = gDeepCopy(i); object i, c; |
This method is used to create a new instance of the
IntegerAssociation
class which contains a copy of the value
from the original IntegerAssociation
. DeepCopy
is used to
create the copy of the value. The new IntegerAssociation
instance
is returned.
See also: Copy::Object
r = gDeepDispose(i); object i; object r; /* NULL */ |
This method is used to dispose of a IntegerAssociation
instance.
It also disposes of the value associated with the instance by the
use of its DeepDispose
method.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::Object
key = gIntKey(i); object i; int key; |
This method is used to obtain the integer key associated with instance i
.
See also: ChangeIntKey::IntegerAssociation
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the value associated with i
. This is often
used to print or display the value. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
See also: PrintValue::Object, Print::Object
val = gValue(i); object i; object val; |
This method is used to obtain the value associated with
i
.
See also: ChangeValue::IntegerAssociation,
IntKey::IntegerAssociation
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class combines the functionality of the Set
and IntegerAssociation
classes in order to store a collection of
arbitrary key/value pairs.
The difference between this class and the Dictionary
class is
that this class only accepts C language int
values as keys.
This class provides an efficient and simple to use means of representing
a commonly needed collection.
This class is a subclass of the Set
class and therefore inherits
all of its functionality.
See the examples included with the Dynace system for an illustration of the
use of the Set
/Dictionary
related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are no class methods for this class. It inherits the ability
to create instances of itself through its superclass, Set
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to add, retrieve
and remove key/value pairs from the Dictionary
. Note that additional
functionality may be obtained through its superclass, Set
.
r = gAddInt(i, key, value); object i; int key object value; object r; |
This method is used to add a new key/value pair to the Dictionary
instance (i
). If an object with the same key already exists in
the Dictionary
it will be left as is and AddInt
will return
NULL
. If the key/value objects are added AddInt
will
return the IntegerAssociation
instance created to represent the
key/value pair passed.
See also: FindInt::IntegerDictionary,
FindValueInt::IntegerDictionary,
ChangeValueWithInt::IntegerDictionary,
RemoveInt::IntegerDictionary
r = gChangeValueWithInt(i, key, value); object i; int key object value; object r; |
This method is used to change the value associated with an existing
key/value pair to the IntegerDictionary
instance (i
).
key
represents the identity of the pre-existing key/value
pair and value
represents the new value to be associated with
the key.
Normally, this method changes the value part of the association
and returns the previous value which is not disposed. If
key
doesn’t identify a pre-existing association, this method
simply returns NULL
.
See also: FindInt::IntegerDictionary,
FindValueInt::IntegerDictionary,
RemoveInt::IntegerDictionary
r = gDeepDisposeInt(i, key); object i; int key; object r; |
This method is used to remove and dispose of a key/value pair from a
Dictionary
. If found and removed i
is returned. If key
is not found NULL
is returned.
The value and IntegerAssociation
used to bind the two are all deep
disposed.
This method is the same as DisposeInt::IntegerDictionary
.
See also: RemoveInt::IntegerDictionary
r = gDispose(i); object i; object r; /* NULL */ |
This method is used to dispose of an entire Dictionary
. It does not
dispose of any of the values but does dispose of all the associations
used to represent the pair.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: RemoveInt::IntegerDictionary, DeepDispose::Set,
DisposeAllNodes::IntegerDictionary
i = gDisposeAllNodes(i); object i; |
This method is used to remove all objects in an IntegerDictionary
instance without disposing of the instance itself. The objects in the
IntegerDictionary
are simply disassociated from the
IntegerDictionary
instance and are not disposed.
The value returned is always the instance passed.
See also: DeepDisposeAllNodes::Set, Dispose::IntegerDictionary
r = gDisposeInt(i, key); object i; int key; object r; |
This method is used to remove and dispose of a key/value pair from a
Dictionary
. If found and removed i
is returned. If key
is not found NULL
is returned.
The value and IntegerAssociation
used to bind the two are all deep
disposed.
This method is the same as DeepDisposeInt::IntegerDictionary
.
See also: RemoveInt::IntegerDictionary
r = gFindInt(i, key); object i; int key; object r; |
This method is used to find the instance of the IntegerAssociation
class which is used to represent the key/value pair stored under
key
in Dictionary
i
. If key
is not found
NULL
is returned.
See also: FindValueInt::IntegerDictionary
r = gFindAddInt(i, key, value); object i; int key; object value; object r; |
This method is used to find and return the instance of the
IntegerAssociation
class used to represent the key/value pair
stored under the key key
. If it is not found a new
IntegerAssociation
will be added and returned which represent the
key/value pair representing key
and value
.
See also: FindInt::IntegerDictionary,
FindValueInt::IntegerDictionary
r = gFindValueInt(i, key); object i; int key; object r; |
This method is used to find the value stored under key
in
Dictionary
i
. If key
is not found NULL
is
returned.
See also: FindInt::IntegerDictionary
r = gRemoveInt(i, key); object i; int key; object r; |
This method is used to remove a key/value pair from a Dictionary
.
If found and removed i
is returned. If key
is not found
NULL
is returned.
The value is not disposed, however, the IntegerAssociation
used to
bind the two is.
See also: DeepDisposeInt::IntegerDictionary
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Link
class is used to represent a single link in a doubly
linked list. It is normally used in conjunction with the
LinkList
class in order to manage arbitrary objects on a doubly
linked list data structure.
Since instances of the Link
class only contain enough information
to describe the link, the Link
class can be thought of as an
abstract class. It is never used by itself (instances of it are never
created). Instead a new class would be created which would have the
Link
class as a superclass. This new class would describe
the data items which would be stored at each link. The Link
class would keep track of its place in the linked list.
The Link
class also has a subclass called LinkValue
which
allows a single arbitrary object to be stored at each link.
See the examples included with the Dynace system for an illustration of the use of the doubly linked list related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Link
class has only a single class method. That method is used
to create and initialize new instances of itself.
i = gNew(Link); object i; |
This class method creates instances of the Link class. It is usually
only used by subclasses of the Link
class. The new link
will not point to anything. It will just be an empty link.
This method is actually just inherited from Object
in order
to create a null link.
The value returned is the instance object created (the new link).
See also: Dispose::Link
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instances methods associated with the Link
class are used to
link, unlink, move and dispose of particular instances of the
Link
class or (more often) one of its subclasses.
i = gAddAfter(i, lnk); object i; object lnk; |
This method is used to insert a new link (lnk
) after another
link (i
) on the linked list which link i
is on. In order
to accomplish this it modifies pointers in link i
, link
lnk
and the link (if any) which is after link i
in
the associated linked list structure.
Link lnk
must not already be a member of another list.
This method returns its first argument.
See also: AddBefore::Link
i = gAddBefore(i, lnk); object i; object lnk; |
This method is used to insert a new link (lnk
) before another
link (i
) on the linked list which link i
is on. In order
to accomplish this it modifies pointers in link i
, link
lnk
and the link (if any) which is prior to link i
in
the associated linked list structure.
Link lnk
must not already be a member of another list.
This method returns its first argument.
See also: AddAfter::Link, ChangeNext::Link,
ChangePrevious::Link
i = gChangeNext(i, nxt); object i; object nxt; |
This method is used to change the next pointer of a particular link
represented by instance i
. nxt
is the link to be pointed
to or NULL
. This method does not effect the instance pointed to
by nxt
.
This method returns the link passed in its first argument.
See also: ChangePrevious::Link, Next::Link
i = gChangePrevious(i, prev); object i; object prev; |
This method is used to change the previous link pointer of a particular
link represented by instance i
. prev
is the link to be
pointed to or NULL
. This method does not effect the instance
pointed to by prev
.
This method returns the link passed in its first argument.
See also: ChangeNext::Link, Previous::Link
c = gCopy(i); object i, c; |
This method is used to create a new object which is of the same type as its argument. However, the new link will not point to the same links. It will be uninitialized.
The new object is returned.
See also: DeepCopy::Link, Copy::Object
This method performs the same function as Copy::Link
.
r = gDeepDispose(i); object i; object r; /* NULL */ |
This method is used to unlink and dispose of a link object.
It performs the same function as the Dispose
method.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::Link, Remove::Link
r = gDispose(i); object i; object r; /* NULL */ |
This method is used to unlink and dispose of a link object.
It performs the same function as the DeepDispose
method.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: DeepDispose::Link, Remove::Link
lnk = gInitLink(lnk, lst, prev, nxt); object lnk; object lst; object prev; object nxt; |
This method is used to initialize a link. lst
is the list it will
be associated with and prev
and nxt
are used to initialize
the link pointers. Each argument must either be a link or NULL
.
The link passed is returned.
See also: Previous::Link, Next::Link
lst = gList(i); object i; object lst; |
This method is used to obtain the list object which link i
is on. NULL
will be returned if the link is not on a list.
See also: Previous::Link, Next::Link, InitLink::Link
i = gMoveAfter(i, lnk); object i; object lnk; |
This method is used to unlink an arbitrary (located anywhere on the
list) link (i
) from any list and relink it immediately after link
lnk
which may be on the same or a different list. If link
i
wasn’t originally on a list, it will simply be added after
link lnk
.
Link i
is returned.
See also: MoveBefore::Link, MoveBeginning::Link
i = gMoveBefore(i, lnk); object i; object lnk; |
This method is used to unlink an arbitrary (located anywhere on the
list) link (i
) from any list and relink it immediately before link
lnk
which may be on the same or a different list. If link
i
wasn’t originally on a list, it will simply be added before
link lnk
.
Link i
is returned.
See also: MoveAfter::Link, MoveEnd::Link
i = gMoveBeginning(i); object i; |
This method is used to unlink an arbitrary (located anywhere on the list) link and relink it at the beginning of the linked list it’s associated with.
The object passed is returned unless the link was not on a list. In
that case NULL
will be returned.
See also: MoveEnd::Link, MoveAfter::Link
i = gMoveEnd(i); object i; |
This method is used to unlink an arbitrary (located anywhere on the list) link and relink it at the end of the linked list it’s associated with.
The object passed is returned unless the link was not on a list. In
that case NULL
will be returned.
See also: MoveBeginning::Link, MoveBefore::Link
nxt = gNext(i); object i; object nxt; |
This method is used to obtain the link following the link represented by
i
. If no next link exists, NULL
will be returned.
See also: Previous::Link, Nth::Link, List::Link
nxt = gNth(lnk, idx); object lnk; int idx; object nxt; |
This method is used to provide a mechanism to index into a linked list
in a manner similar to an array. If idx
is positive this method
returns the link which is idx
links after lnk
. If idx
is negative this method returns the link which is idx
links prior to
lnk
. If idx
is zero lnk
is returned, and if idx
represents a position beyond the end of the list NULL
is returned.
See also: Previous::Link, Next::Link, List::Link
prev = gPrevious(i); object i; object prev; |
This method is used to obtain the link prior to the link represented by
i
. If no such link exists, NULL
will be returned.
See also: Next::Link, Nth::Link, List::Link
i = gRemove(i); object i; |
This method is used to remove a link (i
) from a linked list. In
addition to effecting link i
, it also effects the pointers
associated with the links which link i
points to in its next and
previous pointers (which may be NULL) to make the removal complete.
This method should have no effect on a link which is not on a list.
This method returns the link passed.
See also: ChangeNext::Link, ChangePrevious::Link
s = gStringRep(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the object i
and its value. This is often used
to print or display a representation of an object. It is also used by
by Print::Object
(a method useful during the debugging phase of
a project) in order to directly print an object to a stream.
See also: Print::Object, PrintValue::Object, StringRepValue::Link
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the value associated with i
. This is often
used to print or display the value. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
Example: object x; object s; x = gNew(Link); s = gStringRepValue(x); |
See also: PrintValue::Object, Print::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Instances of this class are used to coordinate and handle doubly linked
lists as a whole. It is used with instances of the Link
class
(or one of its subclasses) which represent the individual links of
the list.
The Link
class is a superclass of this class. See that class
for functionality which is inherited by this class.
See the examples included with the Dynace system for an illustration of the use of the doubly linked list related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There is only one class method associated with this class and it is used to create new instances of the class.
i = gNew(LinkList); object i; |
This class method creates a new and empty linked list object.
The value returned is the instance object created (the new LinkList).
See also: Dispose::LinkList
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class perform functions to add, change, inquire, enumerate and dispose of links associated with the linked list. They also provide information such as how many links are on the list.
i = gAddFirst(i, lnk); object i; object lnk; |
This method is used to add a new link to the beginning of the linked list.
i
is the linked list, lnk
is the new link (an instance of
the Link
class or one of its subclasses).
The value returned is the linked list passed (i
).
See also: AddLast::LinkList, DisposeFirst::LinkList
i = gAddLast(i, lnk); object i; object lnk; |
This method is used to add a new link to the end of the linked list.
i
is the linked list, lnk
is the new link (an instance of
the Link
class or one of its subclasses).
The value returned is the linked list passed (i
).
See also: AddFirst::LinkList, DisposeLast::LinkList
c = gCopy(i); object i, c; |
This method is used to create a new instance of the LinkList
class
with copies of all the links which were on i
. These copies
are made via Copy
so any values associated with the link are
the same objects as those on i
.
The new LinkList
instance is returned.
See also: DeepCopy::LinkList, Copy::Object
c = gDeepCopy(i); object i, c; |
This method is used to create a new instance of the LinkList
class with copies of all the links and their associated values which
were on i
. These copies are made via DeepCopy
so
the values associated with the links are also copied.
The new LinkList
instance is returned.
See also: Copy::LinkList, Copy::Object
r = gDeepDispose(i); object i; object r; /* NULL */ |
This method is used to dispose of the linked list and all its associated
links. The DeepDispose
method is used to dispose of each link
on the linked list.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::LinkList, Dispose::Object
i = gDeepDisposeAllNodes(i); object i; |
This method is used to dispose of all the links on a linked list without
disposing of the linked list object itself. The DeepDispose
method is used to dispose of the links so all the objects contained on
the links will be deep disposed as well.
This method returns the object passed.
See also: DeepDispose::LinkList, DisposeAllNodes::LinkList
i = gDeepDisposeFirst(i); object i; |
This method is used to unlink and dispose of the first link in the
linked list i
. If there is no first link this method simply
returns.
The first link is disposed of by executing the DeepDispose
method on it.
This method returns the linked list passed.
See also: DeepDisposeLast::LinkList, DisposeFirst::LinkList
i = gDeepDisposeLast(i); object i; |
This method is used to unlink and dispose of the last link in the
linked list i
. If there are no links this method simply
returns.
The last link is disposed of by executing the DeepDispose
method on it.
This method returns the linked list passed.
See also: DeepDisposeFirst::LinkList, DisposeLast::LinkList
r = gDispose(i); object i; object r; /* NULL */ |
This method is used to dispose of the linked list and all its associated
links. The Dispose
method is used to dispose of the links
without disposing of the objects contained on the links.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: DeepDispose::LinkList, DisposeAllNodes::LinkList
i = gDisposeAllNodes(i); object i; |
This method is used to dispose of all the links on a linked list without
disposing of the linked list object itself. The Dispose
method
is used to dispose of the links without disposing of the objects
contained on the links.
This method returns the object passed.
See also: Dispose::LinkList, DeepDisposeAllNodes::LinkList
i = gDisposeFirst(i); object i; |
This method is used to unlink and dispose of the first link in the
linked list i
. If there is no first link this method simply
returns.
The first link is disposed of by executing the Dispose
method on it.
This method returns the linked list passed.
See also: DisposeLast::LinkList, DeepDispose::LinkList,
RemoveFirst::LinkList
i = gDisposeLast(i); object i; |
This method is used to unlink and dispose of the last link in the
linked list i
. If there are no links this method simply
returns.
The last link is disposed of by executing the Dispose
method on it.
This method returns the linked list passed.
See also: DisposeFirst::LinkList, DeepDispose::LinkList,
RemoveLast::LinkList
lnk = gFirst(i); object i; object lnk; |
This method is used to obtain the first link on linked list i
.
If there are no links, this method returns NULL
.
This method does not modify the linked list or the link returned.
See also: Last::LinkList, RemoveFirst::LinkList
i = gIncNelm(i, inc); object i; int lnc; |
Each linked list automatically keeps track of the number of links on it.
This method is used to change that value by inc
. It is mainly
used internally to keep the number accurate and would not normally be
used externally.
lnk = gLast(i); object i; object lnk; |
This method is used to obtain the last link on linked list i
.
If there are no links, this method returns NULL
.
This method does not modify the linked list or the link returned.
See also: First::LinkList, RemoveLast::LinkList
This method has been superseded by Remove::Link
.
See also: Dispose::Link, RemoveFirst::LinkList
lnk = gRemoveFirst(i); object i; object lnk; |
This method is used to unlink the first link from the linked list
i
and return it. The link will no longer be linked on the list.
However, the link is not disposed. If there are no links this method
simply returns NULL
.
This method returns the link removed.
See also: RemoveLast::LinkList, DisposeFirst::LinkList
lnk = gRemoveLast(i); object i; object lnk; |
This method is used to unlink the last link from the linked list
i
and return it. The link will no longer be linked on the list.
However, the link is not disposed. If there are no links this method
simply returns NULL
.
This method returns the link removed.
See also: RemoveFirst::LinkList, DisposeLast::LinkList
s = gSequence(i); object i; object s; |
This method takes an instance of the LinkList
class (i
)
and returns an instance of the LinkSequence
class (s
).
The link list represented by i
is not effected by this operation.
The link sequence item, s
, is used to enumerate through all the
links in link list i
. See the LinkSequence
class for
documentation of other methods needed to use s
.
Example: object ll; /* linked list */ object s; /* link sequence */ object lnk; /* one link */ /* ll must be initialized previously */ for (s=gSequence(ll) ; lnk = gNext(s) ; ) { /* do something with link lnk */ } |
See also: Next::LinkSequence
sz = gSize(i); object i; int sz; |
This method is used to obtain the number of links on the linked list.
s = gStringRep(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the object i
and its value. This is often used
to print or display a representation of an object. It is also used by
by Print::Object
(a method useful during the debugging phase of
a project) in order to directly print an object to a stream.
This method obtains the values of each link by calling StringRepValue
on each link.
See also: Print::Object, PrintValue::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LinkObject
class is a subclass of the LinkList
class.
Since this class inherits much of its functionality from the
LinkList
and Link
classes, see those classes for
additional functionality. It is used in conjunction with the
LinkValue
class in order to manage arbitrary objects on a doubly
linked list data structure.
The difference between this class and the LinkList
class is that
the LinkList
class deals with instances of the Link
class
(or one of its subclasses) which may contain arbitrary objects and the
LinkObject
class deals with arbitrary objects directly. There is
no need to deal with link objects at all. While this simplifies the
usage of a linked lists quite a bit it comes at the expense of
flexibility. However, since the LinkList
class is a superclass
of the LinkObject
class you can often use the inherited
functionality of the LinkList
class in conjunction with the
LinkObject
object. It is, therefore, recommended that the
LinkObject
class be used whenever possible to simplify linked
list operations
This class (LinkObject
) inherits much of its functionality from its
superclass (LinkList
), therefore, in addition to the specific
documentation on this class please also refer to the documentation of
its superclass.
See the examples included with the Dynace system for an illustration of the use of the doubly linked list related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LinkObject
class has no specific class methods. It inherits
all of its abilities from its superclass, LinkList
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class perform functions to
add, inquire and enumerate objects associated with the linked list.
Since this class is a subclass of the LinkList
class, additional
functionality is inherited from it. The LinkList
class
documentation should, therefore, be consulted.
i = gAddFirst(i, obj); object i; object obj; |
This method is used to add a new link to the beginning of the list,
i
, containing the arbitrary object obj
. The list object,
i
, is returned.
Example: object ll, obj; ll = gNew(LinkObject); obj = gNewWithInt(ShortInteger, 44); gAddFirst(ll, obj); |
See also: AddLast::LinkObject, First::LinkObject
i = gAddLast(i, obj); object i; object obj; |
This method is used to add a new link to the end of the list,
i
, containing the arbitrary object obj
. The list object,
i
, is returned.
Example: object ll, obj; ll = gNew(LinkObject); obj = gNewWithInt(ShortInteger, 44); gAddLast(ll, obj); |
See also: AddFirst::LinkObject, Last::LinkObject
obj = gFirst(i); object i; object obj; |
This method is used to obtain the object stored in the first link of the
list i
. If there are no links on the list this method will
return NULL
. The list, i
, is not effected by this operation.
Example: object ll, obj, obj2; ll = gNew(LinkObject); obj = gNewWithInt(ShortInteger, 44); gAddFirst(ll, obj); obj2 = gFirst(ll); /* obj and obj2 are the same object */ |
See also: AddFirst::LinkObject, Last::LinkObject
ll = vGetValues(ll, ...); object ll; |
This method is used to extract numerous values from a LinkObject
instance.
It does this without modifing the list. Each argument must be a pointer to a
variable which is to hold one of the values. The first variable gets the first
object on the list and the second gets the second, etc. The argument list must
end in NULL
to signify the end.
If there are more variables than links on the list the remaining variables will be
set to NULL
. If there are more elements on the list than variables the
remiaining list elements are ignored.
The LinkObject
instance passed is returned unaltered.
Example: object ll, obj1, obj2; object obj3, obj4; obj1 = gNewWithInt(ShortInteger, 44); obj2 = gNewWithInt(ShortInteger, 66); ll = vMakeList(LinkObject, obj1, obj2, NULL); vGetValues(ll, &obj3, &obj4, NULL); |
See also: MakeList::LinkObject, Nth::LinkObject
obj = gLast(i); object i; object obj; |
This method is used to obtain the object stored in the last link of the
list i
. If there are no links on the list this method will
return NULL
. The list, i
, is not effected by this operation.
Example: object ll, obj, obj2; ll = gNew(LinkObject); obj = gNewWithInt(ShortInteger, 44); gAddLast(ll, obj); obj2 = gLast(ll); /* obj and obj2 are the same object */ |
See also: AddLast::LinkObject, First::LinkObject
obj = vMakeList(LinkObject, ...); object obj; |
This method is used to create a new LinkObject
containing all the
objects listed in the method call. For example, if there are five objects listed, the
returned LinkObject
will be a list containing five links, each with
an object associated with it.
Since this is a variable argument method you must tell the system when there are no
more arguments by using a last argument of NULL
. GetValues
can be used to
take the list back apart. All the other LinkObject
methods may be
used as well. The value returned is the new
LinkObject
instance.
Example: object ll, obj1, obj2; obj1 = gNewWithInt(ShortInteger, 44); obj2 = gNewWithInt(ShortInteger, 66); ll = vMakeList(LinkObject, obj1, obj2, NULL); |
See also: GetValues::LinkObject
See Nth::Link
obj = gPop(lst); object lst; object obj; |
This method is used to obtain the first element of a list while
removing it from the list at the same time. It works in conjunction
with gPush
to utilize a list as a stack. obj
is either
the first object on the list or NULL
if the list was empty.
Example: object ll, obj, obj2; ll = gNew(LinkObject); obj = gNewWithInt(ShortInteger, 44); gPush(ll, obj); obj2 = gPop(ll); |
See also: Push::LinkObject
lst = gPush(lst, obj); object lst; object obj; |
This method is used to utilize a linklist as a stack. Pushing is the
same as adding a new link to the beginning of the list. Object
obj
is added (pushed) on list lst
. The list object,
lst
, is returned. This method is the same as gAddFirst
.
Example: object ll, obj; ll = gNew(LinkObject); obj = gNewWithInt(ShortInteger, 44); gPush(ll, obj); |
See also: Pop::LinkObject
s = gSequence(i); object i; object s; |
This method takes an instance of the LinkObject
class (i
)
and returns an instance of the LinkObjectSequence
class
(s
). The link list represented by i
is not effected by
this operation. The link sequence item, s
, is used to enumerate
through all the objects in link list i
. See the
LinkObjectSequence
class for documentation of other methods
needed to use s
.
The difference between the Sequence
and SequenceLinks
methods in this class is that the Sequence
method provides a
means to enumerate over the objects in the linked list and the
SequenceLinks
provides a means to enumerate over the links
which hold the objects in the list.
Example: object ll; /* linked list */ object s; /* link object sequence */ object obj; /* an object */ /* ll must be initialized previously */ for (s=gSequence(ll) ; obj = gNext(s) ; ) { /* do something with obj */ } |
See also: Next::LinkObjectSequence, SequenceLinks::LinkObject
s = gSequenceLinks(i); object i; object s; |
This method takes an instance of the LinkObject
class (i
)
and returns an instance of the LinkSequence
class
(s
). The link list represented by i
is not effected by
this operation. The link sequence item, s
, is used to enumerate
through all the links in link list i
. See the
LinkSequence
class for documentation of other methods
needed to use s
.
The difference between the Sequence
and SequenceLinks
methods in this class is that the Sequence
method provides a
means to enumerate over the objects in the linked list and the
SequenceLinks
provides a means to enumerate over the links
which hold the objects in the list.
Example: object ll; /* linked list */ object s; /* link sequence */ object lnk; /* a link */ /* ll must be initialized previously */ for (s=gSequenceLinks(ll) ; lnk = gNext(s) ; ) { /* do something with link lnk */ } |
See also: Next::LinkSequence, Sequence::LinkObject
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is a subclass of Sequence
and is used to provide a
mechanism to enumerate through all the objects on the links in a linked
list structure without effecting the structure.
The linked list structure is usually represented by instances of the
LinkObject
class. Typically, the Sequence
instance method
of this class is used to create the instances of the
LinkObjectSequence
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There is only one class method associated with this class. It is used
to create new instances of itself and is normally only called by
sequence methods associated with the LinkObject
class.
i = gNewWithObj(LinkObjectSequence, lnk); object lnk; object i; |
This class method creates instances of the LinkObjectSequence
class. It is normally only called by the sequence method associated
with the LinkObject
class. lnk
is the first link in the
list, and i
is the sequence instance.
See also: Next::LinkObjectSequence, Sequence::LinkObject
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class only has a single instance method which is used to enumerate through object on a list.
obj = gNext(i); object i; object obj; |
This method is used to enumerate through the objects contained within
the links on a linked list. Each time Next
is called the
following object on the linked list is returned. It does this in a
non-destructive way so the associated linked list is not effected.
When Next
is called after the last object has been returned (or
if there are no links on the list) it will return NULL
and
automatically dispose of the sequence object i
. Therefore,
the only time Dispose
would be needed (if the garbage collector
weren’t being used) would be if the entire list was not enumerated.
Example: object ll; /* linked object list */ object s; /* link sequence */ object obj; /* an object */ /* ll must be initialized previously */ for (s=gSequence(ll) ; obj = gNext(s) ; ) { /* do something with object obj */ } |
See also: Sequence::LinkObject
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is a subclass of Sequence
and is used to provide a
mechanism to enumerate through all the links in a linked list structure
without effecting the structure.
The linked list structure is usually represented by instances of the
LinkList
or LinkObject
classes. Typically, instance
methods of these classes are used to create the instances of the
LinkSequence
class. These methods have names which begin with
Sequence
.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There is only one class method associated with this class. It is used
to create new instances of itself and is normally only called by
sequence methods associated with the LinkList
or LinkObject
classes.
i = gNewWithObj(LinkSequence, lnk); object lnk; object i; |
This class method creates instances of the LinkSequence
class.
It is normally only called by sequence methods associated with the
LinkList
or LinkObject
classes. lnk
is the first
link in the list, and i
is the sequence instance.
See also: Next::LinkSequence, Sequence::LinkList
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class only has a single instance method which is used to enumerate through links on a list.
lnk = gNext(i); object i; object lnk; |
This method is used to enumerate through the links on a linked list.
Each time Next
is called the following link on the linked list
is returned. It does this in a non-destructive way so the associated
linked list is not effected.
When Next
is called after the last link has been returned (or
if there are no links on the list) it will return NULL
and
automatically dispose of the sequence object i
. Therefore,
the only time Dispose
would be needed (if the garbage collector
weren’t being used) would be if the entire list was not enumerated.
Example: object ll; /* linked list */ object s; /* link sequence */ object lnk; /* one link */ /* ll must be initialized previously */ for (s=gSequence(ll) ; lnk = gNext(s) ; ) { /* do something with link lnk */ } |
See also: Sequence::LinkList, SequenceLinks::LinkObject
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LinkValue
class is a subclass of the Link
class. It is
used in conjunction with the LinkList
class in order to manage
arbitrary objects on a doubly linked list data structure.
Like the Link
class, it is used to represent a single link on a
doubly linked list. However, the LinkValue
class has the
additional capability to store a single arbitrary object at each link.
Therefore, the LinkValue
class may be used without creating a
subclass of it.
This class (LinkValue
) inherits much of its functionality from its
superclass (Link
), therefore, in addition to the specific
documentation on this class please also refer to the documentation of
its superclass.
See the examples included with the Dynace system for an illustration of the use of the doubly linked list related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LinkValue
class has only a single class method. That method
is used to create and initialize new instances of itself.
i = gNewWithObj(LinkValue, item); object item; object i; |
This class method creates instances of the LinkValue class. item
is the object to be associated with the new link.
The value returned is the instance object created (the new link).
See also: Dispose::Link, DeepDispose::LinkValue
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instances methods associated with the LinkValue
class are used to
link, unlink, move and dispose of particular instances of the
LinkValue
class. The majority of its linking type functionality
is inherited from its superclass, Link
.
i = gChangeValue(i, obj); object i; object obj; |
This method is used to change the object associated with a link.
i
is the instance of the LinkValue
class, and
obj
is the new object to be associated with it.
Any previous association is simply disassociated (not disposed).
This method returns i
.
See also: Value::LinkValue, NewWithObj::LinkValue
c = gDeepCopy(i); object i, c; |
This method is used to create a new instance of the LinkValue
class
which contains a copy of the value associated with the link.
DeepCopy
is used to create the copied value.
The new LinkValue
instance is returned.
Note that the new link returned will not be associated with any list.
It will just be an unlinked link.
See also: Copy::Object
r = gDeepDispose(i); object i; object r; /* NULL */ |
This instance method is used to perform a deep disposal of an instance
of the LinkValue
class. It does this by calling gDeepDispose
on the item associated with the link and then calling the link’s
superclass to dispose of the LinkValue
instance.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::Link
s = gStringRep(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the object i
and its value. This is often used
to print or display a representation of an object. It is also used by
by Print::Object
(a method useful during the debugging phase of
a project) in order to directly print an object to a stream.
See also: Print::Object, PrintValue::Object,
StringRepValue::LinkValue
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the value associated with i
. This is often
used to print or display the value. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
See also: PrintValue::Object, Print::Object
obj = gValue(i); object i; object obj; |
This method is used to obtain the object associated with a link.
i
is the instance of the LinkValue
class, and
obj
is the object associated with it.
See also: ChangeValue::LinkValue, NewWithObj::LinkValue
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class, which is a subclass of NumberArray
, is used to
represent arbitrary shaped arrays of the C language long
data
type in an efficient manner. Although this class implements much of its
own functionality it is documented within the NumberArray
and
Array
classes because the interface is shared by all subclasses
of the NumberArray
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LongInteger
class is used to represent the C language
long
data type as a Dynace object. It is a subclass of the
Number
class. Even though the LongInteger
class
implements most of its own functionality, it is documented as part of
the Number
class because most of the interface is the same for
all subclasses of the Number
class. Differences are documented
in this section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LongInteger
class has only one class method and it is used to
create new instances of itself.
i = gNewWithLong(LongInteger, val); long val; object i; |
This class method creates instances of the LongInteger class. val
is the initial value of the integer being represented.
The value returned is a Dynace instance object which represents the integer passed.
Note that the default disposal methods are used by this class since there are no special storage allocation requirements.
Example: object x; x = gNewWithLong(LongInteger, 55L); |
See also: LongValue::Number, Dispose::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with the LongInteger
class
provide a means of changing and obtaining the value associated with an
instance of the LongInteger
class. All of the
LongInteger
class instance methods are documented in the
Number
class because of their common interface with all other
subclasses of the Number
class.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The LookupKey
class, which is a subclass of Association
,
is used to represent an object which contains a key. It is normally
used in conjunction with the ObjectAssociation
, Set
and
Dictionary
classes in order to manage a group of arbitrary
objects.
Since instances of the LookupKey
class only contain enough
information to describe the key, the LookupKey
class can be
thought of as an abstract class. It is never used by itself (instances
of it are never created). Instead a new class would be created which
would have the LookupKey
class as a superclass. This new class
would describe the data items which would be stored at each link. The
LookupKey
class would keep track of the key to the object.
Alternatively, a new class with the same methods as this class could be
created and used with the Set
and Dictionary
classes.
The LookupKey
class also has a subclass called
ObjectAssociation
which associates a single arbitrary object with
the key.
See the examples included with the Dynace system for an illustration of the
use of the Set
/Dictionary
related classes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class has only a single class method which is used to create and
initialize instances of itself. Although this class can handle
NULL
key values, their use is discouraged.
i = gNewWithObj(LookupKey, key); object key; object i; |
This class method creates instances of the LookupKey
class.
key
is used to initialize the key associated with the instance
created. The new instance is returned.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used access, change,
dispose and print the key associated with the instances of this class.
Additional functionality, although implemented by this class, is documented
in LookupKey
’s superclass, Association
. This is done
because of the common interface these methods share with all subclasses
of Association
.
old = gChangeKey(i, key); object i; object key; object old; |
This method is used to change the key associated with instance i
.
key
is the new key. The old key is simply replaced, it is not
disposed. This method returns the old key object.
See also: Key::LookupKey
c = gDeepCopy(i); object i, c; |
This method is used to create a new instance of the
LookupKey
class which contains a copy of the
key value from the original LookupKey
. DeepCopy
is
used to create the copy of the value. The new
LookupKey
instance is returned.
See also: Copy::Object
r = gDeepDispose(i); object i; object r; /* NULL */ |
This method is used to dispose of instance i
as well as the key
associated with it. It disposes of the key by calling the
DeepDispose
method on it.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::Object
key = gKey(i); object i; object key; |
This method is used to obtain the key associated with instance i
.
See also: ChangeKey::LookupKey
s = gStringRepValue(i); object i; object s; |
This method is used to generate an instance of the String
class
which represents the value associated with i
. This is often
used to print or display the value. It is also used by
PrintValue::Object
and indirectly by Print::Object
(two methods useful during the debugging phase of a project)
in order to directly print an object’s value.
See also: PrintValue::Object, Print::Object
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This class is used to encapsulate the standard C low level IO facility. It
is a subclass of Stream
and enables access to these routines
through an interface which is common to all subclasses of Stream
.
Although this class implements most of its own functionality, it is
documented as part of the Stream
class because most of the
interface is the same for all subclasses of Stream
. Differences
are documented in this section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The one class method associated with this class is the method used to open or create a file.
i = gOpenLowFile(LowFile, name, oflag, pmode); char *name; /* file name */ int oflag; int pmode; object i; |
This class method us used to open or create a normal file using the C
low level IO facility. name
is the file name to be opened and
may also be an instance of the String
class. The name
,
oflag
and pmode
parameters correspond to the local C
library function open
. The local library manuals can more
completely describe those arguments. The value returned is an object
which refers to the opened file. If the file cannot be opened a
NULL
will be returned.
Example: object f; f = gOpenLowFile(LowFile, "myfile", O_CREAT|O_WRONLY, S_IREAD|S_IWRITE); |
See also: Dispose::LowFile, Read::Stream
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The instance methods associated with this class are used to read and write data to the file represented by the instance.
Although this class implements most of its own functionality, it is
documented as part of the Stream
class because most of the
interface is the same for all subclasses of Stream
. Differences
are documented in this section.
r = gDeepDispose(i); object i; object r; /* NULL */ |
This method is used to close the file associated with the instance and
dispose of the instance. It performs the same function as
Dispose::LowFile
.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to
avoid future accidental use.
See also: Dispose::LowFile, OpenLowFile::LowFile
r = gDispose(i); object i; object r; /* NULL */ |
This method is used to close the file associated with the instance and
dispose of the instance. It performs the same function as
DeepDispose::LowFile
.
The value returned is always NULL
and may be used to null out
the variable which contained the object being disposed in order to