ftp.nice.ch/pub/next/unix/database/yooda.1.3.s.tar.gz#/yooda/example/oo7/OO7.h

This is OO7.h in view mode; [Download] [Up]

/********************************************************/
/*                                                      */
/*               OO7 Benchmark                          */
/*                                                      */
/*              COPYRIGHT (C) 1993                      */
/*                                                      */
/*                Michael J. Carey 		        */
/*                David J. DeWitt 		        */
/*                Jeffrey Naughton 		        */
/*               Madison, WI U.S.A.                     */
/*                                                      */
/*	         ALL RIGHTS RESERVED                    */
/*                                                      */
/********************************************************/


//--------------------------------------------------------------------------
// Start with some necessary preliminaries
//--------------------------------------------------------------------------

#define TypeSize	10
#define TitleSize	40
#define DummySize	1000

//const int FALSE = 0;
//const int TRUE  = 1;

typedef enum {Complex, Base} AssemblyType;

typedef enum { Trav1, Trav1WW, Trav2a, Trav2b, Trav2c, Trav3a, Trav3b,
               Trav3c, Trav4, Trav5do, Trav5undo, Trav6, Trav7, Trav8, 
               Trav9, Trav10, Query1, Query1WW, Query2, Query3, Query4,
	       Query5, Query6, Query7, Query8, Insert, Delete, Reorg1, Reorg2,
	       WarmUpdate, MultiTrav1, MultiTrav2, MultiTrav3, MultiTrav4, 
	       MultiTrav5, MultiTrav6 } BenchmarkOp;

typedef enum {UpdateOne, UpdateAll, UpdateRepeat} UpdateType;

typedef enum {UpdateDirectionDo, UpdateDirectionUndo} UpdateDirectionType;

#include "PartIdSet.h"

//--------------------------------------------------------------------------
// AtomicPart objects are the primitives for building up designs
//	- modeled after the Sun/OO1 benchmark's parts
//--------------------------------------------------------------------------

class Connection;
class CompositePart;

DICOGEN(DicoAtomicPartId, AtomicPart, int, id) ;
DICOGEN(DicoAtomicPartDate, AtomicPart, int, buildDate) ;

class AtomicPart {
public:
    const int  			id	 /* indexable */;
    char			type[TypeSize];
    int  			buildDate /* indexable */;
    int  			x, y;
    int                         docId /* indexable */;
    LocalListX<Connection>     	to ; /* inverse_member from; */
    LocalListX<Connection>	from ; /* inverse_member to; */
    Ref<CompositePart>		partOf ; /* inverse_member parts; */

    static Ref<DicoAtomicPartId>	extent_id;
    static Ref<DicoAtomicPartDate>	extent_date;

    AtomicPart(int ptId);
    ~AtomicPart();
    void swapXY();
    void toggleDate();
    int traverse(BenchmarkOp op, PartIdSet& visitedIds);
    void DoNothing();
};


//--------------------------------------------------------------------------
// Connection objects are used to wire AtomicParts together
//	- similarly, modeled after Sun/OO1 connections
//--------------------------------------------------------------------------

class Connection {
public:
    char			type[TypeSize];
    int  			length;
    Ref<AtomicPart>		from ; /* inverse_member to; */
    Ref<AtomicPart>		to ; /* inverse_member from; */

    Connection(AtomicPart* fromPart,
    	       AtomicPart* toPart);
};


//--------------------------------------------------------------------------
// CompositeParts are parts constructed from AtomicParts
//	- entry in a library of reusesable components
//	- implementation is a graph of atomic parts
//	- provides unit of significant access locality
//	- each has an associated (unique) document object
//--------------------------------------------------------------------------

class Document;
class BaseAssembly;

DICOGEN(DicoCompositePart, CompositePart, int, id) ;

class CompositePart {
public:
    const int  			id /* indexable */;
    char			type[TypeSize];
    int  			buildDate;
    Ref<Document>		documentation ; /* inverse_member part indexable ; */
    LocalListX<BaseAssembly>  usedInPriv ; /* inverse_member componentsPriv; */
    LocalListX<BaseAssembly>  usedInShar ; /* inverse_member componentsShar; */
    LocalListX<AtomicPart>	parts ; /* inverse_member partOf; */
    Ref<AtomicPart>		rootPart;
 
    static Ref<DicoCompositePart>  extent ;

    CompositePart(int cpId);
    ~CompositePart();
    int traverse(BenchmarkOp op);
    int traverse7();
    int reorg1();
    int reorg2();
};


//--------------------------------------------------------------------------
// Document objects are used to hold a description of some particular
// CompositePart object
//--------------------------------------------------------------------------

DICOGEN(DicoDocument, Document, StringX, title) ;

class Document {
public:
    StringX			title /* indexable */;
    const int	                id /* indexable */;
    StringX			text;
    Ref<CompositePart>		part ; /* inverse_member documentation; */

    static Ref<DicoDocument>       extent ;

    Document(int cpId);
    ~Document();
    int searchText(char c);
    int replaceText(char *oldString, char* newString);
};


//--------------------------------------------------------------------------
// Manual objects are used to hold a description of some particular
// module.  Really just big documents, only associated with modules
// instead of CompositeParts.
//--------------------------------------------------------------------------

class Module;

class Manual {
public:
    char			title[TitleSize];
    int                         id;
    StringX			text;
    int                         textLen;  
    Ref<Module>		        mod ; /* inverse_member man; */

    Manual(int cpId);
    ~Manual();
    int searchText(char c);
    int replaceText(char *oldString, char* newString);
    int firstLast();
};


//--------------------------------------------------------------------------
// Assembly objects are design instances built up recursively from
// from other Assembly objects and (at the leaves only) CompositeParts
//	- hierarchical (tree) structure for designs
//	- may share composite parts with other assemblies
//	- nonleaf and leaf assembly subtypes
//--------------------------------------------------------------------------

class ComplexAssembly;

class Assembly {
public:
    const int  			id /* indexable */;
    char			type[TypeSize];
    int  			buildDate;
    Ref<ComplexAssembly>       	superAssembly ; /* inverse_member subAssemblies; */
    Ref<Module>			module ; /* inverse_member assemblies; */

    Assembly(int);
    virtual int traverse(BenchmarkOp op) = 0;
    virtual int traverse7(PartIdSet& visitedComplexIds) = 0;
    virtual AssemblyType myType() = 0;
    void    DoNothing();
};


class ComplexAssembly: public Assembly {
public:
    LocalListX<Assembly>  subAssemblies ; /* inverse_member superAssembly; */

    ComplexAssembly(int asId, ComplexAssembly* parentAssembly,
    		    int levelNo, Module* mod);
    int traverse(BenchmarkOp op);
    int traverse7(PartIdSet& visitedComplexIds);
    virtual AssemblyType myType() { return Complex; };
};


class BaseAssembly: public Assembly {
public:
    LocalListX<CompositePart> componentsPriv;/* inverse_member usedInPriv indexable ; */
    LocalListX<CompositePart> componentsShar ; /* inverse_member usedInShar; */

    static Ref< SeqX<BaseAssembly> >	extent;

    BaseAssembly(int asId, ComplexAssembly* parentAssembly, Module* mod);
    ~BaseAssembly();
    int traverse(BenchmarkOp op);
    int traverse7(PartIdSet& visitedComplexIds);
    virtual AssemblyType myType() { return Base; };
};


//--------------------------------------------------------------------------
// Modules are the designs resulting from Assembly composition
//	- unit of scaleup for the benchmark database
//	- may share composite parts with other modules
//--------------------------------------------------------------------------

DICOGEN(DicoModule, Module, int, id) ;

class Module {
public:
    const int  			id /* indexable */;
    char			type[TypeSize];
    int  			buildDate;
    Ref<Manual>                 man ; /* inverse_member mod; */
    LocalListX<Assembly>        assemblies ; /* inverse_member module; */
    Ref<ComplexAssembly>	designRoot;

    static Ref<DicoModule>	extent;

    Module(int modId);
    ~Module();
    int traverse(BenchmarkOp op);
    int scanManual();
    int firstLast();
};


//--------------------------------------------------------------------------
// Dummy objects -- used for cache purging
//--------------------------------------------------------------------------

class DummyObj {
public:
    char			dummy[DummySize];
};

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.